About width of HP bar.

gawakamygawakamy Member Posts: 109
edited April 2012 in Working with GS (Mac)
Hi, GS dudes.
I made a monster's hp bar and made it decrese by 1 whenever the monster is attacked. But there are two problems.
First, the size of the bar is too big. Each mosnter has different hp, but the bar size must be same at first time.
Second, the moster's hp is decreased too quickly. I set up the hp is 15 and set up to decrease by 1 whenever it is hit. But the monster is dead when it is attacked only 3 times.

This is what I made as below. Monster's HP is set up as 15.

1. Monster
When the monster is attacked.
Interpolate.MonsterHP to game.MonsterHP-1 (Duration : 1, Function : Linear)
Attribute game.MonsterHP=0 -> Destroy

2. HP bar
HP width (Constrain Attribute)
self.size.width to game.MonsterHP*7

Answers

  • calvin9403calvin9403 Member Posts: 3,186
    I set up the hp is 15 and set up to decrease by 1 whenever it is hit. But the monster is dead when it is attacked only 3 times. that is weird, do you set the attribute to an global one or a self
  • gawakamygawakamy Member Posts: 109
    edited April 2012
    @calvin9403 Sorry, but I can not make sense what you mean exactly. How do I know if attribute is global or self?
  • calvin9403calvin9403 Member Posts: 3,186
    if you make the attribute on the main scene than it is a global, if it is from inside the actor is a self
  • gawakamygawakamy Member Posts: 109
    @calvin9403 Is it possible to make attribute inside the actor? I can not see any button to create attribute in there. I can see the attribut creatation button only on the main scene. Are there something what I don't know?
  • FrazzleFrazzle Member Posts: 223
    edited April 2012
    Don't use interpolate to take away, instead use change attribute.
    (MonsterHP to: MonsterHP-1)
    Even if this doesn't solve a problem, it's still better to use this method.
    FM.
Sign In or Register to comment.