We are about to switch to a new forum software. Until then we have removed the registration on this forum.
So im making the most basic thing that I know how to code, a clicker game, and im trying to figure out how to add points every so seconds. So for example one of the things adds one point every second then one it would add 2 points, and im not sure how i would go about doing this. If you have an answer that would be great!
Answers
Use
millis()
. It returns the number of milliseconds since the sketch started. So if you want something to happen every second, first, remember the value returned bymillis()
at the end of setup(). Then, in draw, check to see if the value that millis() returns then is more than 1000 different. That is,if( millis() > time +1000 ){
. If this condition is true, then you know at least one second has passed. In this conditional statement's code block, you can do any actions that should happen every second. And then, finally, remember the NEW value of millis(), so that this conditional statement will become true again in another second.Thank you so much! This helped so much!.
https://Forum.Processing.org/two/discussion/23846/time-delay-in-python-mode#Item_11
http://Bl.ocks.org/GoSubRoutine/1a0d21828319cf18fecf44101764bd60
How can my friends play my game that i have made with processing?