How do I make a Health Bar follow my actor?

FungoEntertainmentFungoEntertainment Member Posts: 36
edited November -1 in Working with GS (Mac)
Basicly, I made a health bar and I want it to constantly be under my actor wherever the actor goes. Can someone please help?

Comments

  • BeyondtheTechBeyondtheTech Member Posts: 809
    Make the following real or integer Game Attributes:
    `Main Character X`
    `Main Character Y`

    In the Main Character Actor:
    `
    Constrain Attribute: game.Main Character X = self.Position.X
    Constrain Attribute: game.Main Character Y = self.Position.y
    `
    In the Health Bar Actor:
    `
    Constrain Attribute: self.Position.X = game.Main Character X
    Constrain Attribute: self.Position.Y = game.Main Character Y - 15
    `
    You can adjust the value 15 accordingly if it's too high or low below the character.
  • guru-at-zidwareguru-at-zidware Member Posts: 369
    what if the main actor is a circle, how would you do position? angle? so as the circle rotates it drags the other actor with it? Hmm...
  • BeyondtheTechBeyondtheTech Member Posts: 809
    It would follow the X and Y coordinate, but not the rotation. So, it would always be "underneath" the actor. If you want to rotate the bar around the actor as well, it would require you to create the health bar larger than the actor and pivot around the center of the actor.

    Then Constrain the Attribute of the Health Bar Rotation Angle to the Main Character's Rotation Angle.

    Here's a visual for you: http://www.flickr.com/photos/beyondthetech/4497242464/
Sign In or Register to comment.