Jump to content

Item collection


razzmattack
 Share

Recommended Posts

I've been following this tutorial to create my first game in html. So far its been pretty great, everything seems to work just fine. Now that i've reached the end of the tutorial i've been modifying the game made to be more interesting. I'm trying to do two things and for the life of me I can't seem to figure out how to code it correctly.

 

1. This is a item collection game, but the tutorial only shows how to get the base number of items to spawn for points. Is there a way I can get more items to spawn as the old ones are collected and to cap it at a certain score?

 

2. As the score goes up i'd like to display messages. Currently I have been trying to use if(score == "score number here") with little success.

 

I was hoping to get some directions on the matter, thanks!

Link to comment
Share on other sites

Welcome to the community!

 

1. It depends how you want those new items to spawn. Maybe when the player grabs an item, another item spawns somewhere else? What are you thinking?

 

2. Try using the greater than operator and a number instead of a string:

if (score >= 1000) {  // Do something here...}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...