Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualWaterlimon

Posted 29 March 2013 - 03:58 AM

Or you could simply store the time when the grass was created, and deduce the growth/age from that using the current time.

 

 

If you do some action on the tile that affects its growth you might want to reset its age and set its growth to what it was + the effect.

 

So:

 

T (age=5, lastGrowth=0)

*hit grass*

T (age=0, lastGrowth=5) //what the growth would be after age 5

T (age=0, lastGrowth=4) //reduce effect of hit

*time passes*

T (age=1, lastGrowth=4)

 

EDIT:

nowait, age should be "created", holding the game time at the time of the last update of the grass tile.


#1Waterlimon

Posted 28 March 2013 - 07:54 AM

Or you could simply store the time when the grass was created, and deduce the growth/age from that using the current time.

 

 

If you do some action on the tile that affects its growth you might want to reset its age and set its growth to what it was + the effect.

 

So:

 

T (age=5, lastGrowth=0)

*hit grass*

T (age=0, lastGrowth=5) //what the growth would be after age 5

T (age=0, lastGrowth=4) //reduce effect of hit

*time passes*

T (age=1, lastGrowth=4)


PARTNERS