Gradual resize by pressing a button.

For questions about using Classic.

Post » Sat Apr 18, 2009 2:13 pm

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! :)
B
78
S
23
G
6
Posts: 234
Reputation: 7,662

Post » Sat Apr 18, 2009 3:55 pm

Key is down --> sprite: set height to sprite.height+1
B
2
S
1
G
4
Posts: 71
Reputation: 1,342

Post » Sat Apr 18, 2009 4:25 pm

+ 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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Sat Apr 18, 2009 4:29 pm

If you want it to resize over time after a single keypress, then:

[code:2h2lyjnq]+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
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sat Apr 18, 2009 5:57 pm

Wow, cool! :D Ye, that's what I was trying to achieve! Thanks, guys, that really helps! :D
B
78
S
23
G
6
Posts: 234
Reputation: 7,662


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests