Problem with animation against walls

Get help using Construct 2

Post » Sat Jan 28, 2012 10:19 am

Hi! I'm wondering why does my platform-behavior character keeps playing the moving animation (well, it just plays the start once and again fast) after it collides with a wall. I've tried many things:

!=(Platform is moving) && Platform is on floor: set animation to default.
Player.Platform.Speed < 5: Set animation to default.
Platform has wall to left: Set animation to default.

But nothing works, it just keeps playing the start of the walking animation.

I know there must be a easy way to fix it and I will feel like an idiot when you tell me, but I can't lose more time on this xD thanks in advance!
B
22
S
3
G
6
Posts: 59
Reputation: 4,450

Post » Sat Jan 28, 2012 11:11 am

Without seeing you CAPX its very hard for me to help you out
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Jan 28, 2012 11:17 am

http://dl.dropbox.com/u/41192999/buggy.capx
Sorry n__n"
B
22
S
3
G
6
Posts: 59
Reputation: 4,450

Post » Sat Jan 28, 2012 11:37 am

From the first look, I would say that you have two animations "fighting" for the right to be shown. I have to understand your code first to be really sure.

Yapp - WALKING and DEFAULT are the two compettitors

You have to review your code. Since you are useing PHYSICS your avatar gets "reflected" by the obstacles, ie. he gets thrown back y few pixels, so if the right arrow is still pressed, the plattform is still "moveing" after the short stop at the wall. The stop makes "DEFAULT" visible and then the "throwback" immediatly starts "WALKING" again...Weishaupt2012-01-28 11:43:03
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Jan 28, 2012 11:54 am

Nope, if I add a sprite without physics, just solid behavior, the same thing happens. I think it's a problem with the events that change the animations, but I can't figure it out...
B
22
S
3
G
6
Posts: 59
Reputation: 4,450

Post » Sat Jan 28, 2012 12:28 pm

As I said...make sure, that there is no "throw back"
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Sat Jan 28, 2012 5:27 pm

If in event 1 you add another condition "Platform has wall to right" and invert it, the animation stop trying to be updated.


Also, you really should remove the physics behaviors as they don't work/interact with the platformer behavior.

Finaly a little look at Ashley's tutorial about making platform games should be of help, giving you the good practice of using an invisible sprite as the "controlled character" instead of the sprite with the animation directly, this might be helpful later on in your project.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Sat Jan 28, 2012 7:29 pm

I strongly support Kyatirc's advice about using an invisible sprite as the "controlled character" instead of the sprite with the animation directly. See also my platform tutorial for another example of making the active player an invisble sprite- and it includes reacting to wall collision events.
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Sun Jan 29, 2012 2:43 pm

Ok, thank you so much! I realized of the difficulties of using platforms and physics xD
B
22
S
3
G
6
Posts: 59
Reputation: 4,450


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 29 guests