How do I make an actor impervious to gravity?

KamazarKamazar Member Posts: 287
edited November -1 in Working with GS (Mac)
I have an an actor that I want to follow my ship, but it can't do that considering it's stuck to the ground. How do I make gravity ineffective toward it?

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    give it an acceleration opposite to gravity and constrain its position as well.
  • KamazarKamazar Member Posts: 287
    But if it's position is constrained, I don't think it can follow the ship...? :/
  • MillerEPMillerEP Member Posts: 22
    You could have your ship have 2 "change attribute" features, one titled "ship X pos" and one for "Ship Y pos" and you can constrain that actor to those attributes, and have any offset thereof, using a little math.
  • KamazarKamazar Member Posts: 287
    With an offset, it would never ultimately reach the ship... hmmm, may get a tad complex, but say with a couple of scene attributes, I might be able to use the timer to take away from the offset in increments. Erm, but that make the the enemies impossible to avoid.

    I'll use the above idea for a different type of enemy. For now, I'll just give the actor a high acceleration, and a high friction so that it doesn't accelerate on the ground at mach 5. Thx, guys.
  • ktfrightktfright Member Posts: 964
    hope it works.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I just came up with something for another game that using offsets could work for this case too.

    Ship:
    --Constrain its position to game attributes. The usual GPS stuff.

    The Followers:
    --Timer: Every .01 sec
    ----Change Attribute: self.PositionX = self.PositionX + (game.ShipX-self.Position.X)/4
    ----Change Attribute: self.PositionY = self.PositionY + (game.ShipY-self.Position.Y)/4

    just tweak those constants as you see fit. I haven't tested with a lot of rules on other actors so it may or may not slow down. This is going into the wiki though.
Sign In or Register to comment.