Jump to content
Rpg²S Forum
  • 0

Barra Hp


7oni
 Share

Question

Ecco cosa ho fatto:

 

Chiamo da Scene_Map questa classe (mettendo i rispettivi update e dispose)

class Barra_Hp
 def update
@barrahp = Sprite.new
@barrahp.bitmap = RPG::Cache.picture("barrahp.png")
@barrahp.z = 97
@barrahp.x = 108
@barrahp.y = 42
refresh
 end
 def refresh
@barrahp.zoom_x = ($game_party.actors[0].hp+0.0)/$game_party.actors[0].maxhp
 end
 def dispose
@barrahp.dispose
 end
end

Il metodo dispose l'ho messo perché senza mi rimandava ad un errore al dispose della Scene_Map, comunque sia, non funziona: se chiamo il menù la barra resta sullo schermo.

 

Ma il problema è anche un altro. Allo scendere dei punti vita, la barra diminuisce si, ma prima di scendere trascorre troppo tempo, perché? (il pc è decentemente veloce xD)

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
se chiamo il menù la barra resta sullo schermo.

 

:nn: scusa no ma nella scene map quando si preme il pulsante B sarebbe esci l'hai messa la .dispose della figura :nn: mi sembra sia questo il problema.

 

Ma il problema è anche un altro. Allo scendere dei punti vita, la barra diminuisce si, ma prima di scendere trascorre troppo tempo, perché? (il pc è decentemente veloce xD)

 

:nn: questa nn l'ho capita come cavolo è possibile :ikari:

http://img255.imageshack.us/img255/3640/bannerpubbforumhy3.jpg

 

Conosco la metà di voi solo a metà e nutro per meno della metà di voi metà dell'affetto che meritate

http://img514.imageshack.us/img514/8091/alilarter125x200he9.jpghttp://img210.imageshack.us/img210/8009/hermione125x200ji9.jpghttp://img210.imageshack.us/img210/3761/angelina125x200copiapi1.jpghttp://img514.imageshack.us/img514/6415/jinnyweasley125x200wc9.jpghttp://img514.imageshack.us/img514/6542/alicia125x200kp1.jpg

 

http://img187.imageshack.us/img187/8117/cipollinocommossojr0.gif

Link to comment
Share on other sites

  • 0
Oltre alla barra hp c'è anche un'immagine che fa da contorno che ho messo direttamente dalla scene map. A questa ho messo i rispettivi update e dispose e funziona benissimo... :\
Link to comment
Share on other sites

  • 0
Ma il problema è anche un altro. Allo scendere dei punti vita, la barra diminuisce si, ma prima di scendere trascorre troppo tempo, perché? (il pc è decentemente veloce xD)

 

allora la update della barra dove l'hai messa? prova a metterla come prima voce degli update può darsi che è per quello...

 

Oltre alla barra hp c'è anche un'immagine che fa da contorno che ho messo direttamente dalla scene map. A questa ho messo i rispettivi update e dispose e funziona benissimo... :\

 

ah :| beh qua mi sa che devi aspettare un consiglio da gente che ne sa più di me :ikari:

http://img255.imageshack.us/img255/3640/bannerpubbforumhy3.jpg

 

Conosco la metà di voi solo a metà e nutro per meno della metà di voi metà dell'affetto che meritate

http://img514.imageshack.us/img514/8091/alilarter125x200he9.jpghttp://img210.imageshack.us/img210/8009/hermione125x200ji9.jpghttp://img210.imageshack.us/img210/3761/angelina125x200copiapi1.jpghttp://img514.imageshack.us/img514/6415/jinnyweasley125x200wc9.jpghttp://img514.imageshack.us/img514/6542/alicia125x200kp1.jpg

 

http://img187.imageshack.us/img187/8117/cipollinocommossojr0.gif

Link to comment
Share on other sites

  • 0

def barra_hp(x, y, actor)
bitmap = RPG::Cache.picture("Nome barra di contorno")
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x+37, y, bitmap, src_rect)
bitmap = RPG::Cache.picture("Nome barra HP")
x = actor.hp * numero corrispondente alla lunghezza in pxdell' imm / actor.maxhp
src_rect = Rect.new(0, 0, x, bitmap.height)
self.contents.blt(x + 40 - x, y + 2, bitmap, src_rect)
 end

 

[ricordati da modificare le x perchè varia a seconda della lunghezza della barra

 

metti questo in Window base

 

poi crei una Wundow dove richiami questo e la window la richiami nella scene map

 

e metti il refresh

 

nn è comodissimo ma funziona ;)

 

http://www.rpg2s.net/gif/SloganContest1.gif

 

Proggetto in corso:

ARCANIA

ANNULLATO

 

http://pokejungle.net/other/pokepet/Arcanine.gif

 

http://img517.imageshack.us/img517/1229/9452ni4.jpg

- - -

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...