allora... io ho modificato la classe Scene_Title aggiungendo due opzioni all'inizio (Immagini e Minigiochi) ora... immagini funziona alla perfezione ma minigame non mi dà il menù di scelta del minigame (forse perchè ho messo solo un'opzone) per controllare posto il codice
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
# Make command window
s1 = "Nuovo Gioco"
s2 = "Esci"
s3 = "Continua"
s4 = "Immagini"
s5 = "Minigiochi"
@command_window = Window_Command.new(192, [s1, s2, s3, s4, s5])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of command window
@command_window.dispose
# Dispose of title graphic
@sprite.bitmap.dispose
@sprite.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # Nuovo gioco
command_new_game
when 1 # Esci
command_shutdown
when 2 # Continua
command_continue
when 3 # Extra
command_extra
when 4 #minigame
command_minigam
end
end
end
#--------------------------------------------------------------------------
# * Command: New Game
#--------------------------------------------------------------------------
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$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
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Command: Continue
#--------------------------------------------------------------------------
def command_continue
# If continue is disabled
unless @continue_enabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Extra
#--------------------------------------------------------------------------
def command_extra
# Suona SE azione
$game_system.se_play($data_system.decision_se)
# Passa alla scena extra
$scene = Scene_Extra.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
#--------------------------------------------------------------------------
#command minigame
#--------------------------------------------------------------------------
def command_minigam
# Play decision SE
$game_system.se_play($data_system.decision_se)
s1 = "Puzle"
@command_window = Window_Command.new(192, [s1])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
$scene = Scene_Puzle.new(140, "Puzle1", 1, false, "Puzle1")
end
#--------------------------------------------------------------------------
# * Battle Test
#--------------------------------------------------------------------------
def battle_test
# Load database (for battle test)
$data_actors = load_data("Data/BT_Actors.rxdata")
$data_classes = load_data("Data/BT_Classes.rxdata")
$data_skills = load_data("Data/BT_Skills.rxdata")
$data_items = load_data("Data/BT_Items.rxdata")
$data_weapons = load_data("Data/BT_Weapons.rxdata")
$data_armors = load_data("Data/BT_Armors.rxdata")
$data_enemies = load_data("Data/BT_Enemies.rxdata")
$data_troops = load_data("Data/BT_Troops.rxdata")
$data_states = load_data("Data/BT_States.rxdata")
$data_animations = load_data("Data/BT_Animations.rxdata")
$data_tilesets = load_data("Data/BT_Tilesets.rxdata")
$data_common_events = load_data("Data/BT_CommonEvents.rxdata")
$data_system = load_data("Data/BT_System.rxdata")
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each game object
$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
# Set up party for battle test
$game_party.setup_battle_test_members
# Set troop ID, can escape flag, and battleback
$game_temp.battle_troop_id = $data_system.test_troop_id
$game_temp.battle_can_escape = true
$game_map.battleback_name = $data_system.battleback_name
# Play battle start SE
$game_system.se_play($data_system.battle_start_se)
# Play battle BGM
$game_system.bgm_play($game_system.battle_bgm)
# Switch to battle screen
$scene = Scene_Battle.new
end
end
Screen: http://img182.imageshack.us/slideshow/webp...id=screen3e.png il primo è l'errore (che dà alla fine del puzle) il secondo è il menù del titolo il terzo è il menù del titolo che si visualizza ancora e che non c'è la scelta dle minigioco dato che l'errore cita la classe Scene_Puzle eccola:
#==============================================================================
# ■ Scene_Puzle - By DarkRog - Versión Pase automático de piezas.
=begin
You need a picture with size 420px x 420px, in Graphics/Pictures. V
You have to call a script from an event and write:
!!!$scene = Scene_Puzle.new(100 , "puzle1", 1, false, "puzle1")!!! V
*The size has to be dividing of 420. V
*The picture need to be in Graphics/Picture. V
*The variable id:
1:You won, 2:Time up. V
*Seconds, or false for unlimited time. V
*A background image in Graphics/Picture, or false for any picture. V
Example:
$scene = Scene_Puzle.new(140, "Puzle1", 3, 30, "Back")
Size:140, Picture:"Puzle1", Variable:3, Seconds:30 Background:"Back".
=end V
#------------------------------------------------------------------------------
class Scene_Puzle
def initialize(size, img, vid, tim, back)
@pu = Window_Puzle.new(size, img, vid, tim, back)
end
def main
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@pu.dispose
if $scene.is_a?(Scene_Title)
Graphics.transition
Graphics.freeze
end
end
def update
@pu.refresh
end
end
class Window_Puzle < Window_Base
def initialize(size, img, vid, tim, back)
super(-16, -16, 640+32, 480+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 23
@back = back
@vid = vid
@piezasi = size
@img = img
@winb = Window_PBrillo.new
if tim == false
@timeh = false
else
@time = tim*25
@timeh = true
end
@pieza = []
piezas = []
num = 0
for i in 0..420/@piezasi-1
for a in 0..420/@piezasi-1
@pieza[num] = Pieza_Puzle.new(a, i)
piezas[num] = num
num += 1
end
end
@op = []
for i in 0..420/@piezasi*420/@piezasi-1
loop do
ra = rand(420/@piezasi*420/@piezasi)
if piezas[ra] != nil
@op[i] = ra
piezas[ra] = nil
break
end
end
end
@cursor = num-1
@o = 100
@re = false
refresh
end
def refresh
self.contents.clear
if @back != false
self.contents.blt(0, 0, RPG::Cache.picture(@back), Rect.new(0, 0, 640, 480), 255)
end
if @timeh == true
@time -= 1
if @time == 0
$game_variables[@vid] = 2
$game_system.se_play($data_system.buzzer_se)
$scene = Scene_Map.new
end
end
if @o <= 100
@re = false
elsif @o >= 255
@re = true
end
if @re == false
@o += 5
elsif @re == true
@o -= 5
end
self.contents.draw_text(26, 0, 640, 32, "Pieces")
self.contents.draw_text(300, 0, 640, 32, "Panel")
if @timeh != false
if @time/25%60 > 9
self.contents.draw_text(460, 0, 640, 32, "Time: #{@time/25/60}:#{@time/25%60}")
else
self.contents.draw_text(460, 0, 640, 32, "Time: #{@time/25/60}:0#{@time/25%60}")
end
else
self.contents.draw_text(460, 0, 640, 32, "Unlimited time")
end
self.contents.fill_rect(70-@piezasi/2+@piezasi/100, 240-@piezasi/2, @piezasi+2, @piezasi+2, Color.new(0, 0, 0, 200))
self.contents.fill_rect(175, 35, 422, 422, Color.new(0, 0, 0, 200))
self.contents.blt(176, 36, RPG::Cache.picture(@img), Rect.new(0, 0, 420, 420), 10)
pieza = 0
for i in 0..420/@piezasi-1
for a in 0..420/@piezasi-1
if @pieza[pieza].d == true
self.contents.blt(176+a*@piezasi, 36+i*@piezasi, RPG::Cache.picture(@img), Rect.new(@piezasi*a, @piezasi*i, @piezasi, @piezasi), 255)
end
pieza += 1
end
end
for a in -1..1
i = @cursor-a
if @op[i] != nil
if i >= 0 and a != 0
if @pieza[@op[i]].d == false
elsif @pieza[@op[i]].d == true
end
end
if a == 0
if @pieza[@op[i]].d == false
self.contents.blt(70-@piezasi/2+@piezasi/100+1, 240-@piezasi*3/2+@piezasi*(a+1), RPG::Cache.picture(@img), Rect.new(@pieza[@op[i]].x*@piezasi, @pieza[@op[i]].y*@piezasi, @piezasi, @piezasi), @o)
elsif @pieza[@op[i]].d == true
self.contents.blt(70-@piezasi/2+@piezasi/100+1, 240-@piezasi*3/2+@piezasi*(a+1), RPG::Cache.picture(@img), Rect.new(@pieza[@op[i]].x*@piezasi, @pieza[@op[i]].y*@piezasi, @piezasi, @piezasi), 20+@o/10)
end
end
end
end
if @fase == 1
f1_up
return
elsif @fase == nil
@fase = 1
@cursorx = 0
@cursory = 0
end
end
def f1_up
self.contents.blt(@piezasi*@cursorx+176, 36+@piezasi*@cursory, RPG::Cache.picture(@img), Rect.new(@pieza[@op[@cursor]].x*@piezasi, @pieza[@op[@cursor]].y*@piezasi, @piezasi, @piezasi), @o)
if Input.repeat?(Input::RIGHT) and @cursorx < 420/@piezasi-1
@cursorx += 1
$game_system.se_play($data_system.cursor_se)
elsif Input.repeat?(Input::RIGHT) and @cursorx == 420/@piezasi-1
$game_system.se_play($data_system.cursor_se)
@cursorx = 0
end
if Input.repeat?(Input::LEFT) and @cursorx > 0
@cursorx -= 1
$game_system.se_play($data_system.cursor_se)
elsif Input.repeat?(Input::LEFT) and @cursorx == 0
$game_system.se_play($data_system.cursor_se)
@cursorx = 420/@piezasi-1
end
if Input.repeat?(Input::DOWN) and @cursory < 420/@piezasi-1
@cursory += 1
$game_system.se_play($data_system.cursor_se)
elsif Input.repeat?(Input::DOWN) and @cursory == 420/@piezasi-1
@cursory = 0
$game_system.se_play($data_system.cursor_se)
end
if Input.repeat?(Input::UP) and @cursory >0
@cursory -= 1
$game_system.se_play($data_system.cursor_se)
elsif Input.repeat?(Input::UP) and @cursory == 0
@cursory = 420/@piezasi-1
$game_system.se_play($data_system.cursor_se)
end
if Input.trigger?(Input::C)
if @pieza[@op[@cursor]].x == @cursorx and @pieza[@op[@cursor]].y == @cursory
$game_system.se_play($data_system.load_se)
@pieza[@op[@cursor]].d = true
piezac = 0
for i in 0...420/@piezasi*420/@piezasi
if @pieza[i].d == true
piezac +=1
end
end
if piezac == 420/@piezasi*420/@piezasi
$game_variables[@vid] = 1 #mi da qui l'errore
@o2 = 0
@re2 = false
@t2 = 0
Audio.se_play("Audio/SE/056-Right02.ogg", 100, 50)
loop do
Graphics.update
@t2 += 1
if @re2 == true
@o2 -= 5
elsif @re2 == false
@o2 += 5
end
if @o2 >= 255
@re2 = true
elsif @o2 <= 0
@re2 = false
end
@winb.refresh(@o2)
if @t2 == 102
@winb.dispose
break
end
end
$game_system.se_play($data_system.shop_se)
$scene = Scene_Map.new
else
@cursor -= 1
end
else
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
class Pieza_Puzle
attr_accessor :x
attr_accessor :y
attr_accessor :d
def initialize(x, y)
@x = x
@y = y
@d = false
end
end
class Window_PBrillo < Window_Base
def initialize
super(-16, -16, 640+32, 480+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = 23
self.opacity = 0
refresh(0)
end
def refresh(o)
self.contents.clear
self.contents.fill_rect(175, 35, 422, 422, Color.new(255, 255, 255, o))
end
end Scene_Title 000.txt Scene_Puzle 001.txt