Sprite Movement Issues

Get help using Construct 2

Post » Sun Mar 10, 2013 5:48 pm

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?Excal2013-03-10 18:04:53
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Sun Mar 10, 2013 5:53 pm

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 :(
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Sun Mar 10, 2013 5:58 pm

The project won't open properly. Do a 'Save as single file' instead, and post the CAPX file (it's the same as ZIP).
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Post » Sun Mar 10, 2013 6:03 pm

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

SpriteIssues.capx
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Sun Mar 10, 2013 6:30 pm

Why not use the 8Direction control - it will do most/all of this for you.
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Post » Sun Mar 10, 2013 6:36 pm

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.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Sun Mar 10, 2013 6:40 pm

You can detect '8Direction is moving' & use the expression Hero.8Direction.MovingAngle = X to modify the movement.
ImageImageImage
B
67
S
19
G
122
Posts: 3,207
Reputation: 73,401

Post » Sun Mar 10, 2013 6:55 pm

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.
B
15
S
4
G
4
Posts: 294
Reputation: 3,225

Post » Sun Mar 10, 2013 6:56 pm

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

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. Excal2013-03-10 18:56:48
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Post » Sun Mar 10, 2013 6:58 pm

[QUOTE=Thndr] 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.[/QUOTE]

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.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194

Next

Return to How do I....?

Who is online

Users browsing this forum: mallorcaredes, ultrafop, Yahoo [Bot] and 2 guests