How do I make a character turn around with animation

Get help using Construct 2

Post » Sun Sep 06, 2015 6:47 pm

This one seems quite a simple one to resolve but I have spent hours trying to make it work and failed, so maybe some of you can help.

The main player in this game can move left to right (using the mirror), jump and all that.

While on the ground I want the character to turn around before start moving in the opposite direction so what I did was using "on pressed Right, play the turn animation" then on another Event, I did "once the Turn animation is over, do mirror". This works if I keep pushing in the same direction so the guy turns and starts running, but if I just tap the key to the right, he will do the turn animation, then do the first frame of the turn animation before mirroring, can you tell me how do I solve this?

Also I have noticed a strange behavior with a few things every now and then, but the most recent example is actually with the turning: If I am moving Left, then release, and press right immediately, the character does not turn as if there was some kind of lag that did not make him register I pressed down the key, but if I do not use the turn (so the character just flips immediately) this is not an issue. It almost feels as if press down key "left" is not working because I am doing it at the same time as "release key right" but I do not think it's that.

Cheers
B
6
Posts: 14
Reputation: 278

Post » Mon Sep 07, 2015 7:12 pm

Could you upload your .capx here. Recreating what you want then trying to fix it will prove difficult without your work to work on.
B
8
S
1
Posts: 34
Reputation: 599

Post » Tue Sep 15, 2015 11:45 pm

I do not feel too confident sharing assets online, so can someone just tell me how can this be done without messing up the mirrored stuff or the idle/run animations?

I have done it in several ways, but none of them really worked, when playing with a keyboard is so easy to press left/right and break the system by making it do something like moonwalking and things which would not be possible if using a joystick.

Ideally I am trying to create something that I remember Symphony of the Night to have.

You move right, then press left, your character does not stop but rotates in that direction then starts playing the run animation in the opposite direction. And if you press left and right quickly, the character will always stop playing first what's currently playing (without messing up the mirror).
B
6
Posts: 14
Reputation: 278

Post » Wed Sep 16, 2015 12:05 pm

It's actually not that hard to implement..

Something like:

on pressed left
-- player is facing right
> play turning animation
-- player is facing left
> player simulate pressing left


on turning animation finished
--player is facing right
> player set facing to left
-- else
> player set facing to right

should be a good start..

I like using this for registering keyboard input:

viewtopic.php?f=147&t=145626&p=935907&hilit=easy+keyboard+littlestain#p935907
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 16, 2015 12:58 pm

Message: Black Rabbit is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
LittleStain wrote:It's actually not that hard to implement..

Something like:

on pressed left
-- player is facing right
> play turning animation
-- player is facing left
> player simulate pressing left


on turning animation finished
--player is facing right
> player set facing to left
-- else
> player set facing to right

should be a good start..

I like using this for registering keyboard input:



Thanks I will try this once I get home, so let me get this right:

Event:
On key pressed right
If not mirrorred > Set Animation Turn
Sub Event:
If Mirrored > Player simulates press Right

Event:
On Turning Animation Finished
If not mirrorred > Player Is mirrored
ELSE
????

Did I get the whole thing right? (except the last part I am not sure how to turn that into event since ELSE usually needs first a condition to trigger an action.
B
6
Posts: 14
Reputation: 278

Post » Wed Sep 16, 2015 1:06 pm

I'd rather not use the is mirrored and set an instance variable for the direction the player is facing, but yeah, that sounds about right..

The if not mirrored should be a sub-event so the else event would only react to the "if not mirrored" condition.
Else doesn't need another condition attached, just right click and select add "else"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 16, 2015 1:11 pm

LittleStain wrote:I'd rather not use the is mirrored and set an instance variable for the direction the player is facing, but yeah, that sounds about right..

The if not mirrored should be a sub-event so the else event would only react to the "if not mirrored" condition.
Else doesn't need another condition attached, just right click and select add "else"


I thought you could only do the flipped animation with mirror, are you saying there is another way of setting mirrored? (which is the only way I know how to tell if a sprite is facing left or right).
B
6
Posts: 14
Reputation: 278

Post » Wed Sep 16, 2015 1:20 pm

Black Rabbit wrote:
LittleStain wrote:I'd rather not use the is mirrored and set an instance variable for the direction the player is facing, but yeah, that sounds about right..

The if not mirrored should be a sub-event so the else event would only react to the "if not mirrored" condition.
Else doesn't need another condition attached, just right click and select add "else"


I thought you could only do the flipped animation with mirror, are you saying there is another way of setting mirrored? (which is the only way I know how to tell if a sprite is facing left or right).


Flipping the animation is done with "set mirrored"
That doesn't mean you can't have instance variables deciding over if the animation should be "set mirrored"
I prefer using instance variables for this for it makes my events much easier to read..
player.facing = "Left" VS. player is mirrored
It's a personal thing, I guess..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Sep 16, 2015 1:23 pm

LittleStain wrote:
Black Rabbit wrote:
LittleStain wrote:I'd rather not use the is mirrored and set an instance variable for the direction the player is facing, but yeah, that sounds about right..

The if not mirrored should be a sub-event so the else event would only react to the "if not mirrored" condition.
Else doesn't need another condition attached, just right click and select add "else"


I thought you could only do the flipped animation with mirror, are you saying there is another way of setting mirrored? (which is the only way I know how to tell if a sprite is facing left or right).


Flipping the animation is done with "set mirrored"
That doesn't mean you can't have instance variables deciding over if the animation should be "set mirrored"
I prefer using instance variables for this for it makes my events much easier to read..
player.facing = "Left" VS. player is mirrored
It's a personal thing, I guess..


Ah fair enough, I though there was another way to detected the facing of the character.

I am guessing you would set the variable "facing right" true when you mirror and false when you do not set mirror, so you can reference this true or false elsewhere. But is there a real advantage in creating an extra thing on top?
B
6
Posts: 14
Reputation: 278

Post » Wed Sep 16, 2015 1:34 pm

Black Rabbit wrote:
Ah fair enough, I though there was another way to detected the facing of the character.

I am guessing you would set the variable "facing right" true when you mirror and false when you do not set mirror, so you can reference this true or false elsewhere. But is there a real advantage in creating an extra thing on top?



I would use a text-variable and do it the other way around..

If facing is "left" set mirrored

There is no use for it other than to make things more easy to read and to help me as a programmer not having to think about mirrored/not mirrored and positive and negative values..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Yahoo [Bot] and 6 guests