setting rotation of actor when dragging

twinpixtwinpix Member Posts: 49
edited November -1 in Working with GS (Mac)
I've got an actor that's an arrow. I have behaviors set so when it is dragged, the arrow points in the direction that the user is dragging. Trouble is, when the user stops dragging the actor, the rotation of the arrow flips back to zero. I want it to stay pointing in the correct direction.

Can anyone please fix this code?

Custom Attributes: OldX, OldY, dragging

Timer: Every .25 seconds:
Change Attribute [self.OldX to self.Position.X]
Change Attribute [self.OldY to self.Position.Y]

When self.dragging is true:
Constrain Attribute [self.Rotation to vectorToAngle(game.Mouse.Position.X - self.OldX, game.Mouse.Position.Y - self.OldY) ]

Thanks in advance!

Comments

  • twinpixtwinpix Member Posts: 49
    Here's the sample on Gamesalad. Please download and see if you can fix the code.
    Thanks!

    http://gamesalad.com/game/play/84035
  • FreiGamesFreiGames Member Posts: 158
    We can't download the project :/
  • RHRH Member Posts: 1,079
    It stays pointing in the same direction for me...
  • twinpixtwinpix Member Posts: 49
    Okay, now it is downloadable.

    RH, I get this flashing of the arrow trying to set itself back to zero rotation sometimes. I'm hoping to change the code so it will remain steady. Any ideas?
  • RHRH Member Posts: 1,079
    Yeh, no, I get you now. I'll have a look quickly...

    I can get rid of the flickering but the arrow rotation isn't as responsive. I'm too ill to take actually change it so it works but to remove the flickering I'd remove the timer and change the method of changing old.X and old.Y
Sign In or Register to comment.