I figure i start a new topic, because if i post in my thread, i fear that it will be considedred as an
out of topic question. So, here i go!
Before that,
Screenies of my current project!
It's going nicely! XD However, i have mass update-ed the title screen script, (Of course i also used the Horizontal command script.)
Here is my "Scene_Title" Script :
#==============================================================================
# ** 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)
@modpic = Sprite.new
@newg = Sprite.new
@newg.x = 13
@newg.y = 423
@loadg = Sprite.new
@loadg.x = 246
@loadg.y = 423
@quitg = Sprite.new
@quitg.x = 477
@quitg.y = 423
# Make command window
commands = ["New Game", "Load Game", "Quit Game"]
commands2 = ["Normal", "Professional", " "]
@command_window = Window_HCommand.new(commands)
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 1000
@mode_window = Window_H2Command.new(commands2)
@mode_window.back_opacity = 160
@mode_window.active = false
@mode_window.visible = false
@mode_window.x = 320 - @command_window.width / 2
@mode_window.y = 1000
# 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
@loadg.bitmap = RPG::Cache.title("1")
@newg.bitmap = RPG::Cache.title("0d")
@quitg.bitmap = RPG::Cache.title("2d")
else
@command_window.disable_item(1)
@loadg.bitmap = RPG::Cache.title("1d")
@newg.bitmap = RPG::Cache.title("0")
@quitg.bitmap = RPG::Cache.title("2d")
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
@mode_window.dispose
# Dispose of title graphic
@modpic.dispose
@sprite.bitmap.dispose
@sprite.dispose
@newg.dispose
@loadg.dispose
@quitg.dispose
end
#--------------------------------------------------------------------------
# - Frame renewal
#--------------------------------------------------------------------------
def update
# Renewing the command window
@command_window.update
@mode_window.update
# When the command window is active,: Update_command is called
if @mode_window.active
update_mode
return
end
# When the command window is active,: Update_command is called
if @command_window.active
update_command
return
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update_command
# Update command window
@command_window.update
# Graphics
case @command_window.index
when 0
@loadg.bitmap = RPG::Cache.title("1d")
@newg.bitmap = RPG::Cache.title("0")
@quitg.bitmap = RPG::Cache.title("2d")
when 1
@loadg.bitmap = RPG::Cache.title("1")
@newg.bitmap = RPG::Cache.title("0d")
@quitg.bitmap = RPG::Cache.title("2d")
when 2
@loadg.bitmap = RPG::Cache.title("1d")
@newg.bitmap = RPG::Cache.title("0d")
@quitg.bitmap = RPG::Cache.title("2")
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # New game
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@mode_window.active = true
@command_window.visible = false
@mode_window.visible = true
when 1 # Continue
$scene = Scene_Load.new
when 2 # Shutdown
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
end
end
end
#--------------------------------------------------------------------------
# - Frame renewal (mode window is active)
#--------------------------------------------------------------------------
def update_mode
# Renew Choice
# The B when button is pushed
case @mode_window.index
when 0 # New game
@modpic.bitmap = RPG::Cache.title("Normal")
when 1 # Continue
@modpic.bitmap = RPG::Cache.title("Professional")
end
if Input.trigger?(Input::B)
# Performing cancellation SE
$game_system.se_play($data_system.cancel_se)
# Change to command screen
@command_window.active = true
@command_window.visible = true
@mode_window.active = false
@mode_window.visible = false
@modpic.bitmap = RPG::Cache.title("Blank")
return
end
# CWhen C button is pushed
if Input.trigger?(Input::C)
command_new_game
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)
case @mode_window.index
when 0 #Normal
$game_switches[129] = true
when 1 #Pro
$game_switches[128] = true
end
# 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
# Switch to load screen
$scene = Scene_Load.new
end
#--------------------------------------------------------------------------
# * Command: Shutdown
#--------------------------------------------------------------------------
def command_shutdown
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Shutdown
$scene = nil
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
end
The first Window_ Horizontal Command for @command_window :
#==============================================================================
# ** Window_HCommand
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_HCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(commands)
super(0, 0, 640, 64)
@item_max = commands.size
@commands = commands
@column_max = @item_max
self.contents = Bitmap.new(width - 32, 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, system_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(608 / @item_max * index, 0, 608 / @item_max, 32)
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(608 / @item_max * index, 0, 608 / @item_max, 32)
end
end
The second Window_Horizontal Command script for @mode_window (The exact script as above. contains only small edit.) :
#==============================================================================
# ** Window_HCommand
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_H2Command < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(commands2)
super(0, 0, 640, 64)
@item_max = commands2.size
@commands = commands2
@column_max = @item_max
self.contents = Bitmap.new(width - 32, 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, system_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
rect = Rect.new(608 / @item_max * index, 0, 608 / @item_max, 32)
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------------------------------------------
# * Disable Item
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(608 / @item_max * index, 0, 608 / @item_max, 32)
end
end
And the problem is :
I cannot select 'Load Game' when pressing left or right direction key.
Hi all,
I figure i start a new topic, because if i post in my thread, i fear that it will be considedred as an
out of topic question. So, here i go!
Before that,
Screenies of my current project!
It's going nicely! XD However, i have mass update-ed the title screen script, (Of course i also used the Horizontal command script.)
Here is my "Scene_Title" Script :
#============================================================================== # ** 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) @modpic = Sprite.new @newg = Sprite.new @newg.x = 13 @newg.y = 423 @loadg = Sprite.new @loadg.x = 246 @loadg.y = 423 @quitg = Sprite.new @quitg.x = 477 @quitg.y = 423 # Make command window commands = ["New Game", "Load Game", "Quit Game"] commands2 = ["Normal", "Professional", " "] @command_window = Window_HCommand.new(commands) @command_window.back_opacity = 160 @command_window.x = 320 - @command_window.width / 2 @command_window.y = 1000 @mode_window = Window_H2Command.new(commands2) @mode_window.back_opacity = 160 @mode_window.active = false @mode_window.visible = false @mode_window.x = 320 - @command_window.width / 2 @mode_window.y = 1000 # 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 @loadg.bitmap = RPG::Cache.title("1") @newg.bitmap = RPG::Cache.title("0d") @quitg.bitmap = RPG::Cache.title("2d") else @command_window.disable_item(1) @loadg.bitmap = RPG::Cache.title("1d") @newg.bitmap = RPG::Cache.title("0") @quitg.bitmap = RPG::Cache.title("2d") 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 @mode_window.dispose # Dispose of title graphic @modpic.dispose @sprite.bitmap.dispose @sprite.dispose @newg.dispose @loadg.dispose @quitg.dispose end #-------------------------------------------------------------------------- # - Frame renewal #-------------------------------------------------------------------------- def update # Renewing the command window @command_window.update @mode_window.update # When the command window is active,: Update_command is called if @mode_window.active update_mode return end # When the command window is active,: Update_command is called if @command_window.active update_command return end end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update_command # Update command window @command_window.update # Graphics case @command_window.index when 0 @loadg.bitmap = RPG::Cache.title("1d") @newg.bitmap = RPG::Cache.title("0") @quitg.bitmap = RPG::Cache.title("2d") when 1 @loadg.bitmap = RPG::Cache.title("1") @newg.bitmap = RPG::Cache.title("0d") @quitg.bitmap = RPG::Cache.title("2d") when 2 @loadg.bitmap = RPG::Cache.title("1d") @newg.bitmap = RPG::Cache.title("0d") @quitg.bitmap = RPG::Cache.title("2") end # If C button was pressed if Input.trigger?(Input::C) # Branch by command window cursor position case @command_window.index when 0 # New game $game_system.se_play($data_system.decision_se) @command_window.active = false @mode_window.active = true @command_window.visible = false @mode_window.visible = true when 1 # Continue $scene = Scene_Load.new when 2 # Shutdown # Fade out BGM, BGS, and ME Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) # Shutdown $scene = nil end end end #-------------------------------------------------------------------------- # - Frame renewal (mode window is active) #-------------------------------------------------------------------------- def update_mode # Renew Choice # The B when button is pushed case @mode_window.index when 0 # New game @modpic.bitmap = RPG::Cache.title("Normal") when 1 # Continue @modpic.bitmap = RPG::Cache.title("Professional") end if Input.trigger?(Input::B) # Performing cancellation SE $game_system.se_play($data_system.cancel_se) # Change to command screen @command_window.active = true @command_window.visible = true @mode_window.active = false @mode_window.visible = false @modpic.bitmap = RPG::Cache.title("Blank") return end # CWhen C button is pushed if Input.trigger?(Input::C) command_new_game 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) case @mode_window.index when 0 #Normal $game_switches[129] = true when 1 #Pro $game_switches[128] = true end # 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 # Switch to load screen $scene = Scene_Load.new end #-------------------------------------------------------------------------- # * Command: Shutdown #-------------------------------------------------------------------------- def command_shutdown # Fade out BGM, BGS, and ME Audio.bgm_fade(800) Audio.bgs_fade(800) Audio.me_fade(800) # Shutdown $scene = nil 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 endThe first Window_ Horizontal Command for @command_window :
The second Window_Horizontal Command script for @mode_window (The exact script as above. contains only small edit.) :
And the problem is :I cannot select 'Load Game' when pressing left or right direction key.
Demo Download : http://www.gdunlimited.net/media/uploads/manager/title-demo-21166.zip
I really need help of an experienced Scripters!
Edited by CalvinchunShare this post
Link to post
Share on other sites