This site requires JavaScript, please enable it in your browser!
Greenfoot back
TakedaYeet
TakedaYeet wrote ...

2020/2/11

help with a counter

TakedaYeet TakedaYeet

2020/2/11

#
im making a game where a car runs over people and every time the car runs over someone, the counter adds 1, i want to go to the next level once the counter reaches a certain number, how can i do this. PLEASE HELP!!!
danpost danpost

2020/2/11

#
TakedaYeet wrote...
im making a game where a car runs over people and every time the car runs over someone, the counter adds 1, i want to go to the next level once the counter reaches a certain number, how can i do this
Right after the counter adds 1, add an if block comparing score to certain number and transitioning to next level if equal.
TakedaYeet TakedaYeet

2020/2/12

#
can you give the code as my problem is that i dont know what to write in the if block
Super_Hippo Super_Hippo

2020/2/12

#
You will need the Greenfoot.setWorld method in the if block to go to the next level.
TakedaYeet TakedaYeet

2020/2/12

#
i mean i don't know how to check the amount in the counter
Super_Hippo Super_Hippo

2020/2/12

#
How do you add something to the counter? It should be pretty similar to get the value stored by the counter.
TakedaYeet TakedaYeet

2020/2/12

#
yes, i just dont know the code to check the amount
danpost danpost

2020/2/13

#
TakedaYeet wrote...
yes, i just dont know the code to check the amount
Will need to see Counter class code and scoring codes. Any code we provide now would be just pseudo-code (which I basically described above).
You need to login to post a reply.