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

2015/5/5

increase integer [HELP]

pandu4431 pandu4431

2015/5/5

#
how to increase value of integer every my score %100,??? the integer in World.class
azazeel azazeel

2015/5/5

#
if(myscore %100==0) x++;
pandu4431 pandu4431

2015/5/5

#
if i do that, the enemy appears much at once directly and i think it because the mod == "0"
azazeel azazeel

2015/5/5

#
i see... you want to summon an enemy when myscore %100==0 you should put checking only when score was added myscore++; if(myscore %100==0) x++;
danpost danpost

2015/5/5

#
The way azazeel gave will work. It is always best to check these type values (scores, lives, health, etc) immediately after their values are changed. If not done immediately, the comparison may remain true for multiple act cycles and you will be doing the action required unnecessarily multiple times. If doing things like working with images or adding new actors into the world, you could end up with your project lagging, or even worse, crashing.
You need to login to post a reply.