Need Help With Hud Please

Started by G_G, May 12, 2009, 05:34:41 pm

Previous topic - Next topic

G_G

Ok so anyways I wanted to add another bar to the HUD. Its the actors Energy. I have the energy setup, when you attack it takes away some, skills and items etc even when you're running it takes away energy. Thats all setup now my only problem is actually adding a bar now.

The only time you get energy is restoring is when you're just walking.

Now I tried doing it but I failed miserably  :^_^':

Ok so I need help please just help me get started on doing it please?

Aqua

May 12, 2009, 05:41:33 pm #1 Last Edit: May 12, 2009, 05:43:19 pm by Elite Four Aqua
Post the HUD script you're using for the other stats.

Unless... you just want the HUD to be only the energy...
Then give dimensions and specifics on the layout.

G_G

First of all I deleted the script after it was a complete failure. But heres the method I have for drawing the energy

I just copied the draw_hp and replaced all the .hp with energy


def draw_energy
    # set current variables
    @energy, @maxenergy = actor.energy, actor.maxenergy
    # set fill rate
    rate = (@maxenergy > 0 ? @energy.to_f / @maxhp : 0)
    # draw gradient bar
    self.bitmap.gradient_bar_hud(@energy_x+32, @energy_y+3, 114, rate, 'hud_green_bar', 1)
    # set font color depending on how many HP left
    self.bitmap.font.color = @hp == 0 ? knockout_color :
        @energy <= @maxenergy / 4 ? crisis_color : normal_color
    # draw HP
    self.bitmap.draw_text_full(@energy_x+38, @energy_y, 48, 20, @energy.to_s, 2)
    # set color
    self.bitmap.font.color = normal_color
    # draw "/"
    self.bitmap.draw_text_full(@energy_x+86, @energy_y, 12, 20, '/', 1)
    # draw max HP
    self.bitmap.draw_text_full(@energy_x+98, @energy_y, 48, 20, @maxenergy.to_s)
  end


This is the new method I made I havent changed the x and y locations is all.

Aqua

I'm guessing this is Blizz-ABS Hud... since... you didn't say...

Anyway... did you make a new class when you tried or editted the Blizz-ABS's HUD class?

G_G

What I did was copy the class HUD < Sprite

and pasted it in a new slot below babs part 3. What I was able to do was change the height of the hud and the Outline draw for the bar but I couldnt get the bar to show.

Aqua

Line 5

rate = (@maxenergy > 0 ? @energy.to_f / @maxhp : 0)


Should be
rate = (@maxenergy > 0 ? @energy.to_f / @maxenergy : 0)


Mmm... if that doesn't work... then I dunno without having to open up RMXP XD

G_G

WEll if I only hadnt deleted that other script. Do you have to call the method in order for it to draw it? Pretty sure you do just not sure where.