Platformer Player Animation

This forum is currently in read-only mode.
  • Well, after messing with the basic Platformer, it'd be nice to know about the animation of sprites and how to control them.

    I'd use Midnight's example but Construct crashes on my when I try to open a sprite the second time.

    And yea, I've been asking for a lot >_<

  • Hey hey hey! Sorry to hear of your problems. Animations confused me big time until I got some help from the Captain (RIP).

    If you want, you can send me your cap or upload it and I can take a look.

    Basically, you're going to only be making the animations for facing right, and check the "auto mirror" under properties to flip the animation. When player presses the right key, set the angle of the player to 0; when left set the angle to 180.

    Here is the code I'm using for my project: (edited for simplicity)

    MouseKeyboard: Key Right arrow is down

    System: 0 SpankyBoot[Platform].VectorY Equal to 0

    Spanky: Value 'Dead' Equal to 0

    System: Trigger once

    SpankySet animation to "Walk"

    SpankyPlay current animation

    SpankySet angle to 0

    SpankyBootSet angle to 0

    The 'dead' value thing is just so that player cannot move once marked as being dead.

    When trying to change the animation of the sprite (from Idle to walking for example) make sure to use this guideline:

    1. Change Sprite to "animationname"

    2. Set Sprite Animation Frame to 1

    3. Sprite: Play Animation

    (yes i know that isn't followed in the above code )

    Making duck animations is a little trickier, and attack animations that involve not shooting objects (like using a sword attached to the player or a punch) is definately a bit more complex. My game's sprite has three detectors: Hit Detector, Attack detector and Floor detector.

    LOL this is probably more confusing than I intended for ti to be...explaining things isn't my strong point

    perhaps I'm better off looking at you cap to help ya out

  • I was actually using your spanky.cap file for a tutorials

    But for some odd reason when I tried "Spanky(or any other name)Boot[Platform]VectorY", it didn't work because it said the VectorY wasn't a choice or variable or whatever :S - even though VectorY was check/there.

  • LOL to be honest the whole vector.Y thing was a suggestion from another user. I just figured it means the player is on ground. I'll have to re-examine the code when I get back on my pc.

    I have another (rather silly) platform mock up that I will send you, just email me at midnight_aaron at yahoo.com and I'll send it your way. It's the same stuff but also handles using multiple characters and jumping on enemies.

    Let me know what you're trying to achieve, as in Mario, Mega Man, ect. and I can help you more.

    Kippis!

  • Okay, now I am back on my pc, so I'm checking the code.

    I better solution for left/right animation is this:

    FootDetector: is on ground

    MouseKeyboard3: Key Right arrow is down

    FootDetectorSet animation to "Walking"

    FootDetectorSet animation frame to 1

    FootDetectorPlay current animation

    Now we are using the "is on ground" event instead of that vectorY stuff. This should be rather easy to understand. I'll send you the cap still, just email me .

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok ,thanks! I'll try this out ASAP.

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