replit / kaboom

💥 JavaScript game library
https://kaboomjs.com
MIT License
2.66k stars 226 forks source link

Intro code cannot work #784

Open Clemix37 opened 10 months ago

Clemix37 commented 10 months ago

Hello,

I was reading again the intro on the webiste but i found out that the full game code (can be found here) cannot work because of the score variable that is not scope of the lose scene ... Score is declared inside the game scene, but we try to get it in the lose scene which cannot work.

UnPolloLoco commented 10 months ago

More specifically, putting the score variable into the scene is never explained, but instead just put into the full code example at the bottom of the page;

This line isn't explained: scene("lose", (score) => {

UnPolloLoco commented 10 months ago

This is not fixed yet. Please reopen.

slmjkdbtl commented 10 months ago

The full code below does work, but yeah it's not explaining we're passing score through go("lose", score) and the lose scene gets it from the function argument. I'll add explanation soon.