Platformer not jumping because of animation?

Get help using Construct 2

Post » Wed Jun 01, 2016 11:24 pm

Hi all,

I have a problem with my platform game where I have set the W key to jump for my character. I also set an animation to play while the character jumps. The only problem is whenever I click W, the player doesn't always jump but the animation still plays. Sometimes, maybe like 10% of the time, the player will jump and the animation will play but normally it doesn't. I'm guessing it is because I have another animation running (Idle and walking), but not entirely sure. The code is very simple. It's just:

When W key is down ====>
Simulate control Jump
Set animation to "Jumping" (play from beginning)

Any advice is appreciated :)
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Wed Jun 01, 2016 11:28 pm

Why not use the trigger "On W pressed"?
not sure why it's not jumping, but I can tell you that animation is being set over and over (every tick) until W is released.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Jun 02, 2016 1:37 am

Yeah, @spacedoubt is basically right. Had the same issue a long time ago. You'll want to set that to "On W Pressed".
I like giving game advice more than I actually like making games ;)

Image
B
40
S
15
G
3
Posts: 129
Reputation: 4,651

Post » Thu Jun 02, 2016 1:41 am

@TabloidA @spacedoubt I tried to set it to On W Pressed however then the player doesn't move even though I have Simulate Control. I'm not sure why but On W down worked so I just used that instead
Last edited by HZGaming on Thu Jun 02, 2016 1:49 am, edited 1 time in total.
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Thu Jun 02, 2016 1:48 am

well, one is a trigger and one is not. meaning all the actions tied to "on W down" are going to happen waaay more times than they need to.

If it's not working with on pressed, there's an issue somewhere else..

I'll take a shot in the dark.. are your sprite's collision boxes changing? or is there any other reason the platform behavior is not registering your sprite as on the ground? (see, if this were changing, say, for example, because your collision boxes are changing with the animation frames, then jump will not work as a trigger.. but having it trigger every tick until it registers as on the ground, would get you a jump)
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Jun 02, 2016 1:52 am

@spacedoubt the frames are definitely changing in my character but I set the origin in each frame the same. Sometimes the frames might overlap the ground instead so that might be it. I'll test it out
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Thu Jun 02, 2016 1:55 am

what about the collision box of each frame? is it changing?
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Thu Jun 02, 2016 2:00 am

Oh haha it took me a second to register what you meant by collision box. Yes they are changing but I just corrected it so that the frame size and collision box size is the same in the entire animation. Unfortunately that did not correct my problem. The character still does not move when the W key is Pressed.
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Thu Jun 02, 2016 2:09 am

Here's all my code. It's only 13 blocks of basic controls.

http://imgur.com/a/GHBO7
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Thu Jun 02, 2016 2:23 pm

It seems like the problem could either lie in the "Wait 0.5 seconds", or "When isShooting is equal to 0". A capx would be nice so we could look at the entire project better.
I like giving game advice more than I actually like making games ;)

Image
B
40
S
15
G
3
Posts: 129
Reputation: 4,651

Next

Return to How do I....?

Who is online

Users browsing this forum: rayolf, Yahoo [Bot] and 9 guests