Switch

Discussion and feedback on Construct 2

Post » Mon Jul 04, 2016 2:28 am

Hello
how do I switch between sprites through a button

explain :
on clicking on a button ( or arrow ) it switch to the next object ( sprite ) till the last on then recycle the list or toggle to the beginning ?
thanks for advance
B
22
S
8
G
2
Posts: 77
Reputation: 2,701

Post » Mon Jul 11, 2016 6:07 pm

make a sprite with a different image on each frame
set the speed to 0 so that it doesnt animate

then when you press your button

On button press -> set sprite.frame - > sprite.frame +1
if sprite.frame = sprite.totalframes -> set sprite.frame = 0
B
87
S
44
G
16
Posts: 1,009
Reputation: 17,946

Post » Mon Jul 18, 2016 11:49 pm

thank you @justifun
B
22
S
8
G
2
Posts: 77
Reputation: 2,701


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests