Problem with animation against walls

0 favourites
  • 9 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • 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!

  • Without seeing you CAPX its very hard for me to help you out

  • 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...

  • 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...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As I said...make sure, that there is no "throw back"

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

    <img src="http://dl.dropbox.com/u/36472942/construct/forumhelp/AnimationFail.JPG" border="0">

    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.

  • 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.

  • Ok, thank you so much! I realized of the difficulties of using platforms and physics xD

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