Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Title_Map
- MAP_ID = 3 # Map_ID for background
- X = 5 # initial x-coordinate of player
- Y = 5 # initial y-coordinate of player
- GAME_X = 30 # x-coordinate for picture on screen
- GAME_Y = 100 # y-coordinate for picture on screen
- WINDOW_WIDTH = 160 # width of window for difficulty
- DEFIC = {
- # name of level => [Switch ID (no switch = 0 , value of variable]
- "Easy" => [0,1],
- "Normal" => [0,2],
- "Hard" => [0,3],
- } #<= Don't delete!
- ORDER = [
- "Easy",
- "Normal",
- "Hard",
- ]
- DIFFICULTY_VARIABLE = 87 # variable for saving difficulty
- end
- include Title_Map
- class Scene_Title
- alias cmd_new_game command_new_game unless $@
- alias start_map_background start unless $@
- def start
- start_map_background
- $game_map.setup(MAP_ID)
- $game_player.moveto(X,Y)
- $game_player.refresh
- $game_map.update
- saves = Dir.glob('Save*.rvdata')
- @com = []
- for k in ORDER
- s = false
- if DEFIC[k][0] == 0
- @com.push(k)
- else
- for as in saves
- file = File.open(as,"rb")
- read_data(file)
- if $game_switches[DEFIC[k][0]]
- s = true
- file.close
- break
- end
- end
- if s
- @com.push(k)
- end
- end
- end
- create_game_objects
- $game_map.setup(MAP_ID)
- $game_player.moveto(X,Y)
- $game_player.refresh
- $game_map.update
- @choose_dif = Window_Command.new(WINDOW_WIDTH,@com)
- @choose_dif.x = (544-160)/2
- @choose_dif.y = (416-@choose_dif.height)/2
- @choose_dif.active = false
- @choose_dif.visible = false
- @spriteset = Spriteset_Map.new
- create_title_graphic
- end
- def read_data(file)
- characters = Marshal.load(file)
- Graphics.frame_count = Marshal.load(file)
- @last_bgm = Marshal.load(file)
- @last_bgs = Marshal.load(file)
- $game_system = Marshal.load(file)
- $game_message = Marshal.load(file)
- $game_switches = Marshal.load(file)
- $game_variables = Marshal.load(file)
- $game_self_switches = 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)
- end
- alias create_title_graphic_map_background create_title_graphic unless $@
- def create_title_graphic
- create_title_graphic_map_background
- @sprite.x = GAME_X
- @sprite.y = GAME_Y
- end
- alias update_map_background update unless $@
- def update
- if @command_window.active
- update_map_background
- else
- @choose_dif.update
- if Input.trigger?(Input::C)
- Sound.play_decision
- $game_variables[DIFFICULTY_VARIABLE] = DEFIC[ @com[@choose_dif.index] ][1]
- cmd_new_game
- elsif Input.trigger?(Input::B)
- @choose_dif.active = false
- @choose_dif.visible = false
- @command_window.active = true
- @command_window.visible = true
- end
- end
- $game_map.update
- @spriteset.update
- end
- alias terminate_map_background terminate unless $@
- def terminate
- terminate_map_background
- @spriteset.dispose
- @choose_dif.dispose
- end
- def command_new_game
- @choose_dif.active = true
- @choose_dif.visible = true
- @command_window.active = false
- @command_window.visible = false
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment