Fast travel more or less finished
This commit is contained in:
parent
ddc43b2114
commit
21450179c6
|
|
@ -15,6 +15,7 @@ class FastTravel
|
||||||
:apartments => tr("apartments"),
|
:apartments => tr("apartments"),
|
||||||
:cafe => tr("cafe"),
|
:cafe => tr("cafe"),
|
||||||
:office => tr("office"),
|
:office => tr("office"),
|
||||||
|
:obsdeck => tr("observation deck"),
|
||||||
}),
|
}),
|
||||||
:green => Zone.new(tr("The Glen"), {
|
:green => Zone.new(tr("The Glen"), {
|
||||||
:whatever => tr(""),
|
:whatever => tr(""),
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ class Ed_Message
|
||||||
end
|
end
|
||||||
|
|
||||||
if visible
|
if visible
|
||||||
if Input.trigger?(Input::ACTION)
|
if Input.trigger?(Input::ACTION) || Input.trigger?(Input::CANCEL)
|
||||||
terminate_message
|
terminate_message
|
||||||
@fade_out_text = true
|
@fade_out_text = true
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,15 @@ class FastTravel
|
||||||
self.visible = true
|
self.visible = true
|
||||||
self.opacity = 0
|
self.opacity = 0
|
||||||
@fade_in = true
|
@fade_in = true
|
||||||
@data = $game_fasttravel.unlocked_maps.sort
|
@data = $game_fasttravel.unlocked_maps.keys.sort
|
||||||
|
|
||||||
|
# Set cursor to current map
|
||||||
|
@data.each_with_index do |map, i|
|
||||||
|
if $game_fasttravel.unlocked_maps[map].id == $game_map.map_id
|
||||||
|
@index = i
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
zone = ZONES[$game_fasttravel.zone]
|
zone = ZONES[$game_fasttravel.zone]
|
||||||
|
|
||||||
# Create title
|
# Create title
|
||||||
|
|
@ -119,6 +127,23 @@ class FastTravel
|
||||||
$game_system.se_play($data_system.cursor_se)
|
$game_system.se_play($data_system.cursor_se)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Input.trigger?(Input::ACTION)
|
||||||
|
$game_system.se_play($data_system.decision_se)
|
||||||
|
choice = $game_fasttravel.unlocked_maps[@data[@index]]
|
||||||
|
if choice.id != $game_map.map_id
|
||||||
|
$game_temp.player_transferring = true
|
||||||
|
$game_temp.player_new_map_id = choice.id
|
||||||
|
$game_temp.player_new_x = choice.x
|
||||||
|
$game_temp.player_new_y = choice.y
|
||||||
|
$game_temp.player_new_direction = choice.dir
|
||||||
|
Graphics.freeze
|
||||||
|
$game_temp.transition_processing = true
|
||||||
|
$game_temp.transition_name = "travel"
|
||||||
|
end
|
||||||
|
@fade_out = true
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if Input.trigger?(Input::CANCEL)
|
if Input.trigger?(Input::CANCEL)
|
||||||
$game_system.se_play($data_system.cancel_se)
|
$game_system.se_play($data_system.cancel_se)
|
||||||
@fade_out = true
|
@fade_out = true
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ class Game_Event < Game_Character
|
||||||
attr_reader :list # list of event commands
|
attr_reader :list # list of event commands
|
||||||
attr_reader :starting # starting flag
|
attr_reader :starting # starting flag
|
||||||
attr_reader :collision # collision array
|
attr_reader :collision # collision array
|
||||||
|
attr_reader :x
|
||||||
|
attr_reader :y
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# * Object Initialization
|
# * Object Initialization
|
||||||
# map_id : map ID
|
# map_id : map ID
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,34 @@ class Game_FastTravel
|
||||||
attr_accessor :enabled
|
attr_accessor :enabled
|
||||||
alias :enabled? :enabled
|
alias :enabled? :enabled
|
||||||
|
|
||||||
|
class Map
|
||||||
|
attr_reader :id
|
||||||
|
attr_reader :x
|
||||||
|
attr_reader :y
|
||||||
|
attr_reader :dir
|
||||||
|
|
||||||
|
def initialize(id, x, y, dir)
|
||||||
|
@id = id
|
||||||
|
@x = x
|
||||||
|
@y = y
|
||||||
|
@dir = dir
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@unlocked = {}
|
@unlocked = {}
|
||||||
@zone = nil
|
@zone = nil
|
||||||
@enabled = false
|
@enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def unlock(map)
|
def unlock(map, id, x, y, dir)
|
||||||
@unlocked[@zone] << map
|
@unlocked[@zone][map] = Map.new(id, x, y, dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
def zone=(zone)
|
def zone=(zone)
|
||||||
@zone = zone
|
@zone = zone
|
||||||
unless @unlocked.include? zone
|
unless @unlocked.include? zone
|
||||||
@unlocked[zone] = []
|
@unlocked[zone] = {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,8 +124,6 @@ class Scene_Map
|
||||||
end
|
end
|
||||||
# Hide icon when item menu is visible
|
# Hide icon when item menu is visible
|
||||||
@item_icon.visible = !@item_menu.visible
|
@item_icon.visible = !@item_menu.visible
|
||||||
# Update fast travel
|
|
||||||
@fast_travel.update
|
|
||||||
# If game over
|
# If game over
|
||||||
if $game_temp.gameover
|
if $game_temp.gameover
|
||||||
# Switch to game over screen
|
# Switch to game over screen
|
||||||
|
|
@ -150,6 +148,8 @@ class Scene_Map
|
||||||
$game_temp.transition_name)
|
$game_temp.transition_name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# Update fast travel
|
||||||
|
@fast_travel.update
|
||||||
# If showing message window
|
# If showing message window
|
||||||
if $game_temp.message_window_showing || @ed_message.visible
|
if $game_temp.message_window_showing || @ed_message.visible
|
||||||
return
|
return
|
||||||
|
|
@ -342,13 +342,13 @@ class Scene_Map
|
||||||
# Update map (run parallel process event)
|
# Update map (run parallel process event)
|
||||||
$game_map.update
|
$game_map.update
|
||||||
@spriteset.update
|
@spriteset.update
|
||||||
# If processing transition
|
# # If processing transition
|
||||||
if $game_temp.transition_processing
|
# if $game_temp.transition_processing
|
||||||
# Clear transition processing flag
|
# # Clear transition processing flag
|
||||||
$game_temp.transition_processing = false
|
# $game_temp.transition_processing = false
|
||||||
# Execute transition
|
# # Execute transition
|
||||||
Graphics.transition(20)
|
# Graphics.transition(20)
|
||||||
end
|
# end
|
||||||
# Run automatic change for BGM and BGS set on the map
|
# Run automatic change for BGM and BGS set on the map
|
||||||
$game_map.autoplay
|
$game_map.autoplay
|
||||||
# Frame reset
|
# Frame reset
|
||||||
|
|
|
||||||
|
|
@ -122,15 +122,28 @@ def enable_travel
|
||||||
end
|
end
|
||||||
|
|
||||||
def disable_travel
|
def disable_travel
|
||||||
$game_fasttravel.disabled = true
|
$game_fasttravel.enabled = false
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_zone(zone)
|
def unlock_map(zone, map, dir)
|
||||||
|
# Find the coordinate of the calling event
|
||||||
|
e = $game_map.events.values.find { |e| e.name == 'FAST TRAVEL' }
|
||||||
|
raise 'could not find event named FAST TRAVEL' if !e
|
||||||
|
case dir
|
||||||
|
when :down
|
||||||
|
newdir = 2
|
||||||
|
when :left
|
||||||
|
newdir = 4
|
||||||
|
when :right
|
||||||
|
newdir = 6
|
||||||
|
when :up
|
||||||
|
newdir = 8
|
||||||
|
else
|
||||||
|
raise "invalid direction: #{dir}"
|
||||||
|
end
|
||||||
|
$game_fasttravel.enabled = true
|
||||||
$game_fasttravel.zone = zone
|
$game_fasttravel.zone = zone
|
||||||
end
|
$game_fasttravel.unlock(map, $game_map.map_id, e.x, e.y, newdir)
|
||||||
|
|
||||||
def unlock_map(map)
|
|
||||||
$game_fasttravel.unlock(map)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
|
|
||||||
|
|
@ -97,20 +97,6 @@ class Window_MainMenu < Window_Selectable
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
# Update subwindows
|
|
||||||
#if @item_window.active
|
|
||||||
# @item_window.update
|
|
||||||
# if Input.trigger?(Input::CANCEL)
|
|
||||||
# $game_system.se_play($data_system.cancel_se)
|
|
||||||
# self.active = true
|
|
||||||
# self.opacity = 255
|
|
||||||
# @item_window.visible = false
|
|
||||||
# @item_window.active = false
|
|
||||||
# @item_help_window.visible = false
|
|
||||||
# return
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
|
|
||||||
# Don't do anything if not active
|
# Don't do anything if not active
|
||||||
if !self.active
|
if !self.active
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue