How do I set and play animation on keypress?

0 favourites
  • 7 posts
From the Asset Store
A complete set of Graphic, User Interface element to build 2D mobile game or PC game.
  • I want to play animation on key "E" press. The problem is that animation is not changing from "idle" to "felling". :/

    Here's my code:

    Can you help me?

  • Bring the 'is playing' from event 21 to event 17.

    Are sprint, walk, crawl and idle really playing ?

  • COVERR

    at line 21 you are checking if animation "felling" is not playing, then set animation to idle.

    well, "felling" is never playing, so the animation is always getting set to idle.

    you should be checking if "felling"&self.a is not playing...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Bring the 'is playing' from event 21 to event 17.

    Are sprint, walk, crawl and idle really playing ?

    Animations idle, walk and sprint are playing. Crawl not :/

    I am really new in Construct 2 and i don't know how to do this

  • your event 21 is not under 17 like 18,19,20

    click, hold on event 21 and drag it up under event 17

  • looks like event 21 is in the right place to me.

    I would check to make sure you actually have the "crawl"&self.a animations named correctly - if the name of the animations inside the sprite does not match, then it can't play it.

  • Not only that, if it starts the animation to play from the beginning every tick, then all you see is the first frame.

    But, i can not state that based on a screenshot of 2 % of the event sheet.

    There are 2 options.

    The conditions is a trigger. The animations will play fine. Example:

    On Jump.

    Play animation "x-file" from beginning.

    The conditions are no trigger, then the condition can be true for many tricks in a row. Should use a 'trigger once while true'. Example:

    Compare two values > velocityX > 0

    Trigger once while true

    Play animation "x-file" from beginning.

    This means that one needs events to do stuff thats needs to evaluate and run actions every tick.

    And seperatly events that trigger animations. (can be subs).

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