How do I make my player turn

Get help using Construct 2

Post » Mon May 02, 2016 1:07 am

Hi,

My player has four direction using arrow keys. I noticed when he make a turn he curves around the turn.

How do I eliminate that?

Thank You.
B
24
S
4
Posts: 78
Reputation: 1,308

Post » Mon May 02, 2016 1:30 am

Set to 4 direction, not 8 direction.

I dunno if this is outdated or if there is a better way, but when I needed i used this tutorial: https://www.scirra.com/tutorials/791/4- ... -animation
B
9
S
3
G
1
Posts: 20
Reputation: 1,169

Post » Mon May 02, 2016 2:22 am

I think what he want is to set angle in the property movement of the behavior to No
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Mon May 02, 2016 4:45 am

Hi,

fernandokolbe..I look at the example and it is doing exactly what my player does.

Gearworkdragon ..I do have it to 4-direction and set angle to No.

The only way for my player to move properly is for him to come to a complete stop before he changes direction.

Any other suggestions?

Thank You.
B
24
S
4
Posts: 78
Reputation: 1,308

Post » Mon May 02, 2016 5:30 am

If that is what you want, perhaps you may wish to move the player without using behaviors. And use events instead.

For example,

if left key is hold : set player's x to player.x - 100*dt
else if right key is hold : set player's x to player.x + 100*dt
else if up key is hold : set player's y to player.y - 100*dt
else if down key is hold : set player's y to player.y + 100*dt

From these events, the player can only strictly move in one direction.

Is this Yes, No, ok?

EDIT: the above events will move the player in a very stiff fashion - not good aesthetics-wise for some games and perhaps your case.

You can remedy this by:

if left key is hold
if upAccelerate <= 0
if downAccelerate <= 0
if rightAccelerate <= 0:
> add 100*dt to leftAccelerate
> set player's x to player.x - leftAccelerate*dt
else
if right key is hold :
f upAccelerate <= 0
if downAccelerate <= 0
if leftAccelerate <= 0:
> add 100*dt to rightAccelerate
> set player's x to player.x + rightAccelerate*dt
...
...
do the above for up and down direction
...
...

every tick,
> subtract 50*dt to leftAccelerate
> subtract 50*dt to rightAccelerate
> subtract 50*dt to upAccelerate
> subtract 50*dt to downAccelerate


Is this what you want?
Last edited by TwinBlazar on Mon May 02, 2016 6:41 am, edited 1 time in total.
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,459

Post » Mon May 02, 2016 5:53 am

You are right keroberos it won't be a good approach to do what I want. I think I will stay with the original suggestion. Thank you everyone.
B
24
S
4
Posts: 78
Reputation: 1,308


Return to How do I....?

Who is online

Users browsing this forum: jasontoups and 1 guest