how to animate character when decelerating

0 favourites
From the Asset Store
2d warrior machrom platformer game character assets
  • hola

    as showing sprite animation when platform is in slowdown

  • What is your question? Don't understand your question

  • how to display animation

    when platform is in slowdown

  • how to display animation

    when character platform is in desceleration

  • If I understand correctly you would like to know if the speed is decreasing, to play a different animation..

    You could give the player sprite a varaiable Lastspeed and every x seconds check if this last speed is higher than current speed

    system every x seconds

    system compare two values player.lastspeed > player.speed

    player animation deceleration is not playing

    • player set animation to deceleration

    and add an event AFTER this one to set player.lastspeed to player.speed

  • do not know much but I managed to do something thanks for your reply

  • Also, if you're wanting it to change on deceleration that occurs after movement, all you need to check is it any of your movement keys are released using a Keyboard check, and if so, then play the deceleration animation for the object you want to animate.

  • hello

    achieved on key released do animation plays but it works only after releasing the key to not follow the animation

    i am using the platform for player behavior

    on release of the button which says the deceleration little stain could be useful starting

    but I do not understand

     

    thanks for the help

  • It may be a little more advanced, but you know the maximum speed of your character--you set that on the Platformer properties. I would just compare the player's Vector X (it is a platformer event). If it is greater than, say, 10 or something small AND the player is not holding a movement button, play your deceleration animation. This way, it will play it at the right time and for the right duration.

  • Great tip inquiesco, it is always better to save CPU. By checking every tick you could very well check a few thousand times before the velocity of the character changed. But...you can't just go by input (key/touch). What if the character was moving along and ran into something in the environment (mud/NPC) that affected speed? I would expand on your inout and do it this way:

    1) check for input (any)

    2) yes? Slow down? Set player instance state to SLOWING

    3) no continue check other inputs

    ...

    9) if player instance state != to current state then process

    10) is player SLOWING? Yes play animation and Slow

    Just my 2 cents.

    Actually you could just use the Siginal / Wait for signal also

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can provide an example for better understanding

  • Great tip inquiesco, it is always better to save CPU. By checking every tick you could very well check a few thousand times before the velocity of the character changed. But...you can't just go by input (key/touch). What if the character was moving along and ran into something in the environment (mud/NPC) that affected speed? I would expand on your inout and do it this way:

    1) check for input (any)

    2) yes? Slow down? Set player instance state to SLOWING

    3) no continue check other inputs

    ...

    9) if player instance state != to current state then process

    10) is player SLOWING? Yes play animation and Slow

    Just my 2 cents.

    Actually you could just use the Siginal / Wait for signal also

    Thanks , and you're correct, there could be blocks impeding speed, . In that case I'd make a condition where on key release or on collision with an object and player speed is less than their max speed to play a slower animation like this:

    Keyboard -> On key released

    • or -

    player -> On collision with slow_object

    ---- player -> 8Direction speed < player.8Direction.MaxSpeed

    -------- Rest of events

  • Post your CAPX and see what I can do for you

  • https:// dropbox.com /s/ 9lb5378i1zban37 / example.capx?dl = 0

    remove space

  • If it suits your application then you could just try this:

    Set your "walking" animation to speed 0 then do the following

    Platform is Moving --> Set Animation speed: player.Platform.Speed/5

    Edit the "5" at the end to effectively control the frame rate so to say.

    This will accelerate and decelerate your "walking" animation in time with your movement, but can often end with say, your characters leg half way in the air etc... It works for my purposes, but yeah, not every ones.

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