Frash Posted June 9, 2011 Share Posted June 9, 2011 Salve a tutti mi potreste dare una mano?Vorrei che il gioco mi mostrasse solo la barra degli hp e degli sp ma mi da errore all'ultima riga qualcuno sa risolvere? #==============================================================================# ** Game_Actor# Script by MeisMe# Graphics added by Peaches# Icons made by Joshie666 & Axerax#------------------------------------------------------------------------------# This class handles the actor. It's used within the Game_Actors class# ($game_actors) and refers to the Game_Party class ($game_party).#==============================================================================class Game_Actor#==============================================================================# ** Window_HUD#------------------------------------------------------------------------------# This class is used to display HP, SP and Gold on the map.#==============================================================================class Window_HUD < Window_Base#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initializesuper(-16, -16, 672, 150)self.contents = Bitmap.new(width-32, height-32)self.opacity = 0self.contents.font.size = 14self.contents.font.name = "Arial"@actors = []@old_hp = []@old_sp = []#for i in 0...$game_party.actors.sizei = 0@actors.push($game_party.actors[i])@old_hp.push(@actors[i].hp)@old_sp.push(@actors[i].sp)#endrefreshend#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refreshself.contents.clearself.contents.font.color = system_color#self.contents.draw_text(6, 0, 32, 14, $data_system.words.hp + "")#self.contents.draw_text(6, 14, 32, 14, $data_system.words.sp + "")self.contents.draw_text(6, 28, 32, 14, "")#self.contents.draw_text(6, 42, 32, 14, $data_system.words.gold + "")self.contents.font.color = normal_color#Images case @actors.sizewhen 1bitmap = RPG::Cache.picture("HUD Graphic")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))when 2bitmap = RPG::Cache.picture("HUD Graphic2")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))when 3bitmap = RPG::Cache.picture("HUD Graphic2")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))when 4bitmap = RPG::Cache.picture("HUD Graphic3")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))when 5bitmap = RPG::Cache.picture("HUD Graphic3")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))end #bitmap = RPG::Cache.picture("HUD Graphic")#self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))bitmap = RPG::Cache.icon("HP Symbol")self.contents.blt(3, 10, bitmap, Rect.new(0, 0, 24, 24))bitmap = RPG::Cache.icon("SP Symbol")self.contents.blt(3, 30, bitmap, Rect.new(0, 0, 24, 24)) if $game_switches[99] == trueif $game_variables[99] == 0self.contents.draw_text(x, y, 210, 14, $game_party.item_number[1])elsif $game_variables[8] == 1self.contents.draw_text(x, y, 210, 14, $game_party.item_number(2))elsif $game_variables[8] ==2self.contents.draw_text(x, y, 110, 14, @actors[i].name)endendx = 32for i in 0...@actors.sizey = 6self.contents.draw_text(x, y, 110, 14, @actors[i].name)self.contents.draw_text(x, y, 110, 14, "Lv: #{@actors[i].level}", 2)y += 16draw_hp_bar(@actors[i], x, y, 112, 5)y += 19draw_sp_bar(@actors[i], x, y, 104, 5)y += 19endx = 32self.contents.draw_text(45, 73, 110, 14, $game_party.gold.to_s)end#--------------------------------------------------------------------------# * Frame Update#--------------------------------------------------------------------------def updatesuperif @actors.size != 1@actors = []for i in 0...$game_party.actors.size@actors.push($game_party.actors[i])endrefreshreturnendfor i in 0...@actors.sizeif @old_hp[i] != @actors[i].hp or@old_sp[i] != @actors[i].sp orrefresh@old_hp[i] = @actors[i].hp@old_sp[i] = @actors[i].spendendend#--------------------------------------------------------------------------# * Draw HP Bar#--------------------------------------------------------------------------def draw_hp_bar(actor, x, y, length, thick)width = lengthheight = thickc1 = Color.new(255, 0, 0)c2 = Color.new(155, 0, 0)e1 = actor.hpe2 = actor.maxhpself.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))w = width * e1 / e2for i in 0..heightr = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/heightg = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/heightb = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/heighta = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/heightself.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))endend#--------------------------------------------------------------------------# * Draw SP Bar#--------------------------------------------------------------------------def draw_sp_bar(actor, x, y, length, thick)width = lengthheight = thickc1 = Color.new(0, 0, 255)c2 = Color.new(0, 0, 155)e1 = actor.spe2 = actor.maxspself.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255))self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0))w = width * e1 / e2for i in 0..heightr = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/heightg = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/heightb = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/heighta = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/heightself.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))endend#==============================================================================# ** Scene_Map#------------------------------------------------------------------------------# This class performs map screen processing.#==============================================================================class Scene_Map#--------------------------------------------------------------------------# * Object Aliasing#--------------------------------------------------------------------------alias hud_scene_map_main mainalias hud_scene_map_update update#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def main@HUD = Window_HUD.newhud_scene_map_main@HUD.disposeend#--------------------------------------------------------------------------# * Frame Update#--------------------------------------------------------------------------def update@HUD.updatehud_scene_map_updateend Link to comment Share on other sites More sharing options...
0 Darknight Posted June 9, 2011 Share Posted June 9, 2011 (edited) Ti manda un end alla fine (c'è quello del "def" ma non quello della classe)Non solo alla fine ma anche dopo il draw_sp_bar Edited June 9, 2011 by Darknight http://nextage.altervista.org/scanlations/bannermp.jpg http://nextage.altervista.org/scanlations/banner.jpgCreazioni su DeviantArt http://nextage.altervista.org/_altervista_ht/two-beavers.jpghttp://img850.imageshack.us/img850/7051/mrfruffolo.png MRFRUFFOLOBATUFFOLOSO FOREVER! Link to comment Share on other sites More sharing options...
0 Frash Posted June 9, 2011 Author Share Posted June 9, 2011 (edited) Ne ho messi altri due e va ma ora mi dice errore alla riga 171 Errore:undefined method "main" for class "Game_actor ect ect Edited June 9, 2011 by Username Link to comment Share on other sites More sharing options...
0 Darknight Posted June 9, 2011 Share Posted June 9, 2011 Allora, l'impaginazione mi ha fatto fare un po' di casini (non si capiva quale end mancasse) #============================================================================== # ** Game_Actor # Script by MeisMe # Graphics added by Peaches # Icons made by Joshie666 & Axerax #------------------------------------------------------------------------------ # This class handles the actor. It's used within the Game_Actors class # ($game_actors) and refers to the Game_Party class ($game_party). #============================================================================== #============================================================================== # ** Window_HUD #------------------------------------------------------------------------------ # This class is used to display HP, SP and Gold on the map. #============================================================================== class Window_HUD < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(-16, -16, 672, 150) self.contents = Bitmap.new(width-32, height-32) self.opacity = 0 self.contents.font.size = 14 self.contents.font.name = "Arial" @actors = [] @old_hp = [] @old_sp = [] #for i in 0...$game_party.actors.size i = 0 @actors.push($game_party.actors[i]) @old_hp.push(@actors[i].hp) @old_sp.push(@actors[i].sp) #end refresh end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = system_color #self.contents.draw_text(6, 0, 32, 14, $data_system.words.hp + "") #self.contents.draw_text(6, 14, 32, 14, $data_system.words.sp + "") self.contents.draw_text(6, 28, 32, 14, "") #self.contents.draw_text(6, 42, 32, 14, $data_system.words.gold + "") self.contents.font.color = normal_color #Images case @actors.size when 1 bitmap = RPG::Cache.picture("HUD Graphic") self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500)) when 2 bitmap = RPG::Cache.picture("HUD Graphic2") self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500)) when 3 bitmap = RPG::Cache.picture("HUD Graphic2") self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500)) when 4 bitmap = RPG::Cache.picture("HUD Graphic3") self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500)) when 5 bitmap = RPG::Cache.picture("HUD Graphic3") self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500)) end #bitmap = RPG::Cache.picture("HUD Graphic") #self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500)) bitmap = RPG::Cache.icon("HP Symbol") self.contents.blt(3, 10, bitmap, Rect.new(0, 0, 24, 24)) bitmap = RPG::Cache.icon("SP Symbol") self.contents.blt(3, 30, bitmap, Rect.new(0, 0, 24, 24)) if $game_switches[99] == true if $game_variables[99] == 0 self.contents.draw_text(x, y, 210, 14, $game_party.item_number[1]) elsif $game_variables[8] == 1 self.contents.draw_text(x, y, 210, 14, $game_party.item_number(2)) elsif $game_variables[8] ==2 self.contents.draw_text(x, y, 110, 14, @actors[i].name) end end x = 32 for i in 0...@actors.size y = 6 self.contents.draw_text(x, y, 110, 14, @actors[i].name) self.contents.draw_text(x, y, 110, 14, "Lv: #{@actors[i].level}", 2) y += 16 draw_hp_bar(@actors[i], x, y, 112, 5) y += 19 draw_sp_bar(@actors[i], x, y, 104, 5) y += 19 end x = 32 self.contents.draw_text(45, 73, 110, 14, $game_party.gold.to_s) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super if @actors.size != 1 @actors = [] for i in 0...$game_party.actors.size @actors.push($game_party.actors[i]) end refresh return end for i in 0...@actors.size if @old_hp[i] != @actors[i].hp or @old_sp[i] != @actors[i].sp or refresh @old_hp[i] = @actors[i].hp @old_sp[i] = @actors[i].sp end end end #-------------------------------------------------------------------------- # * Draw HP Bar #-------------------------------------------------------------------------- def draw_hp_bar(actor, x, y, length, thick) width = length height = thick c1 = Color.new(255, 0, 0) c2 = Color.new(155, 0, 0) e1 = actor.hp e2 = actor.maxhp self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255)) self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255)) w = width * e1 / e2 for i in 0..height r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a)) end end #-------------------------------------------------------------------------- # * Draw SP Bar #-------------------------------------------------------------------------- def draw_sp_bar(actor, x, y, length, thick) width = length height = thick c1 = Color.new(0, 0, 255) c2 = Color.new(0, 0, 155) e1 = actor.sp e2 = actor.maxsp self.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255)) self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0)) w = width * e1 / e2 for i in 0..height r = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/height g = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/height b = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/height a = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/height self.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a)) end end end #============================================================================== # ** Scene_Map #------------------------------------------------------------------------------ # This class performs map screen processing. #============================================================================== class Scene_Map #-------------------------------------------------------------------------- # * Object Aliasing #-------------------------------------------------------------------------- alias hud_scene_map_main main alias hud_scene_map_update update #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def main @HUD = Window_HUD.new hud_scene_map_main @HUD.dispose end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update @HUD.update hud_scene_map_update end end Cosi funziona (a me manca l'immagine e crasha per quello ma niente più syntax error)Il problema sono gli end.Non ho capito perchè volessi mettere la classe della windows dentro quella del GameActor (non ti serve e credo che poi ti darebbe errore quando scrivi Window_HUD.new).Era qualche end che si perdeva.Posso darti un suggerimento? Non so se lo script l'hai fatto tu o copiato da qualche forum (o hai messo insieme un po' di codice da vari script) ma l'editor di testo del ruby è abbastanza intelligente (si perde solo nel caso dei "when" nei "case").... se tu vai a fine riga e premi invio ti mette per la riga successiva l'indentazione giusta.In altre parole, premi fine su una riga, premi invio e poi canc in modo da allineare il testo (per i vari end li risistema se premi invio a fine riga)... così ti aiuta ad indentare e a trovare gli end che mancano. http://nextage.altervista.org/scanlations/bannermp.jpg http://nextage.altervista.org/scanlations/banner.jpgCreazioni su DeviantArt http://nextage.altervista.org/_altervista_ht/two-beavers.jpghttp://img850.imageshack.us/img850/7051/mrfruffolo.png MRFRUFFOLOBATUFFOLOSO FOREVER! Link to comment Share on other sites More sharing options...
0 Frash Posted June 9, 2011 Author Share Posted June 9, 2011 Ok va alla perfezione solo che ha ancora scritto 0 soldi o exp non lo so come lo elimino? Link to comment Share on other sites More sharing options...
0 Darknight Posted June 9, 2011 Share Posted June 9, 2011 (edited) Ragazzi scusate il doppio post, ma quando cercavo di editarlo mi cancellava tutto il contenuto (sia con modifica completa che con modifica veloce)... forse c'è troppo testo?!? Comunque, volevo correggere una cosa: nell'editor vai a fine riga, premi canc in modo che la riga successiva salga al livello di quella corrente (fregatene degli spazi) poi premi invio (gli spazi all'inizio della riga te li elimina lui).Così l'indentazione è pressoche perfetta.Attenzione solo che i when li tratta come testo normale e la riga subito sotto la indenta di nuovo - quindi ti ritrovi tutti i when su indentazione diversa e poi ti sbaglia quella di tutte le righe sotto... per quelli devi correggerli tu a mano. EDIT: per i soldi riga 95self.contents.draw_text(45, 73, 110, 14, $game_party.gold.to_s)commentala con il # all'inizio della riga.L'esperienza da me non c'è O_o Edited June 9, 2011 by Darknight http://nextage.altervista.org/scanlations/bannermp.jpg http://nextage.altervista.org/scanlations/banner.jpgCreazioni su DeviantArt http://nextage.altervista.org/_altervista_ht/two-beavers.jpghttp://img850.imageshack.us/img850/7051/mrfruffolo.png MRFRUFFOLOBATUFFOLOSO FOREVER! Link to comment Share on other sites More sharing options...
0 Frash Posted June 9, 2011 Author Share Posted June 9, 2011 (edited) Dark scusa ancora ma dove si trovano i settaggi per spostare le barre?Io non li trovo. Edited June 9, 2011 by Username Link to comment Share on other sites More sharing options...
0 Guardian of Irael Posted June 9, 2011 Share Posted June 9, 2011 @Username: occhio che se chiedi consiglio su script la sezione giusta è supporto RGSS e non supporto e basta! Sposto!^ ^ (\_/)(^ ^) <----coniglietto rosso, me! (> <) Il mio Tumblr dove seguire i miei progetti, i progetti della Reverie : : Project ^ ^ http://i.imgur.com/KdUDtQt.png disponibile su Google Play, qui i dettagli! ^ ^ http://i.imgur.com/FwnGMI3.png completo! Giocabile online, qui i dettagli! ^ ^ REVERIE : : RENDEZVOUS (In allenamento per apprendere le buone arti prima di cominciarlo per bene ^ ^) Trovate i dettagli qui insieme alla mia intervista (non utilizzerò più rpgmaker) ^ ^ 🖤http://www.rpg2s.net/dax_games/r2s_regali2s.png E:3 http://www.rpg2s.net/dax_games/xmas/gifnatale123.gifhttp://i.imgur.com/FfvHCGG.png by Testament (notare dettaglio in basso a destra)! E:3http://i.imgur.com/MpaUphY.jpg by Idriu E:3Membro Onorario, Ambasciatore dei Coniglietti (Membro n.44) http://i.imgur.com/PgUqHPm.pngUfficiale"Ad opera della sua onestà e del suo completo appoggio alla causa dei Panda, Guardian Of Irael viene ufficialmente considerato un Membro portante del Partito, e Ambasciatore del suo Popolo presso di noi"http://i.imgur.com/TbRr4iS.png<- Grazie Testament E:3Ricorda...se rivolgi il tuo sguardo ^ ^ a Guardian anche Guardian volge il suo sguardo ^ ^ a te ^ ^http://i.imgur.com/u8UJ4Vm.gifby Flame ^ ^http://i.imgur.com/VbggEKS.gifhttp://i.imgur.com/2tJmjFJ.gifhttp://projectste.altervista.org/Our_Hero_adotta/ado2.pngGrazie Testament XD Fan n°1 ufficiale di PQ! :DVivail Rhaxen! <- Folletto te lo avevo detto (fa pure rima) che nonavevo programmi di grafica per fare un banner su questo pc XD (ora ho dinuovo il mio PC veramente :D) Rosso Guardiano dellahttp://i.imgur.com/Os5rvhx.pngRpg2s RPG BY FORUM:Nome: Darth Reveal PV totali 2PA totali 16Descrizione: ragazzo dai lunghi capelli rossi ed occhi dello stesso colore. Indossa una elegante giacca rossa sopra ad una maglietta nera. Porta pantaloni rossi larghi, una cintura nera e degli stivali dello stesso colore. E' solito trasportare lo spadone dietro la schiena in un fodero apposito. Ha un pendente al collo e tiene ben legato un pezzo di stoffa (che gli sta particolarmente a cuore) intorno al braccio sinistro sotto la giacca, copre una cicatrice.Bozze vesti non definitive qui.Equipaggiamento:Indossa:60$ e 59$ divisi in due tasche interneLevaitanSpada a due mani elsa lungaGuanti del Defender (2PA)Anello del linguaggio animale (diventato del Richiamo)Scrinieri da lanciere (2 PA)Elmo del Leone (5 PA)Corazza del Leone in Ferro Corrazzato (7 PA) ZAINO (20) contenente:Portamonete in pelle di cinghiale contenente: 100$Scatola Sanitaria Sigillata (può contenere e tenere al sicuro fino a 4 oggetti curativi) (contiene Benda di pronto soccorso x3, Pozione di cura)CordaBottiglia di idromeleForma di formaggioTorcia (serve ad illuminare, dura tre settori)Fiasca di ceramica con Giglio Amaro (Dona +1PN e Velocità all'utilizzatore)Ampolla BiancaSemi di Balissa CAVALLO NORMALE + SELLA (30 +2 armi) contentente:66$Benda di pronto soccorso x3Spada a due maniFagotto per Adara (fazzoletto ricamato) Link to comment Share on other sites More sharing options...
0 Darknight Posted June 9, 2011 Share Posted June 9, 2011 Dark scusa ancora ma dove si trovano i settaggi per spostare le barre?Io non li trovo.Dalla riga 75 alla 83 trovi il punto in cui scrive informazioni su alcuni oggetti (se imposti le variabili 99 e 8, quindi attenzione a non riempirle dagli eventi - altrimenti elimina quelle righe).Dalla riga 84 alla 94 invece è la parte in cui scrive il resto.In teoria esiste un parametro x, che assegna alla riga 84 (x = 32) e stranamente non lo incrementa mai (quindi le info dei vari personaggi si sovrascrivono O_o)Aggiungi ad x un valore (visto che lui usa come larghezza al max 112 potrebbe andare bene una 115) for i in 0...@actors.size y = 6 self.contents.draw_text(x, y, 110, 14, @actors[i].name) self.contents.draw_text(x, y, 110, 14, "Lv: #{@actors[i].level}", 2) y += 16 draw_hp_bar(@actors[i], x, y, 112, 5) y += 19 draw_sp_bar(@actors[i], x, y, 104, 5) x += 115 end Ho tolto dopo l'ultimo y += 19 dopo draw_sp_bar(@actors, x, y, 104, 5) perchè era inutile. Ho notato che riga 28 e 33 sono commentate quindi mostra solo il primo personaggio, decommentandole te li mostra tutti. Se invece vuoi gestire un solo personaggio spostarlo imposta la x alla riga 84 con il valore che vuoi. http://nextage.altervista.org/scanlations/bannermp.jpg http://nextage.altervista.org/scanlations/banner.jpgCreazioni su DeviantArt http://nextage.altervista.org/_altervista_ht/two-beavers.jpghttp://img850.imageshack.us/img850/7051/mrfruffolo.png MRFRUFFOLOBATUFFOLOSO FOREVER! Link to comment Share on other sites More sharing options...
0 Frash Posted June 9, 2011 Author Share Posted June 9, 2011 Grazie Guardian grazie dark ho finito. Link to comment Share on other sites More sharing options...
Question
Frash
Salve a tutti mi potreste dare una mano?
Vorrei che il gioco mi mostrasse solo la barra degli hp e degli sp ma mi da errore all'ultima riga qualcuno sa risolvere?
#==============================================================================# ** Game_Actor# Script by MeisMe# Graphics added by Peaches# Icons made by Joshie666 & Axerax#------------------------------------------------------------------------------# This class handles the actor. It's used within the Game_Actors class# ($game_actors) and refers to the Game_Party class ($game_party).#==============================================================================class Game_Actor#==============================================================================# ** Window_HUD#------------------------------------------------------------------------------# This class is used to display HP, SP and Gold on the map.#==============================================================================class Window_HUD < Window_Base#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initializesuper(-16, -16, 672, 150)self.contents = Bitmap.new(width-32, height-32)self.opacity = 0self.contents.font.size = 14self.contents.font.name = "Arial"@actors = []@old_hp = []@old_sp = []#for i in 0...$game_party.actors.sizei = 0@actors.push($game_party.actors[i])@old_hp.push(@actors[i].hp)@old_sp.push(@actors[i].sp)#endrefreshend#--------------------------------------------------------------------------# * Refresh#--------------------------------------------------------------------------def refreshself.contents.clearself.contents.font.color = system_color#self.contents.draw_text(6, 0, 32, 14, $data_system.words.hp + "")#self.contents.draw_text(6, 14, 32, 14, $data_system.words.sp + "")self.contents.draw_text(6, 28, 32, 14, "")#self.contents.draw_text(6, 42, 32, 14, $data_system.words.gold + "")self.contents.font.color = normal_color#Images case @actors.sizewhen 1bitmap = RPG::Cache.picture("HUD Graphic")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))when 2bitmap = RPG::Cache.picture("HUD Graphic2")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))when 3bitmap = RPG::Cache.picture("HUD Graphic2")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))when 4bitmap = RPG::Cache.picture("HUD Graphic3")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))when 5bitmap = RPG::Cache.picture("HUD Graphic3")self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 640, 500))end #bitmap = RPG::Cache.picture("HUD Graphic")#self.contents.blt(0, 0, bitmap, Rect.new(0, 10, 500, 500))bitmap = RPG::Cache.icon("HP Symbol")self.contents.blt(3, 10, bitmap, Rect.new(0, 0, 24, 24))bitmap = RPG::Cache.icon("SP Symbol")self.contents.blt(3, 30, bitmap, Rect.new(0, 0, 24, 24)) if $game_switches[99] == trueif $game_variables[99] == 0self.contents.draw_text(x, y, 210, 14, $game_party.item_number[1])elsif $game_variables[8] == 1self.contents.draw_text(x, y, 210, 14, $game_party.item_number(2))elsif $game_variables[8] ==2self.contents.draw_text(x, y, 110, 14, @actors[i].name)endendx = 32for i in 0...@actors.sizey = 6self.contents.draw_text(x, y, 110, 14, @actors[i].name)self.contents.draw_text(x, y, 110, 14, "Lv: #{@actors[i].level}", 2)y += 16draw_hp_bar(@actors[i], x, y, 112, 5)y += 19draw_sp_bar(@actors[i], x, y, 104, 5)y += 19endx = 32self.contents.draw_text(45, 73, 110, 14, $game_party.gold.to_s)end#--------------------------------------------------------------------------# * Frame Update#--------------------------------------------------------------------------def updatesuperif @actors.size != 1@actors = []for i in 0...$game_party.actors.size@actors.push($game_party.actors[i])endrefreshreturnendfor i in 0...@actors.sizeif @old_hp[i] != @actors[i].hp or@old_sp[i] != @actors[i].sp orrefresh@old_hp[i] = @actors[i].hp@old_sp[i] = @actors[i].spendendend#--------------------------------------------------------------------------# * Draw HP Bar#--------------------------------------------------------------------------def draw_hp_bar(actor, x, y, length, thick)width = lengthheight = thickc1 = Color.new(255, 0, 0)c2 = Color.new(155, 0, 0)e1 = actor.hpe2 = actor.maxhpself.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255, 255))self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0, 255))w = width * e1 / e2for i in 0..heightr = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/heightg = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/heightb = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/heighta = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/heightself.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))endend#--------------------------------------------------------------------------# * Draw SP Bar#--------------------------------------------------------------------------def draw_sp_bar(actor, x, y, length, thick)width = lengthheight = thickc1 = Color.new(0, 0, 255)c2 = Color.new(0, 0, 155)e1 = actor.spe2 = actor.maxspself.contents.fill_rect(x-1, y - 1, width+2, height + 3, Color.new(255, 255, 255))self.contents.fill_rect(x, y, width, height + 1, Color.new(0, 0, 0))w = width * e1 / e2for i in 0..heightr = c1.red + (c2.red - c1.red) * (height -i)/height + 0 * i/heightg = c1.green + (c2.green - c1.green) * (height -i)/height + 0 * i/heightb = c1.blue + (c2.blue - c1.blue) * (height -i)/height + 0 * i/heighta = c1.alpha + (c2.alpha - c1.alpha)* (height -i)/height + 255 * i/heightself.contents.fill_rect(x, y+i, w, 1, Color.new(r, g, b, a))endend#==============================================================================# ** Scene_Map#------------------------------------------------------------------------------# This class performs map screen processing.#==============================================================================class Scene_Map#--------------------------------------------------------------------------# * Object Aliasing#--------------------------------------------------------------------------alias hud_scene_map_main mainalias hud_scene_map_update update#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def main@HUD = Window_HUD.newhud_scene_map_main@HUD.disposeend#--------------------------------------------------------------------------# * Frame Update#--------------------------------------------------------------------------def update@HUD.updatehud_scene_map_updateendLink to comment
Share on other sites
9 answers to this question
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now