Does anybody know how to make an object to resize gradually by pressing a button? I tried to make it using TimeDelta but it didn't work. To understand me better, go to http://ioj.com/v/3sqm0 . Forward thanks!
Develop games in your browser. Powerful, performant & highly capable.
Key is down --> sprite: set height to sprite.height+1
+ Key is down
-> Set height to .Height + (100 * TimeDelta)
This increases the height by 100 every second while the key is down. Porlo's snippet will depend on the framerate.
If you want it to resize over time after a single keypress, then:
+UP is pressed Set 'Upsize' to 1 +'Upsize' = 1 ++Sprite.Height < 200 >Sprite.Height = Sprite.Height+100*TimeDelta ++Sprite.Height=>200 >Sprite.Height=200 >Set 'Upsize' to 0[/code:2h2lyjnq] After a single keypress, it will grow in height until it hits 200 pixels. + are conditions, > actions, double ++ is a subevent
Wow, cool!