riprendendo in mano il mio vechio progetto "Alysia", mi sono accorto di un piccolo problema che vorrei sottoporre all'attenzione di voi esperti di script (io sono una frana ).
Per il mio menu, sto utilizzando un antico script proveniente dal vecchio RpgShrine. L'aspetto della schermata è il seguente:
Ora, il problema: è possibile fare in modo che le scritte HP e MP diventino trasparenti, ovvero che non si vedano? Infatti esse si vanno a posizionare in modo molto antiestetico direttamente SULLE facce dei personaggi...
Posto qui sotto il codice, che va aggiunto tradizionalmente sopra Main. Qualcuno sa suggerirmi quali parti dovrei modificare?
Grazie a tutti!
#===========================================================
# - Window_Base
#------------------------------------------------------------------------------
# E' la superclasse di tutte le finestre nel gioco
#===============================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
# x : Coordinate X della finestra
# y : Coordinate Y della finestra
# width : Larhezza della finestra
# height : Altezza della finestra
#--------------------------------------------------------------------------
def initialize(x, y, width, height)
super()
@windowskin_name = $game_system.windowskin_name
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
end
#--------------------------------------------------------------------------
# - Rilascia
#--------------------------------------------------------------------------
def dispose
# Verrà rilasciato se il bitmap dei contenuti di una finestra
# viene sistemato
if self.contents != nil
self.contents.dispose
end
super
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere
# n : Numero del colore del carattere (0~7)
#--------------------------------------------------------------------------
def text_color(n)
case n
when 0
return Color.new(255, 255, 255, 255)
when 1
return Color.new(128, 128, 255, 255)
when 2
return Color.new(255, 128, 128, 255)
when 3
return Color.new(128, 255, 128, 255)
when 4
return Color.new(128, 255, 255, 255)
when 5
return Color.new(255, 128, 255, 255)
when 6
return Color.new(255, 255, 128, 255)
when 7
return Color.new(192, 192, 192, 255)
else
normal_color
end
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere: Generale
#--------------------------------------------------------------------------
def normal_color
return Color.new(255, 255, 255, 255)
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere: Invalidità
#--------------------------------------------------------------------------
def disabled_color
return Color.new(255, 255, 255, 128)
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere: Sistema
#--------------------------------------------------------------------------
def system_color
return Color.new(192, 224, 255, 255)
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere: Criticità
#--------------------------------------------------------------------------
def crisis_color
return Color.new(255, 255, 64, 255)
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere: Impossibilità
#--------------------------------------------------------------------------
def knockout_color
return Color.new(255, 64, 0)
end
#---------------------------------------------------------
# Text Outline Color
#-------------------------------------------------------------------
def outline_color
return Color.new(0, 0, 0) #Per modificare il colore del bordo cambiate i numeri
end
#--------------------------------------------------------------------------
# - Acquisizione del colore del carattere: Sistema
#--------------------------------------------------------------------------
def system_color2
return Color.new(0, 39, 79, 255)
end
#--------------------------------------------------------------------------
# - Aggiornamento frame
#--------------------------------------------------------------------------
def update
super
# Viene risistemato quando l'interfaccia grafica(skin) di una finestra
# viene cambiato
if $game_system.windowskin_name != @windowskin_name
@windowskin_name = $game_system.windowskin_name
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.windowskin = RPG::Cache.windowskin(@windowskin_name)
end
end
#--------------------------------------------------------------------------
# - Disegna la grafica
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# - Disegna il nome
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
#--------------------------------------------------------------------------
def draw_actor_name(actor, x, y)
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = normal_color
self.contents.font.color = outline_color
self.contents.draw_text(x-1, y-1, 120, 32, actor.name)
self.contents.draw_text(x-1, y+1, 120, 32, actor.name)
self.contents.draw_text(x+1, y+1, 120, 32, actor.name)
self.contents.draw_text(x+1, y-1, 120, 32, actor.name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 120, 32, actor.name)
end
#--------------------------------------------------------------------------
# - Disegna la classe
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
#--------------------------------------------------------------------------
def draw_actor_class(actor, x, y)
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = normal_color
self.contents.font.color = outline_color
self.contents.draw_text(x-1, y-1, 120, 32, actor.class_name)
self.contents.draw_text(x-1, y+1, 120, 32, actor.class_name)
self.contents.draw_text(x+1, y+1, 120, 32, actor.class_name)
self.contents.draw_text(x+1, y-1, 120, 32, actor.class_name)
self.contents.font.color = normal_color
self.contents.draw_text(x, y, 236, 32, actor.class_name)
end
#--------------------------------------------------------------------------
# - Disegna il livello
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
#--------------------------------------------------------------------------
def draw_actor_level(actor, x, y)
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = system_color2
self.contents.draw_text(x-1, y-1, 32, 32, "LV")
self.contents.draw_text(x-1, y+1, 32, 32, "LV")
self.contents.draw_text(x+1, y+1, 32, 32, "LV")
self.contents.draw_text(x+1, y-1, 32, 32, "LV")
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "LV")
self.contents.font.color = outline_color
self.contents.draw_text(32 + x-1, y-1, 24, 32, actor.level.to_s, 2)
self.contents.draw_text(32 + x-1, y+1, 24, 32, actor.level.to_s, 2)
self.contents.draw_text(32 + x+1, y+1, 24, 32, actor.level.to_s, 2)
self.contents.draw_text(32 + x+1, y-1, 24, 32, actor.level.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# - Creazione della sequenza dello stato del personaggio per il disegno
# actor : Personaggio
# width : Ampiezza del disegno
# need_normal : [Normale] E' richiesto o no? (Vero / Falso)
#--------------------------------------------------------------------------
def make_battler_state_text(battler, width, need_normal)
# Viene acquisita l'ampiezza di una parentesi
brackets_width = self.contents.text_size("[]").width
# Viene creata la sequanza del carattere del nome dello stato
text = ""
for i in battler.states
if $data_states[i].rating >= 1
if text == ""
text = $data_states[i].name
else
new_text = text + "/" + $data_states[i].name
text_width = self.contents.text_size(new_text).width
if text_width > width - brackets_width
break
end
text = new_text
end
end
end
# Quando la sequanza del carattere del nome dello stato è vuota,
# allora diviene "[Normale]"
if text == ""
if need_normal
text = "[Normale]"
end
else
# Viene allegata una parentesi
text = "[" + text + "]"
end
# Torna alla sequenza completata dei caratteri
return text
end
#--------------------------------------------------------------------------
# - Disegna lo stato
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
# width : Ampiezza del disegno
#--------------------------------------------------------------------------
def draw_actor_state(actor, x, y, width = 120)
text = make_battler_state_text(actor, width, true)
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(x-1, y-1, width, 32, text)
self.contents.draw_text(x-1, y+1, width, 32, text)
self.contents.draw_text(x+1, y+1, width, 32, text)
self.contents.draw_text(x+1, y-1, width, 32, text)
self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
self.contents.draw_text(x, y, width, 32, text)
end
#--------------------------------------------------------------------------
# - Disegna i punti EXP
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
#--------------------------------------------------------------------------
def draw_actor_exp(actor, x, y)
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = system_color
self.contents.font.color = system_color2
self.contents.draw_text(x-1, y-1, 40, 32, "EXP")
self.contents.draw_text(x-1, y+1, 40, 32, "EXP")
self.contents.draw_text(x+1, y+1, 40, 32, "EXP")
self.contents.draw_text(x+1, y-1, 40, 32, "EXP")
self.contents.font.color = system_color
self.contents.draw_text(x, y, 40, 32, "EXP")
self.contents.font.color = normal_color
self.contents.font.color = outline_color
self.contents.draw_text(10 + x-1, y-1, 84, 32, actor.exp_s, 2)
self.contents.draw_text(10 +x-1, y+1, 84, 32, actor.exp_s, 2)
self.contents.draw_text(10 +x+1, y+1, 84, 32, actor.exp_s, 2)
self.contents.draw_text(10 +x+1, y-1, 84, 32, actor.exp_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 10, y, 84, 32, actor.exp_s, 2)
self.contents.font.color = outline_color
self.contents.draw_text(124 + x-1, y-1, 12, 32, "/", 1)
self.contents.draw_text(124 +x-1, y+1, 12, 32, "/", 1)
self.contents.draw_text(124 +x+1, y+1, 12, 32, "/", 1)
self.contents.draw_text(124 +x+1, y-1, 12, 32, "/", 1)
self.contents.font.color = normal_color
self.contents.draw_text(x + 124, y, 12, 32, "/", 1)
self.contents.font.color = outline_color
self.contents.draw_text(136 + x-1, y-1, 84, 32, actor.next_exp_s)
self.contents.draw_text(136 +x-1, y+1, 84, 32, actor.next_exp_s)
self.contents.draw_text(136 +x+1, y+1, 84, 32, actor.next_exp_s)
self.contents.draw_text(136 +x+1, y-1, 84, 32, actor.next_exp_s)
self.contents.font.color = normal_color
self.contents.draw_text(x + 136, y, 84, 32, actor.next_exp_s)
end
#--------------------------------------------------------------------------
# - Disegna i punti HP
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
# width : Ampiezza del disegno
#--------------------------------------------------------------------------
def draw_actor_hp(actor, x, y, width = 144)
# Disegna la sequenza dei caratteri: "HP"
self.contents.font.color = system_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = system_color2
self.contents.draw_text(x-1, y-1, 32, 32, $data_system.words.hp)
self.contents.draw_text(x-1, y+1, 32, 32, $data_system.words.hp)
self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.hp)
self.contents.draw_text(x+1, y-1, 32, 32, $data_system.words.hp)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
# Calcola se c'è qualche spazio che disegna i punti MaxHp
if width - 32 >= 108
hp_x = x + width - 108
flag = true
elsif width - 32 >= 48
hp_x = x + width - 48
flag = false
end
# Disegna i punti HP
self.contents.font.color = actor.hp == 0 ? knockout_color :
actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(hp_x - 1, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.draw_text(hp_x - 1, y + 1, 48, 32, actor.hp.to_s, 2)
self.contents.draw_text(hp_x + 1, y + 1, 48, 32, actor.hp.to_s, 2)
self.contents.draw_text(hp_x + 1, y - 1, 48, 32, actor.hp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
# Disegna i punti MaxHP
if flag
self.contents.font.color = normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(hp_x + 48 - 1, y - 1, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 48 + 1, y + 1, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 48 - 1, y + 1, 12, 32, "/", 1)
self.contents.draw_text(hp_x + 48 + 1, y - 1, 12, 32, "/", 1)
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
self.contents.font.color = outline_color
self.contents.draw_text(hp_x + 60 - 1, y - 1, 48, 32, actor.maxhp.to_s)
self.contents.draw_text(hp_x + 60 - 1, y + 1, 48, 32, actor.maxhp.to_s)
self.contents.draw_text(hp_x + 60 + 1, y - 1, 48, 32, actor.maxhp.to_s)
self.contents.draw_text(hp_x + 60 + 1, y + 1, 48, 32, actor.maxhp.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s)
end
end
#--------------------------------------------------------------------------
# - Disegna i punti MP
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
# width : Ampiezza del disegno
#--------------------------------------------------------------------------
def draw_actor_sp(actor, x, y, width = 144)
# Disegna la sequenza dei caratteri: "MP"
self.contents.font.color = system_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = system_color2
self.contents.draw_text(x-1, y-1, 32, 32, $data_system.words.sp)
self.contents.draw_text(x-1, y+1, 32, 32, $data_system.words.sp)
self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.sp)
self.contents.draw_text(x+1, y-1, 32, 32, $data_system.words.sp)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
# Calcola se c'è qualche spazio che disegna i punti MaxMp
if width - 32 >= 108
sp_x = x + width - 108
flag = true
elsif width - 32 >= 48
sp_x = x + width - 48
flag = false
end
# Disegna i punti MP
self.contents.font.color = actor.sp == 0 ? knockout_color :
actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(sp_x - 1, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.draw_text(sp_x - 1, y + 1, 48, 32, actor.sp.to_s, 2)
self.contents.draw_text(sp_x + 1, y + 1, 48, 32, actor.sp.to_s, 2)
self.contents.draw_text(sp_x + 1, y - 1, 48, 32, actor.sp.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
# Disegna i punti MaxMP
if flag
self.contents.font.color = normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(sp_x + 48 - 1, y - 1, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 48 + 1, y + 1, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 48 - 1, y + 1, 12, 32, "/", 1)
self.contents.draw_text(sp_x + 48 + 1, y - 1, 12, 32, "/", 1)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
self.contents.font.color = outline_color
self.contents.draw_text(sp_x + 60 - 1, y - 1, 48, 32, actor.maxsp.to_s)
self.contents.draw_text(sp_x + 60 - 1, y + 1, 48, 32, actor.maxsp.to_s)
self.contents.draw_text(sp_x + 60 + 1, y - 1, 48, 32, actor.maxsp.to_s)
self.contents.draw_text(sp_x + 60 + 1, y + 1, 48, 32, actor.maxsp.to_s)
self.contents.font.color = normal_color
self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s)
end
end
#--------------------------------------------------------------------------
# - Disegna un parametro
# actor : Personaggio
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
# type : Tipo di parametro (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = system_color2
self.contents.draw_text(x-1, y-1, 120, 32, parameter_name)
self.contents.draw_text(x-1, y+1, 120, 32, parameter_name)
self.contents.draw_text(x+1, y+1, 120, 32, parameter_name)
self.contents.draw_text(x+1, y-1, 120, 32, parameter_name)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(120 + x-1, y-1, 36, 32, parameter_value.to_s, 2)
self.contents.draw_text(120 + x-1, y+1, 36, 32, parameter_value.to_s, 2)
self.contents.draw_text(120 + x+1, y+1, 36, 32, parameter_value.to_s, 2)
self.contents.draw_text(120 + x+1, y-1, 36, 32, parameter_value.to_s, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# - Disegna il nome di un oggetto
# item : Oggetto
# x : Posizione del disegno: Coordinate X
# y : Posizione del disegno: Coordinate Y
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.font.name = "Arial"
self.contents.font.size = 24
self.contents.font.color = outline_color
self.contents.draw_text(28 + x-1, y-1, 212, 32, item.name)
self.contents.draw_text(28 + x-1, y+1, 212, 32, item.name)
self.contents.draw_text(28 + x+1, y+1, 212, 32, item.name)
self.contents.draw_text(28 + x+1, y-1, 212, 32, item.name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
end
#========================================
#■ Window_Base
#--------------------------------------------------------------------------
# Setting functions for the "Base"
#========================================
class Window_Base < Window
def draw_actor_A(actor, x, y, opacity)
face = RPG::Cache.character("Bat1/" + actor.character_name, actor.character_hue)
fw = face.width
fh = face.height
src_rect = Rect.new(0, 0, fw, fh)
self.contents.blt(x - fw / 23, y - fh, face, src_rect)
end
end
def draw_actor_battler_graphic(actor, x, y)
bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#===============================================================
# - Window_MenuStatus
#------------------------------------------------------------------------------
# E' la finestra che mostra lo stato di un membro del gruppo nella
# schermata di menù
#===============================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 390)
self.contents = Bitmap.new(width - 32, height - 32)
@column_max = 4
bw = 155 * @column_max
bh = 364
refresh
self.active = false
self.index = -1
self.cursor_rect.set(-200, 0, 155, 364)
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 24
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i % @column_max * 155
y = i / @column_max * 364
actor = $game_party.actors[i]
draw_actor_A(actor, x - 50, y + 520, opacity - 100)
draw_actor_graphic(actor, x + 120, y + 45)
draw_actor_name(actor, x + 3, y)
draw_actor_class(actor, x +3, y + 20)
draw_actor_level(actor, x + 3, y + 60)
draw_actor_state(actor, x +3, y + 40)
self.contents.font.color = outline_color
self.contents.draw_text(3 + x-1, 80 + y-1, 140, 32, "Exp.")
self.contents.draw_text(3 + x-1, 80 + y+1, 140, 32, "Exp.")
self.contents.draw_text(3 + x+1, 80 + y+1, 140, 32, "Exp.")
self.contents.draw_text(3 + x+1, 80 + y-1, 140, 32, "Exp.")
self.contents.font.color = system_color
self.contents.draw_text(x +3, y + 80, 140, 32, "Exp.")
# 経験値が負になった場合はNextをハイフンにする
if actor.next_exp_s.to_i - actor.exp < 0
nextexp = "--------"
else
nextexp = (actor.next_exp_s.to_i - actor.exp).to_s
end
self.contents.font.color = outline_color
self.contents.draw_text(24 + x-1, 80 + y-1, 100, 32, nextexp, 2)
self.contents.draw_text(24 + x-1, 80 + y+1, 100, 32, nextexp, 2)
self.contents.draw_text(24 + x+1, 80 + y+1, 100, 32, nextexp, 2)
self.contents.draw_text(24 + x+1, 80 + y-1, 100, 32, nextexp, 2)
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y + 80, 100, 32, nextexp, 2)
draw_actor_hp(actor, x +3, y + 185)
draw_actor_sp(actor, x +3, y + 205)
end
end
#--------------------------------------------------------------------------
# - Aggiornamento del rettangolo del cursore
#--------------------------------------------------------------------------
def update_cursor_rect
oldIndex = self.cursor_rect.x
# カーソル位置が 0 未満の場合
if @index < 0
self.cursor_rect.empty
return
end
# カーソルの幅を計算
cursor_width = 150
# カーソルの座標を計算
x = @index % @column_max * 155
y = @index / @column_max * 45 - self.oy
# カーソルの矩形を更新
self.cursor_rect.set(x, y, cursor_width, 45)
self.oy = @index / @column_max * 45
if oldIndex != self.cursor_rect.x
refresh
end
end
end
#===============================================================
# - Window_Gold
#------------------------------------------------------------------------------
# E' la finestra che mostra le monete
#===============================================================
class Window_GoldSteps < Window_Base
#--------------------------------------------------------------------------
# - Inizializzazione dell'oggetto
#--------------------------------------------------------------------------
def initialize
super(0, 0, 309, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.name = "Arial"
self.contents.font.size = 24
cx = contents.text_size($data_system.words.gold).width
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
self.contents.font.color = system_color
self.contents.draw_text(0, 32, 120, 32, "Passi")
self.contents.font.color = normal_color
self.contents.draw_text(20, 32, 120, 32, $game_party.steps.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(160, 0, 120, 32, "Tempo:")
@total_sec = Graphics.frame_count / Graphics.frame_rate
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(160 - 20, 32, 120, 32, text, 2)
end
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#=====================
# ■ Window_MenuCommand
#------------------------------------------------------------------------------
# メニュー用のコマンド選択を行うウィンドウです。
#=====================
class Window_MenuCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# commands : コマンド文字列の配列
#--------------------------------------------------------------------------
def initialize(commands)
#=====================
# コマンドの個数からウィンドウの高さを算出
super(0, 0, 330, (commands.size / 3 + 1) * 32)
@column_max = 3
@item_max = commands.size
@commands = commands
self.contents = Bitmap.new(width - 32, (@item_max / @column_max + 1) * 32)
self.contents.font.name = "Arial"
self.contents.font.size = 24
refresh
self.index = 0
# & #9733;=============
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
# & #9733;============
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
# & #9733;===============================================
self.contents.font.color = color
rect = Rect.new(index % @column_max * 110, index / @column_max * 32, 80, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
# & #9733;=============================================
end
#--------------------------------------------------------------------------
# ● 項目の無効化
# index : 項目番号
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end
#===============================================================
# - Scene_Menu
#------------------------------------------------------------------------------
# Scena del menu
#===============================================================
class Scene_Menu
#--------------------------------------------------------------------------
# - Inizializzazione Oggetto
# menu_index : Indice della voce selezionata
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# - Processo Principale
#--------------------------------------------------------------------------
def main
# Settaggio delle stringhe
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Salva"
s6 = "Esci"
@command_window = Window_MenuCommand.new([s1, s2, s3, s4, s5, s6])
@command_window.index = @menu_index
@command_window.z = 5
@command_window.x = 0
@command_window.y = 375
# Quando non ci sono eroi
if $game_party.actors.size == 0
# Disabilita i primi 4 comandi
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# Quando il salvataggio è disabilitato
if $game_system.save_disabled
# Disabilita il salvataggio
@command_window.disable_item(4)
end
# Creazione finestra del tempo di gioco
# @playtime_window = Window_PlayTime.new
# @playtime_window.x = 0
# @playtime_window.y = 380
# @playtime_window.z = 4
@stepsgold_window = Window_GoldSteps.new
@stepsgold_window.x = 320
@stepsgold_window.y = 380
# Creazione finestra dei passi
#@steps_window = Window_Steps.new
#@steps_window.x = 0
#@steps_window.y = 320
# Creazione finestra del denaro
#@gold_window = Window_Gold.new
#@gold_window.x = 0
#@gold_window.y = 416
# Creazione finestra dello status
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 0
@status_window.z = 3
# Fade
Graphics.transition
# Loop Principale
loop do
# Aggiornamento Grafica
Graphics.update
# Aggiornamento Input
Input.update
# Aggiornamento Frame
update
# Quando cambia la scena blocca il loop
if $scene != self
break
end
end
# Preparazione Fade
Graphics.freeze
# Eliminazione Finestre
@command_window.dispose
@stepsgold_window.dispose
# @steps_window.dispose
# @gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# - Aggiornamento
#--------------------------------------------------------------------------
def update
# Aggiorna le finestre
@command_window.update
@stepsgold_window.update
# @gold_window.update
@status_window.update
# Quando è attiva la finestra dei comandi esegui update_command
if @command_window.active
update_command
return
end
Question
Zosimos
Salve a tutti,
riprendendo in mano il mio vechio progetto "Alysia", mi sono accorto di un piccolo problema che vorrei sottoporre all'attenzione di voi esperti di script (io sono una frana
).
Per il mio menu, sto utilizzando un antico script proveniente dal vecchio RpgShrine. L'aspetto della schermata è il seguente:
http://xs323.xs.to/xs323/08021/provamenu.JPG.xs.jpg
Ora, il problema: è possibile fare in modo che le scritte HP e MP diventino trasparenti, ovvero che non si vedano? Infatti esse si vanno a posizionare in modo molto antiestetico direttamente SULLE facce dei personaggi...
Posto qui sotto il codice, che va aggiunto tradizionalmente sopra Main. Qualcuno sa suggerirmi quali parti dovrei modificare?
Grazie a tutti!
#=========================================================== # - Window_Base #------------------------------------------------------------------------------ # E' la superclasse di tutte le finestre nel gioco #=============================================================== class Window_Base < Window #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto # x : Coordinate X della finestra # y : Coordinate Y della finestra # width : Larhezza della finestra # height : Altezza della finestra #-------------------------------------------------------------------------- def initialize(x, y, width, height) super() @windowskin_name = $game_system.windowskin_name self.windowskin = RPG::Cache.windowskin(@windowskin_name) self.x = x self.y = y self.width = width self.height = height self.z = 100 end #-------------------------------------------------------------------------- # - Rilascia #-------------------------------------------------------------------------- def dispose # Verrà rilasciato se il bitmap dei contenuti di una finestra # viene sistemato if self.contents != nil self.contents.dispose end super end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere # n : Numero del colore del carattere (0~7) #-------------------------------------------------------------------------- def text_color(n) case n when 0 return Color.new(255, 255, 255, 255) when 1 return Color.new(128, 128, 255, 255) when 2 return Color.new(255, 128, 128, 255) when 3 return Color.new(128, 255, 128, 255) when 4 return Color.new(128, 255, 255, 255) when 5 return Color.new(255, 128, 255, 255) when 6 return Color.new(255, 255, 128, 255) when 7 return Color.new(192, 192, 192, 255) else normal_color end end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere: Generale #-------------------------------------------------------------------------- def normal_color return Color.new(255, 255, 255, 255) end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere: Invalidità #-------------------------------------------------------------------------- def disabled_color return Color.new(255, 255, 255, 128) end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere: Sistema #-------------------------------------------------------------------------- def system_color return Color.new(192, 224, 255, 255) end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere: Criticità #-------------------------------------------------------------------------- def crisis_color return Color.new(255, 255, 64, 255) end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere: Impossibilità #-------------------------------------------------------------------------- def knockout_color return Color.new(255, 64, 0) end #--------------------------------------------------------- # Text Outline Color #------------------------------------------------------------------- def outline_color return Color.new(0, 0, 0) #Per modificare il colore del bordo cambiate i numeri end #-------------------------------------------------------------------------- # - Acquisizione del colore del carattere: Sistema #-------------------------------------------------------------------------- def system_color2 return Color.new(0, 39, 79, 255) end #-------------------------------------------------------------------------- # - Aggiornamento frame #-------------------------------------------------------------------------- def update super # Viene risistemato quando l'interfaccia grafica(skin) di una finestra # viene cambiato if $game_system.windowskin_name != @windowskin_name @windowskin_name = $game_system.windowskin_name self.contents.font.name = "Arial" self.contents.font.size = 24 self.windowskin = RPG::Cache.windowskin(@windowskin_name) end end #-------------------------------------------------------------------------- # - Disegna la grafica # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y #-------------------------------------------------------------------------- def draw_actor_graphic(actor, x, y) bitmap = RPG::Cache.character(actor.character_name, actor.character_hue) cw = bitmap.width / 4 ch = bitmap.height / 4 src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end #-------------------------------------------------------------------------- # - Disegna il nome # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y #-------------------------------------------------------------------------- def draw_actor_name(actor, x, y) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = normal_color self.contents.font.color = outline_color self.contents.draw_text(x-1, y-1, 120, 32, actor.name) self.contents.draw_text(x-1, y+1, 120, 32, actor.name) self.contents.draw_text(x+1, y+1, 120, 32, actor.name) self.contents.draw_text(x+1, y-1, 120, 32, actor.name) self.contents.font.color = normal_color self.contents.draw_text(x, y, 120, 32, actor.name) end #-------------------------------------------------------------------------- # - Disegna la classe # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y #-------------------------------------------------------------------------- def draw_actor_class(actor, x, y) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = normal_color self.contents.font.color = outline_color self.contents.draw_text(x-1, y-1, 120, 32, actor.class_name) self.contents.draw_text(x-1, y+1, 120, 32, actor.class_name) self.contents.draw_text(x+1, y+1, 120, 32, actor.class_name) self.contents.draw_text(x+1, y-1, 120, 32, actor.class_name) self.contents.font.color = normal_color self.contents.draw_text(x, y, 236, 32, actor.class_name) end #-------------------------------------------------------------------------- # - Disegna il livello # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y #-------------------------------------------------------------------------- def draw_actor_level(actor, x, y) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = system_color2 self.contents.draw_text(x-1, y-1, 32, 32, "LV") self.contents.draw_text(x-1, y+1, 32, 32, "LV") self.contents.draw_text(x+1, y+1, 32, 32, "LV") self.contents.draw_text(x+1, y-1, 32, 32, "LV") self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, "LV") self.contents.font.color = outline_color self.contents.draw_text(32 + x-1, y-1, 24, 32, actor.level.to_s, 2) self.contents.draw_text(32 + x-1, y+1, 24, 32, actor.level.to_s, 2) self.contents.draw_text(32 + x+1, y+1, 24, 32, actor.level.to_s, 2) self.contents.draw_text(32 + x+1, y-1, 24, 32, actor.level.to_s, 2) self.contents.font.color = normal_color self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2) end #-------------------------------------------------------------------------- # - Creazione della sequenza dello stato del personaggio per il disegno # actor : Personaggio # width : Ampiezza del disegno # need_normal : [Normale] E' richiesto o no? (Vero / Falso) #-------------------------------------------------------------------------- def make_battler_state_text(battler, width, need_normal) # Viene acquisita l'ampiezza di una parentesi brackets_width = self.contents.text_size("[]").width # Viene creata la sequanza del carattere del nome dello stato text = "" for i in battler.states if $data_states[i].rating >= 1 if text == "" text = $data_states[i].name else new_text = text + "/" + $data_states[i].name text_width = self.contents.text_size(new_text).width if text_width > width - brackets_width break end text = new_text end end end # Quando la sequanza del carattere del nome dello stato è vuota, # allora diviene "[Normale]" if text == "" if need_normal text = "[Normale]" end else # Viene allegata una parentesi text = "[" + text + "]" end # Torna alla sequenza completata dei caratteri return text end #-------------------------------------------------------------------------- # - Disegna lo stato # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y # width : Ampiezza del disegno #-------------------------------------------------------------------------- def draw_actor_state(actor, x, y, width = 120) text = make_battler_state_text(actor, width, true) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(x-1, y-1, width, 32, text) self.contents.draw_text(x-1, y+1, width, 32, text) self.contents.draw_text(x+1, y+1, width, 32, text) self.contents.draw_text(x+1, y-1, width, 32, text) self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color self.contents.draw_text(x, y, width, 32, text) end #-------------------------------------------------------------------------- # - Disegna i punti EXP # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y #-------------------------------------------------------------------------- def draw_actor_exp(actor, x, y) self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = system_color self.contents.font.color = system_color2 self.contents.draw_text(x-1, y-1, 40, 32, "EXP") self.contents.draw_text(x-1, y+1, 40, 32, "EXP") self.contents.draw_text(x+1, y+1, 40, 32, "EXP") self.contents.draw_text(x+1, y-1, 40, 32, "EXP") self.contents.font.color = system_color self.contents.draw_text(x, y, 40, 32, "EXP") self.contents.font.color = normal_color self.contents.font.color = outline_color self.contents.draw_text(10 + x-1, y-1, 84, 32, actor.exp_s, 2) self.contents.draw_text(10 +x-1, y+1, 84, 32, actor.exp_s, 2) self.contents.draw_text(10 +x+1, y+1, 84, 32, actor.exp_s, 2) self.contents.draw_text(10 +x+1, y-1, 84, 32, actor.exp_s, 2) self.contents.font.color = normal_color self.contents.draw_text(x + 10, y, 84, 32, actor.exp_s, 2) self.contents.font.color = outline_color self.contents.draw_text(124 + x-1, y-1, 12, 32, "/", 1) self.contents.draw_text(124 +x-1, y+1, 12, 32, "/", 1) self.contents.draw_text(124 +x+1, y+1, 12, 32, "/", 1) self.contents.draw_text(124 +x+1, y-1, 12, 32, "/", 1) self.contents.font.color = normal_color self.contents.draw_text(x + 124, y, 12, 32, "/", 1) self.contents.font.color = outline_color self.contents.draw_text(136 + x-1, y-1, 84, 32, actor.next_exp_s) self.contents.draw_text(136 +x-1, y+1, 84, 32, actor.next_exp_s) self.contents.draw_text(136 +x+1, y+1, 84, 32, actor.next_exp_s) self.contents.draw_text(136 +x+1, y-1, 84, 32, actor.next_exp_s) self.contents.font.color = normal_color self.contents.draw_text(x + 136, y, 84, 32, actor.next_exp_s) end #-------------------------------------------------------------------------- # - Disegna i punti HP # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y # width : Ampiezza del disegno #-------------------------------------------------------------------------- def draw_actor_hp(actor, x, y, width = 144) # Disegna la sequenza dei caratteri: "HP" self.contents.font.color = system_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = system_color2 self.contents.draw_text(x-1, y-1, 32, 32, $data_system.words.hp) self.contents.draw_text(x-1, y+1, 32, 32, $data_system.words.hp) self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.hp) self.contents.draw_text(x+1, y-1, 32, 32, $data_system.words.hp) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.hp) # Calcola se c'è qualche spazio che disegna i punti MaxHp if width - 32 >= 108 hp_x = x + width - 108 flag = true elsif width - 32 >= 48 hp_x = x + width - 48 flag = false end # Disegna i punti HP self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(hp_x - 1, y - 1, 48, 32, actor.hp.to_s, 2) self.contents.draw_text(hp_x - 1, y + 1, 48, 32, actor.hp.to_s, 2) self.contents.draw_text(hp_x + 1, y + 1, 48, 32, actor.hp.to_s, 2) self.contents.draw_text(hp_x + 1, y - 1, 48, 32, actor.hp.to_s, 2) self.contents.font.color = normal_color self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2) # Disegna i punti MaxHP if flag self.contents.font.color = normal_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(hp_x + 48 - 1, y - 1, 12, 32, "/", 1) self.contents.draw_text(hp_x + 48 + 1, y + 1, 12, 32, "/", 1) self.contents.draw_text(hp_x + 48 - 1, y + 1, 12, 32, "/", 1) self.contents.draw_text(hp_x + 48 + 1, y - 1, 12, 32, "/", 1) self.contents.font.color = normal_color self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1) self.contents.font.color = outline_color self.contents.draw_text(hp_x + 60 - 1, y - 1, 48, 32, actor.maxhp.to_s) self.contents.draw_text(hp_x + 60 - 1, y + 1, 48, 32, actor.maxhp.to_s) self.contents.draw_text(hp_x + 60 + 1, y - 1, 48, 32, actor.maxhp.to_s) self.contents.draw_text(hp_x + 60 + 1, y + 1, 48, 32, actor.maxhp.to_s) self.contents.font.color = normal_color self.contents.draw_text(hp_x + 60, y, 48, 32, actor.maxhp.to_s) end end #-------------------------------------------------------------------------- # - Disegna i punti MP # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y # width : Ampiezza del disegno #-------------------------------------------------------------------------- def draw_actor_sp(actor, x, y, width = 144) # Disegna la sequenza dei caratteri: "MP" self.contents.font.color = system_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = system_color2 self.contents.draw_text(x-1, y-1, 32, 32, $data_system.words.sp) self.contents.draw_text(x-1, y+1, 32, 32, $data_system.words.sp) self.contents.draw_text(x+1, y+1, 32, 32, $data_system.words.sp) self.contents.draw_text(x+1, y-1, 32, 32, $data_system.words.sp) self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.sp) # Calcola se c'è qualche spazio che disegna i punti MaxMp if width - 32 >= 108 sp_x = x + width - 108 flag = true elsif width - 32 >= 48 sp_x = x + width - 48 flag = false end # Disegna i punti MP self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(sp_x - 1, y - 1, 48, 32, actor.sp.to_s, 2) self.contents.draw_text(sp_x - 1, y + 1, 48, 32, actor.sp.to_s, 2) self.contents.draw_text(sp_x + 1, y + 1, 48, 32, actor.sp.to_s, 2) self.contents.draw_text(sp_x + 1, y - 1, 48, 32, actor.sp.to_s, 2) self.contents.font.color = normal_color self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2) # Disegna i punti MaxMP if flag self.contents.font.color = normal_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(sp_x + 48 - 1, y - 1, 12, 32, "/", 1) self.contents.draw_text(sp_x + 48 + 1, y + 1, 12, 32, "/", 1) self.contents.draw_text(sp_x + 48 - 1, y + 1, 12, 32, "/", 1) self.contents.draw_text(sp_x + 48 + 1, y - 1, 12, 32, "/", 1) self.contents.font.color = normal_color self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1) self.contents.font.color = outline_color self.contents.draw_text(sp_x + 60 - 1, y - 1, 48, 32, actor.maxsp.to_s) self.contents.draw_text(sp_x + 60 - 1, y + 1, 48, 32, actor.maxsp.to_s) self.contents.draw_text(sp_x + 60 + 1, y - 1, 48, 32, actor.maxsp.to_s) self.contents.draw_text(sp_x + 60 + 1, y + 1, 48, 32, actor.maxsp.to_s) self.contents.font.color = normal_color self.contents.draw_text(sp_x + 60, y, 48, 32, actor.maxsp.to_s) end end #-------------------------------------------------------------------------- # - Disegna un parametro # actor : Personaggio # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y # type : Tipo di parametro (0~6) #-------------------------------------------------------------------------- def draw_actor_parameter(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int end self.contents.font.color = system_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = system_color2 self.contents.draw_text(x-1, y-1, 120, 32, parameter_name) self.contents.draw_text(x-1, y+1, 120, 32, parameter_name) self.contents.draw_text(x+1, y+1, 120, 32, parameter_name) self.contents.draw_text(x+1, y-1, 120, 32, parameter_name) self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, parameter_name) self.contents.font.color = normal_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(120 + x-1, y-1, 36, 32, parameter_value.to_s, 2) self.contents.draw_text(120 + x-1, y+1, 36, 32, parameter_value.to_s, 2) self.contents.draw_text(120 + x+1, y+1, 36, 32, parameter_value.to_s, 2) self.contents.draw_text(120 + x+1, y-1, 36, 32, parameter_value.to_s, 2) self.contents.font.color = normal_color self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2) end #-------------------------------------------------------------------------- # - Disegna il nome di un oggetto # item : Oggetto # x : Posizione del disegno: Coordinate X # y : Posizione del disegno: Coordinate Y #-------------------------------------------------------------------------- def draw_item_name(item, x, y) if item == nil return end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.font.name = "Arial" self.contents.font.size = 24 self.contents.font.color = outline_color self.contents.draw_text(28 + x-1, y-1, 212, 32, item.name) self.contents.draw_text(28 + x-1, y+1, 212, 32, item.name) self.contents.draw_text(28 + x+1, y+1, 212, 32, item.name) self.contents.draw_text(28 + x+1, y-1, 212, 32, item.name) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name) end end #======================================== #■ Window_Base #-------------------------------------------------------------------------- # Setting functions for the "Base" #======================================== class Window_Base < Window def draw_actor_A(actor, x, y, opacity) face = RPG::Cache.character("Bat1/" + actor.character_name, actor.character_hue) fw = face.width fh = face.height src_rect = Rect.new(0, 0, fw, fh) self.contents.blt(x - fw / 23, y - fh, face, src_rect) end end def draw_actor_battler_graphic(actor, x, y) bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue) cw = bitmap.width ch = bitmap.height src_rect = Rect.new(0, 0, cw, ch) self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect) end #=============================================================== # - Window_MenuStatus #------------------------------------------------------------------------------ # E' la finestra che mostra lo stato di un membro del gruppo nella # schermata di menù #=============================================================== class Window_MenuStatus < Window_Selectable #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 390) self.contents = Bitmap.new(width - 32, height - 32) @column_max = 4 bw = 155 * @column_max bh = 364 refresh self.active = false self.index = -1 self.cursor_rect.set(-200, 0, 155, 364) end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.name = "Arial" self.contents.font.size = 24 @item_max = $game_party.actors.size for i in 0...$game_party.actors.size x = i % @column_max * 155 y = i / @column_max * 364 actor = $game_party.actors[i] draw_actor_A(actor, x - 50, y + 520, opacity - 100) draw_actor_graphic(actor, x + 120, y + 45) draw_actor_name(actor, x + 3, y) draw_actor_class(actor, x +3, y + 20) draw_actor_level(actor, x + 3, y + 60) draw_actor_state(actor, x +3, y + 40) self.contents.font.color = outline_color self.contents.draw_text(3 + x-1, 80 + y-1, 140, 32, "Exp.") self.contents.draw_text(3 + x-1, 80 + y+1, 140, 32, "Exp.") self.contents.draw_text(3 + x+1, 80 + y+1, 140, 32, "Exp.") self.contents.draw_text(3 + x+1, 80 + y-1, 140, 32, "Exp.") self.contents.font.color = system_color self.contents.draw_text(x +3, y + 80, 140, 32, "Exp.") # 経験値が負になった場合はNextをハイフンにする if actor.next_exp_s.to_i - actor.exp < 0 nextexp = "--------" else nextexp = (actor.next_exp_s.to_i - actor.exp).to_s end self.contents.font.color = outline_color self.contents.draw_text(24 + x-1, 80 + y-1, 100, 32, nextexp, 2) self.contents.draw_text(24 + x-1, 80 + y+1, 100, 32, nextexp, 2) self.contents.draw_text(24 + x+1, 80 + y+1, 100, 32, nextexp, 2) self.contents.draw_text(24 + x+1, 80 + y-1, 100, 32, nextexp, 2) self.contents.font.color = normal_color self.contents.draw_text(x + 24, y + 80, 100, 32, nextexp, 2) draw_actor_hp(actor, x +3, y + 185) draw_actor_sp(actor, x +3, y + 205) end end #-------------------------------------------------------------------------- # - Aggiornamento del rettangolo del cursore #-------------------------------------------------------------------------- def update_cursor_rect oldIndex = self.cursor_rect.x # カーソル位置が 0 未満の場合 if @index < 0 self.cursor_rect.empty return end # カーソルの幅を計算 cursor_width = 150 # カーソルの座標を計算 x = @index % @column_max * 155 y = @index / @column_max * 45 - self.oy # カーソルの矩形を更新 self.cursor_rect.set(x, y, cursor_width, 45) self.oy = @index / @column_max * 45 if oldIndex != self.cursor_rect.x refresh end end end #=============================================================== # - Window_Gold #------------------------------------------------------------------------------ # E' la finestra che mostra le monete #=============================================================== class Window_GoldSteps < Window_Base #-------------------------------------------------------------------------- # - Inizializzazione dell'oggetto #-------------------------------------------------------------------------- def initialize super(0, 0, 309, 96) self.contents = Bitmap.new(width - 32, height - 32) refresh end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.name = "Arial" self.contents.font.size = 24 cx = contents.text_size($data_system.words.gold).width self.contents.font.color = normal_color self.contents.draw_text(0, 0, 120-cx-2, 32, $game_party.gold.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2) self.contents.font.color = system_color self.contents.draw_text(0, 32, 120, 32, "Passi") self.contents.font.color = normal_color self.contents.draw_text(20, 32, 120, 32, $game_party.steps.to_s, 2) self.contents.font.color = system_color self.contents.draw_text(160, 0, 120, 32, "Tempo:") @total_sec = Graphics.frame_count / Graphics.frame_rate hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 text = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(160 - 20, 32, 120, 32, text, 2) end def update super if Graphics.frame_count / Graphics.frame_rate != @total_sec refresh end end end #===================== # ■ Window_MenuCommand #------------------------------------------------------------------------------ # メニュー用のコマンド選択を行うウィンドウです。 #===================== class Window_MenuCommand < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 # commands : コマンド文字列の配列 #-------------------------------------------------------------------------- def initialize(commands) #===================== # コマンドの個数からウィンドウの高さを算出 super(0, 0, 330, (commands.size / 3 + 1) * 32) @column_max = 3 @item_max = commands.size @commands = commands self.contents = Bitmap.new(width - 32, (@item_max / @column_max + 1) * 32) self.contents.font.name = "Arial" self.contents.font.size = 24 refresh self.index = 0 # & #9733;============= end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh # & #9733;============ self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 # color : 文字色 #-------------------------------------------------------------------------- def draw_item(index, color) # & #9733;=============================================== self.contents.font.color = color rect = Rect.new(index % @column_max * 110, index / @column_max * 32, 80, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], 1) # & #9733;============================================= end #-------------------------------------------------------------------------- # ● 項目の無効化 # index : 項目番号 #-------------------------------------------------------------------------- def disable_item(index) draw_item(index, disabled_color) end end #=============================================================== # - Scene_Menu #------------------------------------------------------------------------------ # Scena del menu #=============================================================== class Scene_Menu #-------------------------------------------------------------------------- # - Inizializzazione Oggetto # menu_index : Indice della voce selezionata #-------------------------------------------------------------------------- def initialize(menu_index = 0) @menu_index = menu_index end #-------------------------------------------------------------------------- # - Processo Principale #-------------------------------------------------------------------------- def main # Settaggio delle stringhe s1 = $data_system.words.item s2 = $data_system.words.skill s3 = $data_system.words.equip s4 = "Status" s5 = "Salva" s6 = "Esci" @command_window = Window_MenuCommand.new([s1, s2, s3, s4, s5, s6]) @command_window.index = @menu_index @command_window.z = 5 @command_window.x = 0 @command_window.y = 375 # Quando non ci sono eroi if $game_party.actors.size == 0 # Disabilita i primi 4 comandi @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) end # Quando il salvataggio è disabilitato if $game_system.save_disabled # Disabilita il salvataggio @command_window.disable_item(4) end # Creazione finestra del tempo di gioco # @playtime_window = Window_PlayTime.new # @playtime_window.x = 0 # @playtime_window.y = 380 # @playtime_window.z = 4 @stepsgold_window = Window_GoldSteps.new @stepsgold_window.x = 320 @stepsgold_window.y = 380 # Creazione finestra dei passi #@steps_window = Window_Steps.new #@steps_window.x = 0 #@steps_window.y = 320 # Creazione finestra del denaro #@gold_window = Window_Gold.new #@gold_window.x = 0 #@gold_window.y = 416 # Creazione finestra dello status @status_window = Window_MenuStatus.new @status_window.x = 0 @status_window.y = 0 @status_window.z = 3 # Fade Graphics.transition # Loop Principale loop do # Aggiornamento Grafica Graphics.update # Aggiornamento Input Input.update # Aggiornamento Frame update # Quando cambia la scena blocca il loop if $scene != self break end end # Preparazione Fade Graphics.freeze # Eliminazione Finestre @command_window.dispose @stepsgold_window.dispose # @steps_window.dispose # @gold_window.dispose @status_window.dispose end #-------------------------------------------------------------------------- # - Aggiornamento #-------------------------------------------------------------------------- def update # Aggiorna le finestre @command_window.update @stepsgold_window.update # @gold_window.update @status_window.update # Quando è attiva la finestra dei comandi esegui update_command if @command_window.active update_command return endGioco in Sviluppo:
http://www.studibizantini.it/docs/Logo.png
Blog: Ode to my Forthcoming Winter
Riferimento
Contest:
http://rpg2s.net/gif/SCContest2Oct.gifx2 http://rpg2s.net/gif/SCContest1Oct.gifx1
Link to comment
Share on other sites
2 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