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.

Hp Bar On Map.

INTRODUCTION:

Hello community :D , I once again ask for help to all, I think that should not be something from another world what I am asking.
Today I am wondering how can I make my HP's main character is shown on the map in a Gradient bar above his head, the gradient bar should locate the folder PICTURE of your project and should also contain two files one to the bottom of the bar and another being the main bar.

EXAMPLES:

Screenshots:
http://img91.imageshack.us/img91/1464/sszh9.png[/IMG]
http://img91.imageshack.us/img91/6294/hpbarssev8.png[/IMG]
bar:
http://img91.imageshack.us/img91/2848/barlu4.png[/IMG]
back_bar:
http://img91.imageshack.us/img91/994/backbarku0.png[/IMG]

COMPATIBILITY(Opcional):

To be compatible with MACL 2.1 and SDK 2.3.

Now thank for help. ;)
 
Oh, Ok then. I'll try to find the part that draws the bar, and see if it works independently. Hold on

EDIT: Sorry, but I can't figure it out. Maybe someone else can try?
 
or do it via RGSS ^^:

Put this all in Scene_map. direct after the $gam_player.update in the def update section ( its in the loop function ):
Code:
$length = []
$length[0] = (($game_party.actors[0].hp.to_f * 100) / $game_party.actors[0].maxhp.to_f)
if $a == false and $bar_on == true
  $game_screen.pictures[1].show("BarBG", 0, $game_player.screen_x - 16, $game_player.screen_y - 52, 100, 100, 255, 0)
  $game_screen.pictures[2].show("Bar", 0, $game_player.screen_x - 16, $game_player.screen_y - 52, $length[0], 100, 255, 0)
$a = true
elsif $bar_on == true
  $game_screen.pictures[1].show("BarBG", 0, $game_player.screen_x - 16, $game_player.screen_y - 52, 100, 100, 255, 0)
  $game_screen.pictures[2].show("Bar", 0, $game_player.screen_x - 16, $game_player.screen_y - 52, $length[0], 100, 255, 0)
elsif $bar_on == false
  for i in 1..2
    $game_screen.pictures[i].erase
  end
  $a = false
end

Before you can start your Bar, you must rename your Bars Background ( the Black ) to "BarBG" and the Bar itself to "Bar"

To show the Bar use
$Bar_on = true

for not showing replace the "true" with "false"

thats all

Ps.: If you use a bigger Char than the RTP standards, you must replace the values after the Game_player.x and .y with bigger ones...
 

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