Set angle toward

Get help using Construct 2

Post » Mon Jul 02, 2012 4:07 am

In the Ghost Shooter tutorial there is an event.

System every tick Player Set angle toward (Mouse.x,Mouse.y)

so the player will always face the mouse.


I want to edit this so instead of using the mouse you face the last place you move. But every time I release the keys it automatically faces up, down, left or right.

For example if Im moving down right and release, it should stop moving but keep facing down right. Instead it stops moving and faces right or down, not down right.

How I tell the game to set the angle toward the last angle you were facing?
B
4
Posts: 3
Reputation: 456

Post » Mon Jul 02, 2012 6:08 am

you want the player stop facing when the mouse release right??

so put a condition on the same event :
mouse left button clicked

so in this way everytime it will facing the mouse when the left button is clicked!
B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Tue Jul 03, 2012 2:19 am

actually Im not using the mouse at all

is like this, you move to the left using the arrow keys (the left one) then you release the key and you stop moving but keep facing that way

this works fine for up, down, left and right, but when I press 2 keys at once (up and left to move diagonally) once I release the keys it doesn't face up AND left instead it auto turns to face up OR left

here I hope I did this correctly and you can give it a try, is the same game I just deleted the set angle toward mouse.x mouse.y (since I'm not using the mouse)

oh and you shoot using the spacebar just in case you were wondering

http://dl.dropbox.com/u/39774845/Help/index.html

can it be done?
B
4
Posts: 3
Reputation: 456

Post » Tue Jul 03, 2012 4:45 am

i tried many ways but most of them i must move a long distance to change the angle , sorry i think someone else can help you
B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Tue Jul 03, 2012 6:29 am

Try something like this:
Sprite: 8direction speed > 50
--- Sprite: set angle to round(angle(0,0,Sprite.8Direction.VectorX,Sprite.8Direction.VectorY)/45)*45
B
79
S
24
G
52
Posts: 4,724
Reputation: 39,711

Post » Thu Jul 05, 2012 2:49 am

I was working on plan B just in case it can't be done, and it just hit me

why don't change 8direction behavior to car behavior?
and since a car doesn't turn while not moving
on right/left key down --- rotate clock/anticlock (so you can turn in place)

Well, problem solved I guess (at least for this proyect)
Thanks for the help and sorry didn't mean to waste your time, guess from now on I will work on plan B before asking for help so this doesn't happen again
B
4
Posts: 3
Reputation: 456


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], imnotspecial, tomi71, totoe, Yahoo [Bot] and 18 guests