Dod Simple Menu Advenced
2 participantes
Brasil G4mes :: Scripts :: Scripts RGSS1
Página 1 de 1
Dod Simple Menu Advenced
Dod Simple Menu Advenced
Por doodop
Intrudução
Um simples menu feito pelo doodop, é um menu um tanto feio, pois o aumento de tamanho dos chars fizeram com que estes perdecem muita qualidade gráfica. Mas mesmo assim, postei, quando ve tem algum membro que goste.
Screenshot
Código
- Spoiler:
- Código:
#-------------------------#
#Dod Simple Menu Advenced #
#Versão:1.0 #
#Autor:dodoop #
#-------------------------#
#==============================================================================
# Scene_Menu
#------------------------------------------------------------------------------
# Esta classe processa a Tela de Menu
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# Inicialização dos Objetos
#
# menu_index : posição inicial do cursor de comando
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# Processamento Principal
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new
# Criar janela de comando
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Fim de Jogo"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
@command_window.index = @menu_index
@command_window.y = 200
# Se o número de membros do Grupo de Heróis for 0
if $game_party.actors.size == 0
# Desabilar as janelas de Item, Habilidades, Equipamento e Status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# Se Salvar for Proibido
if $game_system.save_disabled
# Desabilitar Salvar
@command_window.disable_item(4)
end
# Criar janela de Tempo de Jogo
@playtime_window = Window_PlayTime.new
@playtime_window.x = 480
@playtime_window.y = 200
# Criar janela de Número Passos
@steps_window = Window_Steps.new
@steps_window.x = 320
@steps_window.y = 200
# Criar janela de Dinheiro
@gold_window = Window_Gold.new
@gold_window.x = 160
@gold_window.y = 200
@gold_window.height = 96
# Criar janela de Status
@status_window = Window_MenuStatus.new
@status_window.x = 0
@status_window.y = 0
# Executar transição
Graphics.transition
# Loop principal
loop do
# Atualizar a tela de jogo
Graphics.update
# Atualizar a entrada de informações
Input.update
# Atualizar Frame
update
# Abortar loop se a tela for alterada
if $scene != self
break
end
end
# Preparar para transiçõa
Graphics.freeze
# Exibição das janelas
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# Atualização do Frame
#--------------------------------------------------------------------------
def update
# Atualizar janelas
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@status_window.update
# Se a janela de comandos estiver ativo: chamar update_command
if @command_window.active
update_command
return
end
# Se a janela de Status estiver ativa: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# Atualização do Frame (Quando a janela de Comandos estiver Ativa)
#--------------------------------------------------------------------------
def update_command
# Se o botão B for pressionado
if Input.trigger?(Input::B)
# Reproduzir SE de cancelamento
$game_system.se_play($data_system.cancel_se)
# Alternar para a tela do mapa
$scene = Scene_Map.new
return
end
# Se o botão C for pressionado
if Input.trigger?(Input::C)
# Se o comando for outro senão Salvar, Fim de Jogo e o número de Heróis no
# Grupo for 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Reproduzir SE de erro
$game_system.se_play($data_system.buzzer_se)
return
end
# Ramificação por posição do cursor na janela de comandos
case @command_window.index
when 0 # Itens
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Alternar para a tela de Itens
$scene = Scene_Item.new
when 1 # Habilidades
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Ativar o status da janela
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # Equipamentos
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Ativar o status da janela
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # Status
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Ativar o status da janela
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # Fim de jogo
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Alternar para a tela de Fim de Jogo
$scene = Scene_End.new
return
end
end
#--------------------------------------------------------------------------
# Atualização do Frame (Quando o status da Janela estiver Ativo)
#--------------------------------------------------------------------------
def update_status
# Se o botão B for pressionado
if Input.trigger?(Input::B)
# Reproduzir SE de cancelamento
$game_system.se_play($data_system.cancel_se)
# Torna a janela de comandos ativa
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# Se o botão C for pressionado
if Input.trigger?(Input::C)
# Ramificação por posição do cursor na janela de comandos
case @command_window.index
when 1 # Habilidades
# Se o limite de ação deste Herói for de 2 ou mais
if $game_party.actors[@status_window.index].restriction >= 2
# Reproduzir SE de erro
$game_system.se_play($data_system.buzzer_se)
return
end
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Alternar para a tela de Habilidades
$scene = Scene_Skill.new(@status_window.index)
when 2 # Equipamento
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Alternar para a tela de Equipamento
$scene = Scene_Equip.new(@status_window.index)
when 3 # Status
# Reproduzir SE de OK
$game_system.se_play($data_system.decision_se)
# Alternar para a tela de Status
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
end
class Window_Base < Window
def draw_actor_sprite(actor,x,y,largura,altura)
self.contents.fill_rect(x,y,largura,altura, Color.new(0, 0, 0, 0))
#Carrega a imagem do herói numa var
bitmap = RPG::Cache.character(actor.character_name,actor.character_hue)
#desenha o herói, aumentado de tamanho e no frame correnspondente
self.contents.stretch_blt(Rect.new(x,y,largura,altura), bitmap,
Rect.new(bitmap.width / 4 * 0,bitmap.height / 4 * 0, bitmap.width / 4 , bitmap.height / 4))
end
end
#==============================================================================
# Window_MenuStatus
#------------------------------------------------------------------------------
# Exibe a janela do menu de Status
#==============================================================================
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# Inicialização dos Objetos
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 200)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# Atualização
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = i * 213#64
y = 0#i * 116
actor = $game_party.actors[i]
#draw_actor_graphic_2(actor, x, y+50)
#draw_actor_sprite(actor,x-20,y+0,180,200)
draw_actor_sprite(actor,x+0,y+0,128,192)
draw_actor_name(actor,x,y)
draw_actor_hp_dodoop(actor,x,y+100,width = 140)
draw_actor_sp_dodoop(actor,x,y+120,width = 140)
#draw_actor_class(actor, x, y)
draw_actor_exp_dodoop(actor,x,y+140,width = 160)
end
end
#--------------------------------------------------------------------------
# Renovação do Retângulo de Seleção
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set( @index * 213,0,213-32,self.height - 32)
end
end
end
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
class Window_Base < Window
def draw_actor_hp_dodoop(actor, x, y, width = 144)
if actor.maxhp != 0
rate = actor.hp.to_f / actor.maxhp
else
rate = 0
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(100,100,100, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(64, 0, 0, 192)
color5 = Color.new(255 * rate, 0 * rate, 0 * rate, 192)
color6 = Color.new(130 * rate, 0 * rate, 0 * rate, 192)
if actor.maxhp != 0
hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
else
hp = 0
end
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, hp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
draw_actor_hp(actor, x, y)
end
def draw_actor_sp_dodoop(actor, x, y, width = 144)
if actor.maxsp != 0
rate = actor.sp.to_f / actor.maxsp
else
rate = 1
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(100, 100, 100, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 64, 0, 192)
color5 = Color.new(0 * rate, 0 * rate, 255 * rate, 192)
color6 = Color.new(0 * rate, 0 * rate, 130 * rate, 192)
# •Ï”sp‚É•`‰æ‚·‚éƒQ[ƒW‚Ì•‚ð‘ã“ü
if actor.maxsp != 0
sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
else
sp = (width + plus_width) * rate_width / 100
end
# ƒQ[ƒW‚Ì•`‰æ
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, sp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
# ƒIƒŠƒWƒiƒ‹‚ÌSP•`‰æˆ—‚ðŒÄ‚Ño‚µ
draw_actor_sp(actor, x, y)
end
def draw_actor_exp_dodoop(actor, x, y, width = 204)
if actor.next_exp != 0
rate = actor.now_exp.to_f / actor.next_exp
else
rate = 1
end
plus_x = 0
rate_x = 0
plus_y = 25
plus_width = 0
rate_width = 100
height = 10
align1 = 1
align2 = 2
align3 = 0
grade1 = 1
grade2 = 0
color1 = Color.new(0, 0, 0, 192)
color2 = Color.new(100,100,100, 192)
color3 = Color.new(0, 0, 0, 192)
color4 = Color.new(0, 0, 0, 192)
color5 = Color.new(0 * rate, 255 * rate ** 0 * rate, 192)
color6 = Color.new(0 * rate, 130 * rate ** 0 * rate, 192)
if actor.next_exp != 0
exp = (width + plus_width) * actor.now_exp * rate_width /
100 / actor.next_exp
else
exp = (width + plus_width) * rate_width / 100
end
gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
width, plus_width + width * rate_width / 100,
height, exp, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
draw_actor_exp(actor, x, y)
end
def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
color1, color2, color3, color4, color5, color6, grade1, grade2)
case align1
when 1
x += (rect_width - width) / 2
when 2
x += rect_width - width
end
case align2
when 1
y -= height / 2
when 2
y -= height
end
self.contents.fill_rect(x, y, width, height, color1)
self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
if align3 == 0
if grade1 == 2
grade1 = 3
end
if grade2 == 2
grade2 = 3
end
end
if (align3 == 1 and grade1 == 0) or grade1 > 0
color = color3
color3 = color4
color4 = color
end
if (align3 == 1 and grade2 == 0) or grade2 > 0
color = color5
color5 = color6
color6 = color
end
# ‹óƒQ[ƒW‚Ì•`‰æ
self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
color3, color4, grade1)
if align3 == 1
x += width - gauge
end
# ŽÀƒQ[ƒW‚Ì•`‰æ
self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
color5, color6, grade2)
end
end
class Bitmap
def gradation_rect(x, y, width, height, color1, color2, align = 0)
if align == 0
for i in x...x + width
red = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
green = color1.green +
(color2.green - color1.green) * (i - x) / (width - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - x) / (width - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - x) / (width - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(i, y, 1, height, color)
end
elsif align == 1
for i in y...y + height
red = color1.red +
(color2.red - color1.red) * (i - y) / (height - 1)
green = color1.green +
(color2.green - color1.green) * (i - y) / (height - 1)
blue = color1.blue +
(color2.blue - color1.blue) * (i - y) / (height - 1)
alpha = color1.alpha +
(color2.alpha - color1.alpha) * (i - y) / (height - 1)
color = Color.new(red, green, blue, alpha)
fill_rect(x, i, width, 1, color)
end
elsif align == 2
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
elsif align == 3
for i in x...x + width
for j in y...y + height
red = color1.red + (color2.red - color1.red) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
green = color1.green + (color2.green - color1.green) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
blue = color1.blue + (color2.blue - color1.blue) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
alpha = color1.alpha + (color2.alpha - color1.alpha) *
((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
color = Color.new(red, green, blue, alpha)
set_pixel(i, j, color)
end
end
end
end
end
module RPG
class Sprite < ::Sprite
def damage(value, critical)
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)
bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 12, 160, 36, damage_string, 1)
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80 + self.viewport.ox
@_damage_sprite.oy = 20 + self.viewport.oy
@_damage_sprite.x = self.x + self.viewport.rect.x
@_damage_sprite.y = self.y - self.oy / 2 + self.viewport.rect.y
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def animation(animation, hit)
dispose_animation
@_animation = animation
return if @_animation == nil
@_animation_hit = hit
@_animation_duration = @_animation.frame_max
animation_name = @_animation.animation_name
animation_hue = @_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_animation_sprites = []
if @_animation.position != 3 or not @@_animations.include?(animation)
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_animation_sprites.push(sprite)
end
unless @@_animations.include?(animation)
@@_animations.push(animation)
end
end
update_animation
end
def loop_animation(animation)
return if animation == @_loop_animation
dispose_loop_animation
@_loop_animation = animation
return if @_loop_animation == nil
@_loop_animation_index = 0
animation_name = @_loop_animation.animation_name
animation_hue = @_loop_animation.animation_hue
bitmap = RPG::Cache.animation(animation_name, animation_hue)
if @@_reference_count.include?(bitmap)
@@_reference_count[bitmap] += 1
else
@@_reference_count[bitmap] = 1
end
@_loop_animation_sprites = []
for i in 0..15
sprite = ::Sprite.new
sprite.bitmap = bitmap
sprite.visible = false
@_loop_animation_sprites.push(sprite)
end
update_loop_animation
end
def animation_set_sprites(sprites, cell_data, position)
for i in 0..15
sprite = sprites[i]
pattern = cell_data[i, 0]
if sprite == nil or pattern == nil or pattern == -1
sprite.visible = false if sprite != nil
next
end
sprite.visible = true
sprite.src_rect.set(pattern % 5 * 192, pattern / 5 * 192, 192, 192)
if position == 3
if self.viewport != nil
sprite.x = self.viewport.rect.width / 2
sprite.y = self.viewport.rect.height - 160
else
sprite.x = 320
sprite.y = 240
end
else
sprite.x = self.x + self.viewport.rect.x -
self.ox + self.src_rect.width / 2
sprite.y = self.y + self.viewport.rect.y -
self.oy + self.src_rect.height / 2
sprite.y -= self.src_rect.height / 4 if position == 0
sprite.y += self.src_rect.height / 4 if position == 2
end
sprite.x += cell_data[i, 1]
sprite.y += cell_data[i, 2]
sprite.z = 2000
sprite.ox = 96
sprite.oy = 96
sprite.zoom_x = cell_data[i, 3] / 100.0
sprite.zoom_y = cell_data[i, 3] / 100.0
sprite.angle = cell_data[i, 4]
sprite.mirror = (cell_data[i, 5] == 1)
sprite.opacity = cell_data[i, 6] * self.opacity / 255.0
sprite.blend_type = cell_data[i, 7]
end
end
end
end
Re: Dod Simple Menu Advenced
O Menu ate q ñ é tão feio mas deixa mesm um ar esquizitu.
jasher- Membro
- Mensagens : 1
Fama : 0
Tópicos semelhantes
» Gold Menu Mod Mog Menu Yui
» HUD Simple V1.0
» Roberto Dash's Hud simple 0.12
» Ícones no Menu
» Menu Horizontal
» HUD Simple V1.0
» Roberto Dash's Hud simple 0.12
» Ícones no Menu
» Menu Horizontal
Brasil G4mes :: Scripts :: Scripts RGSS1
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos