Player Direction

Get help using Construct 2

Post » Tue Mar 11, 2014 2:48 am

Hey Guys and Gals

I am working on a top down game. The player uses 8Direction Behavior for movement.
I am using this expression for movement animations

8Direction is moving | playerAnimations | "walk"&ceil(8*(1+player.8Direction.MovingAngle/360)-0.5)%8 (play from current frame)

And the same expression for attack and idle as well

player is Attacking | playerAnimations | "attack"&ceil(8*(1+player.8Direction.MovingAngle/360)-0.5)%8 (play from current frame)
X 8Direction is moving| playerAnimations | "idle"&ceil(8*(1+player.8Direction.MovingAngle/360)-0.5)%8 (play from current frame)

My movement animations are set as follows in one sprite:
Walk: Attack: Idle:
walk0 attack0 idle0
walk1 attack1 idle1
walk2 attack2 idle2
walk3 attack3 idle3
walk4 attack4 idle4
walk5 attack5 idle5
walk6 attack6 idle6
walk7 attack7 idle7

Everything is working as intended. Though when I move the player in any direction, on release of the directional button (d pad or key press) the player returns to facing to the right.

I would like to have it where if you are in motion in a particular direction, on stopping the player would stay facing in that direction, rather than returning home.. If that makes sense.
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,944

Post » Tue Mar 11, 2014 9:05 am

Can you attach the .capx ? Just with the concerned system ? I'll have a look on it.
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Tue Mar 11, 2014 3:08 pm

Joskin wrote:Can you attach the .capx ? Just with the concerned system ? I'll have a look on it.


Thank you much! I appreciate it. I'm thinking I may have to create a more custom and detailed approach, but figured I'd ask for some insight incase there is a simpler way or I am just missing something.
You do not have the required permissions to view the files attached to this post.
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,944

Post » Tue Mar 11, 2014 3:18 pm

Is this what you want ?

If yes, you can avoid the globar var and add an instance variable to the player sprite, more elegant.
You do not have the required permissions to view the files attached to this post.
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Tue Mar 11, 2014 3:46 pm

Joskin wrote:Is this what you want ?


:mrgreen: This is exactly what I was looking for! Yes I will be using an instance var - a lot more elegant!

Thank you so much!
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,944


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, Meqara, mrkaio and 2 guests