Load Y Save Mejorado

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Load Y Save Mejorado as PDF for free.

More details

  • Words: 1,367
  • Pages: 10
crea un juevo scrip sobre main y en el pones esto code # * reload (load screen improvement) by mewsterus # * to install, just insert this in a descriptive code slot right above main #=============================================================================== # � window_load #------------------------------------------------------------------------------# edited by mewsterus #=============================================================================== class window_load < window_base attr_reader :filename attr_reader :selected #----------------------------------------------------------------------------# @ make the window #----------------------------------------------------------------------------def initialize(file_index) super(0, 64 + file_index % 4 * 104, 640, 104) self.contents = bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = $fontsize self.contents_opacity = 155 self.back_opacity = 160 @file_index = file_index @filename = "save#{@file_index + 1}.rxdata" @selected = false refresh update end #----------------------------------------------------------------------------# @ refresh the window #----------------------------------------------------------------------------def refresh self.contents.clear @time_stamp = time.at(0) @file_exist = filetest.exist?(@filename) if @file_exist file = file.open(@filename, "r") @time_stamp = file.mtime @characters = marshal.load(file) @frame_count = marshal.load(file) @game_system = marshal.load(file) @game_switches = marshal.load(file) @game_variables = marshal.load(file) @game_self_switches = marshal.load(file) @game_screen = marshal.load(file) @game_actors = marshal.load(file) @game_party = marshal.load(file) @game_troop = marshal.load(file) @game_map = marshal.load(file) @game_player = marshal.load(file) @total_sec = @frame_count / graphics.frame_rate file.close self.windowskin = rpg::cache.windowskin(@game_system.windowskin_name) for i in [email protected] if $face_enabled bitmap = rpg::cache.picture(@characters[i][0])

cw = 80 ch = 80 else bitmap = rpg::cache.character(@characters[i][0], @characters[i][1]) cw = bitmap.rect.width / 4 ch = bitmap.rect.height / 4 end src_rect = rect.new(0, 0, cw, ch) x = 608 + (i - @characters.size) * 84 self.contents.blt(x, 80 - ch, bitmap, src_rect) end 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(4, 8, 256, 32, text, 2) time_string = @time_stamp.strftime("%y/%m/%d %h:%m") self.contents.draw_text(4, 40, 256, 32, time_string, 2) if $location_enabled name = @game_map.name.delete("*").to_s else name = @game_party.actors[0].name end else self.windowskin = rpg::cache.windowskin($game_system.windowskin_name) name = "[empty]" end self.contents.font.color = normal_color self.contents.draw_text(4, 8, 600, 32, name) end #----------------------------------------------------------------------------# @ update the window #----------------------------------------------------------------------------def update super if @selected if self.contents_opacity < 255 self.contents_opacity += 10 end else if self.contents_opacity > 155 self.contents_opacity -= 10 end end end #----------------------------------------------------------------------------# @ accept whether window is selected #----------------------------------------------------------------------------def selected=(selected) @selected = selected update end end #=============================================================================== # � window_loadcommand #-------------------------------------------------------------------------------

# written by mewsterus #=============================================================================== class window_loadcommand < window_selectable #----------------------------------------------------------------------------# @ make the window #----------------------------------------------------------------------------def initialize super(-640, 0, 640, 64) self.contents = bitmap.new(width - 32, height - 32) self.contents.font.name = $fontface self.contents.font.size = 24 self.back_opacity = 160 self.index = 0 @commands = ["new game", "delete"] @item_max = 2 @column_max = 2 draw_item(0) draw_item(1) end #----------------------------------------------------------------------------# @ draw item #----------------------------------------------------------------------------def draw_item(index) self.contents.font.color = system_color rect = rect.new(164 + index * 160, 0, 118, 32) self.contents.fill_rect(rect, color.new(0, 0, 0, 0)) self.contents.draw_text(rect, @commands[index], 1) end #----------------------------------------------------------------------------# @ update the window #----------------------------------------------------------------------------def update if input.repeat?(input::down) or input.repeat?(input::up) return end if input.repeat?(input::right) if @index < @item_max - 1 $game_system.se_play($data_system.cursor_se) @index += 1 end end if input.repeat?(input::left) if @index > 0 $game_system.se_play($data_system.cursor_se) @index -= 1 end end super end #----------------------------------------------------------------------------# @ update the cursor #----------------------------------------------------------------------------def update_cursor_rect if self.active self.cursor_rect.set(160 + @index * 160, 0, 128, 32) else self.cursor_rect.empty

end end end #=============================================================================== # � scene_load #------------------------------------------------------------------------------# edited by mewsterus #=============================================================================== class scene_load #----------------------------------------------------------------------------# @ main loop #----------------------------------------------------------------------------def main @sprite = sprite.new @sprite.bitmap = rpg::cache.title($data_system.title_name) @top_window = window_loadcommand.new @savefile_windows = [] for i in 0..3 @savefile_windows.push(window_load.new(i)) end @savefile_windows[0].x = 640 @savefile_windows[1].x = -640 @savefile_windows[2].x = 640 @savefile_windows[3].x = -640 graphics.transition loop do graphics.update input.update if @savefile_windows[0].x > 0 @savefile_windows[0].x -= 64 end if @savefile_windows[1].x < 0 @savefile_windows[1].x += 64 end if @savefile_windows[2].x > 0 @savefile_windows[2].x -= 64 end if @savefile_windows[3].x < 0 @savefile_windows[3].x += 64 end if @top_window.x < 0 @top_window.x += 64 else update end if $scene != self break end end unless @scene_title @sprite.dispose end for i in 0..10 @top_window.x += 64 @savefile_windows[0].x -= 64 @savefile_windows[1].x += 64

@savefile_windows[2].x -= 64 @savefile_windows[3].x += 64 graphics.update end graphics.freeze @top_window.dispose for i in @savefile_windows i.dispose end end #----------------------------------------------------------------------------# @ update the screen #----------------------------------------------------------------------------def update unless @delete @top_window.update end for i in @savefile_windows i.update end if @top_window.active update_top return end if @file_active update_file return end end #----------------------------------------------------------------------------# @ update the top window #----------------------------------------------------------------------------def update_top if input.trigger?(input::c) case @top_window.index when 0 command_new_game return when 1 @delete = true $game_system.se_play($data_system.decision_se) @top_window.active = false @file_active = true @file_index = 0 @savefile_windows[@file_index].selected = true return end end if input.trigger?(input::b) $game_system.se_play($data_system.cancel_se) $scene = scene_title.new @scene_title = true return end if input.repeat?(input::down) $game_system.se_play($data_system.cursor_se) @top_window.active = false @file_active = true

@file_index = 0 @savefile_windows[@file_index].selected = true return end if input.trigger?(input::up) $game_system.se_play($data_system.cursor_se) @top_window.active = false @file_active = true @file_index = 3 @savefile_windows[@file_index].selected = true return end end #----------------------------------------------------------------------------# @ update the file windows #----------------------------------------------------------------------------def update_file if input.trigger?(input::c) if @delete if filetest.exist?("save#{@file_index + 1}.rxdata") $game_system.se_play($data_system.decision_se) file.delete("save#{@file_index + 1}.rxdata") @savefile_windows[@file_index].refresh @delete = false @savefile_windows[@file_index].selected = false @file_active = false @top_window.active = true else $game_system.se_play($data_system.buzzer_se) end return end on_decision("save#{@file_index + 1}.rxdata") return end if input.trigger?(input::b) $game_system.se_play($data_system.cancel_se) if @delete @delete = false @savefile_windows[@file_index].selected = false @file_active = false @top_window.active = true return end $scene = scene_title.new @scene_title = true return end if input.repeat?(input::down) unless @file_index < 3 or @delete if input.trigger?(input::down) $game_system.se_play($data_system.cursor_se) @savefile_windows[@file_index].selected = false @file_active = false @top_window.active = true return end end

if input.trigger?(input::down) or @file_index < 3 $game_system.se_play($data_system.cursor_se) @savefile_windows[@file_index].selected = false @file_index = (@file_index + 1) % 4 @savefile_windows[@file_index].selected = true return end end if input.repeat?(input::up) unless @file_index > 0 or @delete $game_system.se_play($data_system.cursor_se) @savefile_windows[@file_index].selected = false @file_active = false @top_window.active = true return end if input.trigger?(input::up) or @file_index > 0 $game_system.se_play($data_system.cursor_se) @savefile_windows[@file_index].selected = false @file_index = (@file_index + 3) % 4 @savefile_windows[@file_index].selected = true return end end end #----------------------------------------------------------------------------# @ decision command #----------------------------------------------------------------------------def on_decision(filename) unless filetest.exist?(filename) command_new_game return end $game_system.se_play($data_system.load_se) $game_temp = game_temp.new file = file.open(filename, "rb") characters = marshal.load(file) graphics.frame_count = marshal.load(file) $game_system = marshal.load(file) $game_switches = marshal.load(file) $game_variables = marshal.load(file) $game_self_switches = marshal.load(file) $game_screen = marshal.load(file) $game_actors = marshal.load(file) $game_party = marshal.load(file) $game_troop = marshal.load(file) $game_map = marshal.load(file) $game_player = marshal.load(file) if $game_system.magic_number != $data_system.magic_number $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end $game_party.refresh file.close $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) $game_map.update $scene = scene_map.new

@scene_title = false end #-------------------------------------------------------------------------# @ generate new game #-------------------------------------------------------------------------def command_new_game $game_system.se_play($data_system.decision_se) audio.bgm_stop graphics.frame_count = 0 $game_temp = game_temp.new $game_system = game_system.new $game_switches = game_switches.new $game_variables = game_variables.new $game_self_switches = game_selfswitches.new $game_screen = game_screen.new $game_actors = game_actors.new $game_party = game_party.new $game_troop = game_troop.new $game_map = game_map.new $game_player = game_player.new $game_party.setup_starting_members $game_map.setup($data_system.start_map_id) $game_player.moveto($data_system.start_x, $data_system.start_y) $game_player.refresh $game_map.autoplay $game_map.update $scene = scene_map.new @scene_title = false end end screens para activar caras, a�ada esto a principal justo antes esto define los valores de fuente: code $face_enabled = true las caras deben ser 80 pixeles por 80 pixeles, en el directorio de cuadros, y llamaron el mismo como el h�roe charset gr�fico. para permitir la demostraci�n de posici�n(ubicaci�n) (en vez del nombre del primer car�cter en el partido(la parte)), a�ada esto a otra ranura encima principal: code # * location window by mewsterus # * to install, just insert this in a descriptive code slot right above main # * # * this replaces the playtime window. replace the class method below to # * window_steps if you prefer that the step counter window be the one replaced #=============================================================================== # � window_playtime #------------------------------------------------------------------------------# written by mewsterus; the location window #===============================================================================

class window_playtime < window_base #----------------------------------------------------------------------------# @ refresh the window #----------------------------------------------------------------------------def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(4, 0, 120, 32, "location") self.contents.font.color = normal_color self.contents.draw_text(4, 32, 120, 32, $game_map.name.delete("*").to_s, 2) end end #=============================================================================== # � game_map #------------------------------------------------------------------------------# written by mewsterus #=============================================================================== class game_map #----------------------------------------------------------------------------# @ return map name #----------------------------------------------------------------------------def name $data_map[@map_id] end end #=============================================================================== # � main #------------------------------------------------------------------------------# written by mewsterus #=============================================================================== begin $location_enabled = true $data_map = load_data("data/mapinfos.rxdata") for key in $data_map.keys $data_map[key] = $data_map[key].name end end esto tambi�n sustituye la ventana de tiempo de juego en el men� con la ventana de posici�n(Ubicaci�n). usted puede cambiar esto a la ventana de pasos si usted sigue las instrucciones en lo alto de la escritura. si usted consigue cualquier problema con cualquier l�nea que dice esto: code self.contents.font.size = $fontsize cambie las definiciones de fuente en principal a algo como esto: code $defaultfonttype = $fontface = font.default_name = $fontname = "arial" $defaultfontsize = $fontsize = font.default_size = 24

esto deber�a resolver todos los problemas.adem�s, si usted quiere que las ventanas salvar�(ahorrar�) se parezcan a esto en scene_save, encuentre estas l�neas: code class window_load def initialize(file_index) y remplaza por estas: code class window_savefile def initialize(file_index, arg = nil) busca esto: code

@savefile_windows.push(window_load.new(i))

y remplasalo por esto: code

@savefile_windows.push(window_savefile.new(i))

Related Documents

Load Y Save Mejorado
November 2019 12
Snake Mejorado
June 2020 13
Mejorado Oferta.docx
November 2019 10
Ci Mejorado
November 2019 17
Save
May 2020 27