How do I set and play animation on keypress?

Get help using Construct 2

Post » Wed Jun 29, 2016 9:24 pm

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: Image

Can you help me?
B
5
Posts: 12
Reputation: 249

Post » Wed Jun 29, 2016 11:00 pm

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

Are sprint, walk, crawl and idle really playing ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jun 30, 2016 1:54 am

@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...
B
98
S
34
G
20
Posts: 438
Reputation: 17,825

Post » Thu Jun 30, 2016 6:45 am

99Instances2Go wrote: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
B
5
Posts: 12
Reputation: 249

Post » Thu Jun 30, 2016 9:02 am

your event 21 is not under 17 like 18,19,20
click, hold on event 21 and drag it up under event 17
Image
B
67
S
40
G
48
Posts: 680
Reputation: 34,041

Post » Thu Jun 30, 2016 3:30 pm

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.
B
98
S
34
G
20
Posts: 438
Reputation: 17,825

Post » Thu Jun 30, 2016 3:42 pm

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).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests