How do I make the animations for each instance different?

0 favourites
  • 3 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • 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:

     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">
    [/code:3ojwth9v]
    
    I also unsuccessfully tried this instead of the second line: 
    [code:3ojwth9v]Event: <block instance number "used"> = 1
         Action: <block> set animation to <block instance number "used"> [/code:3ojwth9v]
    
    Also relevant may be the fact that only the first block actually works when hit at the image point.
    
    Any suggestions would be helpful.
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)