Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

if statement in window

few days ago i asked if someone could make a HUD for me, and razield did (thanks again =D)
so...the thing is that in my game, when my main character's HP is below half, the bar changes to "Critical" which is a completely diferent image.
i tried to do this:

@actor = $game_party.actors[0]
if @actor.hp < @actor.maxhp/2
@bitmap = RPG::Cache.picture("image2fu_danger")
else
@bitmap = RPG::Cache.picture("image2fu1")
self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height))
BTW...this is under refresh method

it works really good until i reach half HP, there's no error, but the HUD dissapears, and the other HUD image doesnt show up
what am i doing wrong?
 
The code should be:
Code:
@actor = $game_party.actors[0]
if @actor.hp < @actor.maxhp / 2
  @bitmap = RPG::Cache.picture("image2fu_danger")
else
  @bitmap = RPG::Cache.picture("image2fu1")
end
self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, @bitmap.width, @bitmap.height))
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top