How do I Get animations to play for actions?

  • I'm a big Sonic fan and finding out how powerful construct 2 is in programming a workable game I "jumped" at the chance.

    So far I've managed to make a basic movement with mirror action (walking left and right),

    also implemented crouch and jump, but I seem to be running into a few problems.

    Crouch only plays the first frame (there are 3 frames)

    Jump only plays the first frame (spin jump has about 7 frames)

    I did manage to make an action for "Pressing Down" while crouching and Press "A" to start the spindash Rev"

    Unfortunately this also plays the first frame but no others.

    I'm not using the Player Box (invisible box) technique, just the sprite with actions.

    Any help to solve these problems would help me have a good nights sleep lol.

  • Did you check your Animation properties? Maybe the speed is 0? How do you switch Animations?

  • I usually plan it all out: I write down all the animations I'm going to have. Then I take a placeholder as the main player and give it variables (boolean) like "jump" "run" "duck" etc. Then I make a page that says:

    if NOT jump

    if NOT fall

    if NOT run

    if NOT duck

    ---set animation to idle

    Later on you might have:

    Presses "SPACE" bar

    Platform is on ground

    if NOT jump

    if NOT fall

    ---simulate platform jump

    ---set animation to jump

    ---set jump to "true"

    For jumping and double jumping I use variables to determine if the player is double jumping etc. The Platform+ object doesn't need this I think, and I haven't played with it enough to know.

    I hope this all made sense! Good luck!

  • Is it maybe possible that you set jump back to false too early?

    And did you check about Animation speed?

  • Oh yeah, that's another thing, doing things too soon. Remember, the computer can't read in 3D like we can. A human can assess his environment even if it's not being observed. A computer is similar, except it only does what it's told to do and with the things it's told to do them. AND IT DOES IT in a specific way, from top to bottom, one at a time, and the current piece of code takes authority over the one before it.

    Take any action in your game, and write it out before you code it if you have to. For example, a problem I run into is like this:

    Is touching something //here you're touching something

    ---Is Variable = 0 // if var is 0

    ------Set Variable to 1 // set to 1

    ---Is Variable = 1 //here is the authority problem, the "set to 1" above makes this statement true now, so it runs this instead of stopping at setting to 1

    ------Set Variable to 2 //same continues until the end value is 0.

    ---Is variable = 2

    ------Set Variable to 0

    What happens here is the variable will be equal to 0 at the end because you are touching, and it's quickly turning it to 1, then turning it to 2, which makes it 0 again.

    The same code, just fenagled with:

    Is Variable = 2

    ---Set Variable to 0

    Is touching something

    ---Is variable = 1

    ------Set Variable to 2

    ---Is Variable = 0

    ------Set Variable to 1

    This way above it won't accidentally read previous values and update those, but is locked itself in a "dead end" situation with the block of code. This is an example of an "on off" switch or button etc.

    This works for all things, not just switches but animations as well. My original reply is my favorite method because it creates a solid "rubber band" style of game play, where "jump" or "run" or "walk" is like "popping the rubber band" but it all goes back in place once you're done.

  • Does that mean you found the solution?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm totally stumped, not sure how to set variables.

    Heres my actions so far that seem to work OK.

    Walking works left and right

    crouch works but only the first frame

    Jump won't paly anything but the first frame.

    Tried the simulate jump action but it still only plays the first frame.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)