0 Favourites

Sprite Movement Issues

  • I've been trying to make a smooth animation of a moving sprite, but I'm running into a few issues that I can't quite figure out:

    -Sometimes the sprite will be facing left and/or playing the left movement animations while the player is holding down the move right key (the sprite's actual movement is spot-on, but the animations are off).

    -The sprite seems to get stuck in certain areas of the layout, and I'm not sure why.

    EDIT: Link updated, please check reply #3 below.

    Can someone help me out?

  • Movement is handled via WASD keys. I would update my original post to say this, but apparently I don't have the reputation to do so :(

  • The project won't open properly. Do a 'Save as single file' instead, and post the CAPX file (it's the same as ZIP).

  • Sorry about that. Here's a link that should work:

    SpriteIssues.capx

  • Why not use the 8Direction control - it will do most/all of this for you.

  • 8Direction control will not make the sprite animations smooth. Unless I am missing something here, 8Direction control only handles movement, whereas my issues are related to sprite animation smoothness and an issue where the sprite faces the wrong direction when moving.

  • You can detect '8Direction is moving' & use the expression Hero.8Direction.MovingAngle = X to modify the movement.

  • The platformer tutorial has a good solution I've been using

    On "A" key down

    Set mirrored

    Simulate Platform Left

    On "D" key down

    set not mirrored

    simulate platform right

    However, if you have separate Left and Right animations, you can replace the Mirrored function with a boolean if they are going left or not, and in your animations differentiate it there.

    Platform Moving

    Set animation running

    Platform moving

    if BOOLEAN

    Set animation left running

    if NOT BOOLEAN

    Set animation right running

    Could also add an "platform on ground" to the moving checks as well if you want to make sure.

  • ou can detect '8Direction is moving' & use the expression Hero.8Direction.MovingAngle = X to modify the movement.

    Yes, but my issues are not with the movement. My issues are with sprite animation.

    Movement is working fine in the four directions I want.

  • The platformer tutorial has a good solution I've been using

    On "A" key down

    > Set mirrored

    > Simulate Platform Left

    On "D" key down

    > set not mirrored

    > simulate platform right

    However, if you have separate Left and Right animations, you can replace the Mirrored function with a boolean if they are going left or not, and in your animations differentiate it there.

    Platform Moving

    >Set animation running

    Platform moving

    >if BOOLEAN

    >>Set animation left running

    >if NOT BOOLEAN

    >>Set animation right running

    Could also add an "platform on ground" to the moving checks as well if you want to make sure.

    My animations are pretty smooth, that's not an issue I have.

    The issue I have is sometimes the walk-left animation is playing (likely due to a previous "walk left" command) when the character is moving right.

  • Here is a live demo that showcases the sprite animation issues.

    DEMO

  • <img src="smileys/smiley5.gif" border="0" align="middle"> I figured out your 'not moving' issue. You have the 'ScrollTo' behaviour, but no background to see a visual reference to. The 'stuck' issue is that the background is scrolling, which makes the sprite appear stationary. Here's my quick and dirty 8Dir WITH a background.

    SpriteIssues_8dir

  • Ah, that makes sense.

    Your link requires a login, by the way.

    Now to figure out how sprite animation optimization in Construct 2 works. I'm convinced my method of using Wait is not the best way, which is why the sprite sometimes moves right while finishing a 'walk left' animation.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Link fixed.

  • Ugh, I can't open it because you're running an updated beta version that isn't compatible with the latest stable release.

    Do you know where I can get the latest beta?

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