use mouse to control actor

scitunesscitunes Member, Sous Chef Posts: 4,047
edited November -1 in Working with GS (Mac)
I am trying to control an actor by having the actor accelerate toward mouse.position.x

It only seems to start accelerating when I drag the mouse WAY over to the right or WAY over to the left (well off the 480x320 scree).

Anybody have any ideas about what I am doing wrong?

Comments

  • CobraCobra Member Posts: 160
    You could try a set of behaviors like this:

    Constrain Attribute [self.Motion.Linear Velocity.X] to [game.Mouse.Position.X - self.Position.X]
    Constrain Attribute [self.Motion.Linear Velocity.Y] to [game.Mouse.Position.Y - self.Position.Y]

    This causes the actor to always move toward the mouse, more quickly if the mouse is far away and more slowly if it's close.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    can't wait to try it. thanks!
Sign In or Register to comment.