1 decade ago by jaems
I'm a total newbie and following the Jesse Freeman HTML5 textbook.
Anyway for my first game, I have 4-way movement with a little dot.
i want it so that if my player dot collects 3 "food", the next level will automatically load, and so on and so on. I already gave my Player Entity a "food" attr, and have it so that when he touches a collectible, it kills() itself, and food attr increments by 1.
So now I just need to find a way to check for each level if player has collected certain amount of food. Something like if (player.food >= 3){ //load next level and reset player.food }
I was thinking that I would have to code this in js file for the first level that I loaded (room.js), but I'm not sure on the best way to go about doing this.
Anyway for my first game, I have 4-way movement with a little dot.
i want it so that if my player dot collects 3 "food", the next level will automatically load, and so on and so on. I already gave my Player Entity a "food" attr, and have it so that when he touches a collectible, it kills() itself, and food attr increments by 1.
So now I just need to find a way to check for each level if player has collected certain amount of food. Something like if (player.food >= 3){ //load next level and reset player.food }
I was thinking that I would have to code this in js file for the first level that I loaded (room.js), but I'm not sure on the best way to go about doing this.