Jump to content

  • Log In with Google      Sign In   
  • Create Account


#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