Rotation flip based on sprite position.

GuardianGuardian Member Posts: 54
edited March 2012 in Working with GS (Mac)
Hi Guys,

I have created a sprite that looks at your mouse position, and have made a long level for the sprite to walk left and right in.

When I am on the left side of the level everything works as it should, but when I'm on the right the direction of the look gets flipped.

i.e. cursor is above and left of sprite, but sprite is looking top right.

Is a sprites rotation relative to it's position in the scene or something?

Crazy stuff,
Guardian

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    We really probably need to see screen shots of your rules to better help you. the actors rotation is just simply 360 degrees and that is not affected based on the scene position. You may have something over complex setup or it could be your original image does not face to the right to begin with.
  • GuardianGuardian Member Posts: 54
    ok, so I boiled it down to the basic issue.

    I put update loop in by adding a timer that is set to every 0.2 seconds.

    I then placed within it a 'change Attribute' and set self.rotation to equal vectorToAngle( self.position.X - game.Mouse.Position.X , self.position.Y - game.Mouse.Position.Y ).

    I put the actor of the left side of the screen and it follows the full range of rotation. I put it on the right side of the screen and limits it to within 170 to 200.

    This is really confusing me..

    -Guardian

  • GuardianGuardian Member Posts: 54
    Not sure what's up with the forum (my initial post has gone). So just to repeat in the mean time, I am trying to get an actor to rotate in the direction of the mouse cursor. However, it seems to not work to the right hand side of the level.
  • GuardianGuardian Member Posts: 54
    Any ideas?
Sign In or Register to comment.