0 Favourites

Set angle toward

  • 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 I�m 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?

  • 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!

  • actually I�m 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

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

    can it be done?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • Try something like this:

    Sprite: 8direction speed > 50

    --- Sprite: set angle to round(angle(0,0,Sprite.8Direction.VectorX,Sprite.8Direction.VectorY)/45)*45

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
88 9,245
goldentreee's avatar
goldentreee
Unread hot topic
56 4,736
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
41 1,467
KTML5's avatar
KTML5