How do I make the animations for each instance different?

Get help using Construct 2

Post » Fri Nov 18, 2016 4:53 am

I'm trying to make a platformer with Mario style jump-and-hit blocks and I'm finding that when the block is supposed to change, all the blocks change. I have the collision set to an image point on the bottom of the block; this works correctly. I am currently trying using to have one animation with two frames control the change: the first frame be the "unused" block and the second frame be the "used" block, though I did try it with separate animations and got similar results.

My current pseudo code:
Code: Select all
 Event: Pick <Player Object> overlapping (<block>.ImagePointX(1), <block>.ImagePointY(1))
     Action: set <block instance number "used"> to 1.
Event: System: every tick
     Action: <block> set animation to <block instance number "used">

I also unsuccessfully tried this instead of the second line:
Code: Select all
Event: <block instance number "used"> = 1
     Action: <block> set animation to <block instance number "used">

Also relevant may be the fact that only the first block actually works when hit at the image point.

Any suggestions would be helpful.
Posts: 2
Reputation: 229

Post » Fri Nov 18, 2016 5:19 am

You could give the object an instance variable named "hasBeenHit" and set it initially to say 0. Then on collision set that instance variable to 1, and have the animation change according to the value of the instance variable.
Just one way of probably many. Hope I helped!

EDIT: Just saw that you want to change animation frame... same as I previously wrote, but have the frame change according to the instance variables value.
Posts: 137
Reputation: 27,881

Post » Fri Nov 18, 2016 2:53 pm

Posts: 664
Reputation: 14,112

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 63 guests