Class: Game_Player
- Inherits:
-
Game_Character
- Object
- Game_Character
- Game_Player
- Defined in:
- scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00465 Game_Player_hole.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00455 Game_Player_bridge.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00405 Game_Player_passable.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00445 Game_Player_follower.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00435 Game_Player_particles.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00430 Game_Player_appearance.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb,
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00410 Game_Player_check_trigger.rb
Overview
Management of the player displacement on the Map
Constant Summary collapse
- CENTER_X =
4 time the x position of the Game_Player sprite
Configs.display.tilemap_settings.center.x
- CENTER_Y =
4 time the y position of the Game_Player sprite
Configs.display.tilemap_settings.center.y
- BUMP_FILE =
Name of the bump sound when the player hit a wall
'audio/se/bump'
- SURF_OFFSET_Y =
[2, 2, 0, 0, 0, -2, -2, 0, 0, 0]
- FALLING_HOLES =
Returns list of falling hole info.
{ 13 => [13, 1, 0] }
- STATE_APPEARANCE_SUFFIX =
Returns List of appearence suffix according to the state.
{ cycling: '_cycle_roll', cycle_stop: '_cycle_stop', roll_to_wheel: '_cycle_roll_to_wheel', wheeling: '_cycle_wheel', fishing: '_fish', surf_fishing: '_surf_fish', saving: '_pokecenter', using_skill: '_pokecenter', giving_pokemon: '_pokecenter', taking_pokemon: '_pokecenter', running: '_run', walking: '_walk', surfing: '_surf', swamp: '_swamp', swamp_running: '_swamp_run', sinking: '_deep_swamp_sinking' }
- STATE_MOVEMENT_INFO =
Returns List of movement speed, movement frequency according to the state.
{ walking: [3, 4], running: [4, 4], wheeling: [4, 4], cycling: [5, 4], surfing: [4, 4] }
- AccroTag =
Tags that are Bike bridge (jumpable on Acro Bike)
[AcroBikeRL, AcroBikeUD]
- NO_BIKE_TILE =
Tags where the Bike cannot pass
[SwampBorder, DeepSwamp, TTallGrass]
- JumpTags =
[JumpL, JumpR, JumpU, JumpD]
- DIVE_TILE =
Tile tha allow to use DIVE
[TSea, TUnderWater]
Constants inherited from Game_Character
Game_Character::EMPTY_MOVE_ROUTE, Game_Character::PARTICLES_METHODS, Game_Character::SAND_PARTICLE_NAME, Game_Character::SHADOW_DISABLED_UPDATE_VALUES, Game_Character::SNOW_PARTICLE_NAME, Game_Character::SlideTags, Game_Character::StairsTag, Game_Character::SurfLTag, Game_Character::SurfTag
Constants included from GameData::SystemTags
GameData::SystemTags::AcroBike, GameData::SystemTags::AcroBikeRL, GameData::SystemTags::AcroBikeUD, GameData::SystemTags::BridgeRL, GameData::SystemTags::BridgeUD, GameData::SystemTags::CrackedSoil, GameData::SystemTags::DeepSwamp, GameData::SystemTags::Empty, GameData::SystemTags::HeadButt, GameData::SystemTags::Hole, GameData::SystemTags::JumpD, GameData::SystemTags::JumpL, GameData::SystemTags::JumpR, GameData::SystemTags::JumpU, GameData::SystemTags::MachBike, GameData::SystemTags::RapidsD, GameData::SystemTags::RapidsL, GameData::SystemTags::RapidsR, GameData::SystemTags::RapidsU, GameData::SystemTags::Road, GameData::SystemTags::RocketD, GameData::SystemTags::RocketL, GameData::SystemTags::RocketR, GameData::SystemTags::RocketRD, GameData::SystemTags::RocketRL, GameData::SystemTags::RocketRR, GameData::SystemTags::RocketRU, GameData::SystemTags::RocketU, GameData::SystemTags::SlopesL, GameData::SystemTags::SlopesR, GameData::SystemTags::StairsD, GameData::SystemTags::StairsL, GameData::SystemTags::StairsR, GameData::SystemTags::StairsU, GameData::SystemTags::SwampBorder, GameData::SystemTags::TCave, GameData::SystemTags::TGrass, GameData::SystemTags::TIce, GameData::SystemTags::TMount, GameData::SystemTags::TPond, GameData::SystemTags::TSand, GameData::SystemTags::TSea, GameData::SystemTags::TSnow, GameData::SystemTags::TTallGrass, GameData::SystemTags::TUnderWater, GameData::SystemTags::TWetSand, GameData::SystemTags::WaterFall, GameData::SystemTags::ZTag
Instance Attribute Summary collapse
-
#acro_appearence ⇒ Boolean
true if the player is on the back wheel of its Acro bike.
-
#charset_base ⇒ String?
readonly
Return the charset_base used to calculate the graphic.
-
#on_acro_bike ⇒ Boolean
Indicate if the player is on acro bike.
-
#update_callback ⇒ Symbol?
readonly
The update_callback.
Attributes inherited from Game_Character
#__bridge, #animation_id, #blend_type, #can_make_footprint, #character_hue, #character_name, #direction, #direction_fix, #follower, #id, #in_swamp, #is_pokemon, #move_route, #move_route_forcing, #move_route_index, #move_speed, #offset_screen_y, #offset_shadow_screen_y, #opacity, #particles_disabled, #path, #pattern, #real_x, #real_y, #reflection_enabled, #shadow_disabled, #sliding, #step_anime, #surfing, #through, #tile_id, #transparent, #x, #y, #z
Instance Method Summary collapse
-
#acro_passable_check(d, result)
Test if the player can pass Bike bridge.
-
#bridge_down_check(z)
(also: #bridge_up_check)
Same as Game_Character but with Acro bike.
-
#bridge_left_check(z)
(also: #bridge_right_check)
Same as Game_Character but with Acro bike.
-
#calibrate_acro_direction(last_dir)
Reset the direction of the player when he's on bike bridge.
-
#center(x, y)
Adjust the map display according to the given position.
-
#change_z_with_follower(value)
Set the player z and all its follower z at the same tile.
-
#chara_by_state ⇒ String
Get the character suffix from the hash.
-
#check_common_event_trigger_there(new_x, new_y, z, d)
Check the common event call.
-
#check_event_trigger_here(triggers) ⇒ Boolean
Check if there's an event trigger on the tile where the player stands.
-
#check_event_trigger_there(triggers) ⇒ Boolean
Check if there's an event trigger in front of the player (when he presses A).
-
#check_event_trigger_touch(x, y)
Check if the player touch an event and start it if so.
-
#check_follower_trigger_there(new_x, new_y) ⇒ Boolean
Check the follower common event call.
-
#cycling? ⇒ Boolean
Test if the player is cycling.
-
#detect_deep_swamp_sinking(last_in_swamp)
Detect if we should trigger the deep_swamp sinking when we detect swamp info.
-
#detect_swamp
Detect the swamp state.
-
#detect_swamp_entering(last_in_swamp)
Detect if we are entering in the swamp, then update the state.
-
#detect_swamp_leaving(last_in_swamp)
Detect if we are leaving the swamp, then update the state.
-
#encounter_count
Returns the number of steps remaining to the next encounter.
-
#enter_in_acro_bike_state
Jump on the acro bike.
-
#enter_in_cycling_state
Jump on the mach bike.
-
#enter_in_fishing_state
Enter in fishing state.
-
#enter_in_giving_pokemon_state
Enter in giving_pokemon state.
-
#enter_in_running_state
Enter in running state (supports the swamp state).
-
#enter_in_saving_state
Enter in saving state.
-
#enter_in_sinking_state
Enter in sinking state.
-
#enter_in_surfing_state
Enter in surfing state.
-
#enter_in_taking_pokemon_state
Enter in taking_pokemon state.
-
#enter_in_using_skill_state
Enter in using_skill state.
-
#enter_in_walking_state ⇒ :walking
Enter in walking state (supports the swamp state).
-
#enter_in_wheel_state
Enter in the wheel state.
-
#event_passable_check?(new_x, new_y, z, game_map) ⇒ Boolean
Check the passage related to events.
- #falling_hole_warp
-
#follower_tail ⇒ Game_Character, self
Return the tail of the following queue (Game_Event exclusive).
-
#increase_steps
Increases a step and displays related things.
-
#initialize ⇒ Game_Player
constructor
Default initializer.
-
#leave_cycling_state
(also: #leave_acro_bike_state)
Leave the cycling state.
-
#leave_fishing_state
Leave fishing state.
-
#leave_sinking_state
Leave sinking state.
-
#leave_surfing_state
Leave the surfing state.
-
#leave_wheel_state
Leave the wheel state.
-
#make_encounter_count
Generate the number of steps remaining to the next encounter.
-
#moveto(x, y)
Warp the player to a specific position.
-
#moveto_system_tag_manage
Manage the system_tag part of the moveto method.
- #particle_push_sand
-
#passable?(x, y, d) ⇒ Boolean
is the tile in front of the player passable ? / Plays a BUMP SE in some conditions.
-
#passage_surf_check?(sys_tag) ⇒ Boolean
Check the surf related passabilities.
-
#player_move
Move the player.
-
#player_move_on_cracked_floor_update
Update the cracked floor when the player move on it.
-
#player_turn(swamp_detect)
Turn the player on himself.
-
#player_update_move
Move or turn the player according to its input.
-
#player_update_move_bump(bool)
Manage the bump part of the player_update_move.
-
#player_update_move_common_events(bool)
Manage the common event calling of player_update_move.
-
#player_update_move_running_state(bool)
Manage the running update of player_update_move inside player_update_move_common_events.
- #process_slope_y_modifier(y_modifier)
-
#refresh
Refresh the player graphics.
-
#reset_follower
Reset the follower stack to prevent any issue.
-
#return_to_previous_state
Return to the correct state.
-
#screen_y ⇒ Integer
Overwrite the screen_y to add the surfing animation.
-
#search_item
Search an invisible item.
-
#set_appearance_set(charset_base)
Change the appearance set for the player.
-
#set_follower(follower, force = false)
Define the follower of the player, if the player already has event following him, it'll put them at the tail of the following events.
-
#update
Update the player movements according to inputs.
-
#update_4_step_animation(factor = 1)
Callback called when we only want the character to show it's 4 pattern (it'll lock the player, use return_to_previous_state to unlock).
-
#update_4_step_animation_to_previous(factor = 1)
Callback called when we only want the character to show it's 4 pattern and return to previous state.
-
#update_acro_bike(count, sys_tag) ⇒ Boolean?
Update the Acro Bike jump info.
-
#update_acro_bike_turn(sys_tag) ⇒ Boolean?
Update the Acro Bike jump info when not moving.
-
#update_appearance(forced_pattern = 0)
Launch the player update appearance.
-
#update_cycling_state
Update the cycling state.
-
#update_enter_fishing_state
Callback called when we are entering in wheel state.
-
#update_enter_sinking_state
Callback called when we are entering in wheel state.
-
#update_enter_wheel_state
Callback called when we are entering in wheel state.
-
#update_giving_pokemon_state
Update the Pokemon giving animation.
-
#update_leave_fishing_state
Callback called when we are leaving in wheel state.
-
#update_leave_sinking_state
Callback called when we are leaving in wheel state.
-
#update_leave_wheel_state
Callback called when we are leaving in wheel state.
-
#update_locked_state
Update the locked state.
-
#update_move_parameter(state)
Update the move_speed & move_frequency parameters.
-
#update_taking_pokemon_state
Update the Pokemon taking animation.
Methods inherited from Game_Character
#activated?, #animate_from_charset, #bush_depth, #cancel_charset_animation, #contact?, #define_path, #each_front_tiles, #each_front_tiles_rect, #emotion, #find_path, #follower_check?, #follower_move, #follower_sliding?, #force_move_route, #front_name_check, #front_system_tag, #front_system_tag_db_symbol, #front_terrain_tag, #front_tile, #front_tile_event, #front_tile_id, #jump, #jump_bridge_check, #jumping?, #lock, #lock?, #look_this_event, #look_to, #movable?, #move_away_from_player, #move_backward, #move_down, #move_follower_to_character, #move_forward, #move_frequency=, #move_left, #move_lower_left, #move_lower_right, #move_random, #move_right, #move_toward, #move_toward_player, #move_type_path, #move_up, #move_upper_left, #move_upper_right, #movement_process_end, #moving?, #next_event_follower, #original_move_speed, #particle_push, #particle_push_grass, #particle_push_pond, #particle_push_snow, #particle_push_tall_grass, #particle_push_wetsand, #passable_bridge_check?, #reset_follower_move, #screen_x, #screen_z, #set_appearance, #set_surfing, #shadow_screen_x, #shadow_screen_y, #sliding?, #slope_check_left, #slope_check_right, #stair_move_left, #stair_move_right, #stop_path, #straighten, #surfing?, #system_tag, #system_tag_db_symbol, #terrain_tag, #turn_180, #turn_away_from_player, #turn_down, #turn_left, #turn_left_90, #turn_random, #turn_right, #turn_right_90, #turn_right_or_left_90, #turn_toward_character, #turn_toward_player, #turn_up, #unlock, #z_bridge_check
Methods included from GameData::SystemTags
Constructor Details
#initialize ⇒ Game_Player
Default initializer
13 14 15 16 17 18 19 20 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 13 def initialize super @wturn = 0 @bump_count = 0 # Used for the Pokemon bump @on_acro_bike = false @acro_count = 0 ## @cant_bump = false end |
Instance Attribute Details
#acro_appearence ⇒ Boolean
true if the player is on the back wheel of its Acro bike
11 12 13 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 11 def acro_appearence @acro_appearence end |
#charset_base ⇒ String? (readonly)
Return the charset_base used to calculate the graphic
3 4 5 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00430 Game_Player_appearance.rb', line 3 def charset_base @charset_base end |
#on_acro_bike ⇒ Boolean
Indicate if the player is on acro bike
4 5 6 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb', line 4 def on_acro_bike @on_acro_bike end |
#update_callback ⇒ Symbol? (readonly)
Returns the update_callback.
30 31 32 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 30 def update_callback @update_callback end |
Instance Method Details
#acro_passable_check(d, result)
Test if the player can pass Bike bridge
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00405 Game_Player_passable.rb', line 35 def acro_passable_check(d, result) on_bike = (@on_acro_bike or $game_switches[::Yuki::Sw::EV_Bicycle]) if @z > 1 and on_bike sys_tag = front_system_tag case d when 4, 6 return true if sys_tag == AcroBikeRL when 8, 2 return true if sys_tag == AcroBikeUD else return true if AccroTag.include?(sys_tag) end return false if @__bridge and AccroTag.include?(@__bridge.first) and !ZTag.include?(sys_tag) @__bridge = nil if result and ZTag.include?(sys_tag) elsif on_bike return false if NO_BIKE_TILE.include?(front_system_tag) end return result end |
#bridge_down_check(z) Also known as: bridge_up_check
Same as Game_Character but with Acro bike
4 5 6 7 8 9 10 11 12 13 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00455 Game_Player_bridge.rb', line 4 def bridge_down_check(z) if z > 1 and !@__bridge if (sys_tag = front_system_tag) == BridgeUD or (sys_tag == AcroBikeUD and (@on_acro_bike or $game_switches[::Yuki::Sw::EV_Bicycle])) @__bridge = [sys_tag, system_tag] end elsif z > 1 and @__bridge @__bridge = nil if @__bridge.last == system_tag and front_system_tag != @__bridge.first end end |
#bridge_left_check(z) Also known as: bridge_right_check
Same as Game_Character but with Acro bike
17 18 19 20 21 22 23 24 25 26 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00455 Game_Player_bridge.rb', line 17 def bridge_left_check(z) if z > 1 and !@__bridge if (sys_tag = front_system_tag) == BridgeRL or (sys_tag == AcroBikeRL and (@on_acro_bike or $game_switches[::Yuki::Sw::EV_Bicycle])) @__bridge = [sys_tag, system_tag] end elsif z > 1 and @__bridge @__bridge = nil if @__bridge.last == system_tag and front_system_tag != @__bridge.first end end |
#calibrate_acro_direction(last_dir)
Reset the direction of the player when he's on bike bridge
82 83 84 85 86 87 88 89 90 91 92 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 82 def calibrate_acro_direction(last_dir) if @__bridge && (sys_tag = @__bridge.first) return if sys_tag != AcroBikeRL && sys_tag != AcroBikeUD end case @direction when 8, 2 @direction = last_dir if sys_tag == AcroBikeRL when 4, 6 @direction = last_dir if sys_tag == AcroBikeUD end end |
#center(x, y)
Adjust the map display according to the given position
25 26 27 28 29 30 31 32 33 34 35 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 25 def center(x, y) if $game_map.maplinker_disabled max_x = ($game_map.width - Game_Map::NUM_TILE_VIEW_X) * 128 max_y = ($game_map.height - Game_Map::NUM_TILE_VIEW_Y) * 128 $game_map.display_x = (x * 128 - CENTER_X).clamp(0, max_x) # [0, [x * 128 - CENTER_X, max_x].min].max $game_map.display_y = (y * 128 - CENTER_Y).clamp(0, max_y) # [0, [y * 128 - CENTER_Y, max_y].min].max else $game_map.display_x = x * 128 - CENTER_X $game_map.display_y = y * 128 - CENTER_Y end end |
#change_z_with_follower(value)
Set the player z and all its follower z at the same tile
43 44 45 46 47 48 49 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00445 Game_Player_follower.rb', line 43 def change_z_with_follower(value) @z = value follower = self while follower = follower.follower follower.z = value end end |
#chara_by_state ⇒ String
Get the character suffix from the hash
19 20 21 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00430 Game_Player_appearance.rb', line 19 def chara_by_state return STATE_APPEARANCE_SUFFIX[@state || enter_in_walking_state] end |
#check_common_event_trigger_there(new_x, new_y, z, d)
Check the common event call
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00410 Game_Player_check_trigger.rb', line 64 def check_common_event_trigger_there(new_x, new_y, z, d) sys_tag = system_tag front_sys_tag = $game_map.system_tag(new_x, new_y) # Dive if terrain_tag == 6 && DIVE_TILE.include?(sys_tag) $game_temp.common_event_id = Game_CommonEvent::DIVE # Headbutt elsif front_sys_tag == HeadButt $game_temp.common_event_id = Game_CommonEvent::HEADBUTT # Surf elsif !@surfing && SurfTag.include?(front_sys_tag) && z <= 1 && $game_map.passable?(x, y, d, nil) if $game_map.passable?(new_x, new_y, 10 - d, self) || Yuki::MapLinker.passable?(new_x, new_y, 10 - d, nil) $game_temp.common_event_id = Game_CommonEvent::SURF_ENTER end end end |
#check_event_trigger_here(triggers) ⇒ Boolean
Check if there's an event trigger on the tile where the player stands
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00410 Game_Player_check_trigger.rb', line 5 def check_event_trigger_here(triggers) return false if $game_system.map_interpreter.running? result = false z = @z $game_map.events.each_value do |event| y_modifier = (@direction == 4 ? slope_check_left(false) : @direction == 6 ? slope_check_right(false) : 0) next unless event.contact?(@x, @y + y_modifier, z) && triggers.include?(event.trigger) next unless !event.jumping? && event.over_trigger? event.start result = true end return result end |
#check_event_trigger_there(triggers) ⇒ Boolean
Check if there's an event trigger in front of the player (when he presses A)
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00410 Game_Player_check_trigger.rb', line 22 def check_event_trigger_there(triggers) return false if $game_system.map_interpreter.running? result = false d = @direction new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0) + (@direction == 4 ? slope_check_left(false) : @direction == 6 ? slope_check_right(false) : 0) z = @z $game_map.events.each_value do |event| next unless event.contact?(new_x, new_y, z) && triggers.include?(event.trigger) next if event.jumping? || event.over_trigger? event.start result = true end z = @z return true if result # Try the event one tile after the front tile if it's a counter tile if $game_map.counter?(new_x, new_y) new_x2 = new_x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y2 = new_y + (d == 2 ? 1 : d == 8 ? -1 : 0) $game_map.events.each_value do |event| next unless event.contact?(new_x2, new_y2, z) && triggers.include?(event.trigger) next if event.jumping? || event.over_trigger? event.start result = true end end return true if result check_common_event_trigger_there(new_x, new_y, z, d) result ||= check_follower_trigger_there(new_x, new_y) if @follower return result end |
#check_event_trigger_touch(x, y)
Check if the player touch an event and start it if so
101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00410 Game_Player_check_trigger.rb', line 101 def check_event_trigger_touch(x, y) return false if $game_system.map_interpreter.running? result = false z = @z $game_map.events.each_value do |event| next unless event.contact?(x, y, z) && [1, 2].include?(event.trigger) next if event.jumping? || event.over_trigger? event.start result = true end return result end |
#check_follower_trigger_there(new_x, new_y) ⇒ Boolean
Check the follower common event call
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00410 Game_Player_check_trigger.rb', line 85 def check_follower_trigger_there(new_x, new_y) if @follower.x == new_x && @follower.y == new_y if @follower.is_a?(Game_Event) @follower.start else @follower.turn_toward_player $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH end return true end return false end |
#cycling? ⇒ Boolean
Test if the player is cycling
150 151 152 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 150 def cycling? @state == :cycling || @state == :cycle_stop || @state == :wheeling end |
#detect_deep_swamp_sinking(last_in_swamp)
Detect if we should trigger the deep_swamp sinking when we detect swamp info
60 61 62 63 64 65 66 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb', line 60 def detect_deep_swamp_sinking(last_in_swamp) if (last_in_swamp == false || last_in_swamp <= 1) && (@in_swamp && @in_swamp > 1) enter_in_sinking_state elsif (last_in_swamp && last_in_swamp > 1) && !(@in_swamp && @in_swamp > 1) leave_sinking_state end end |
#detect_swamp
Detect the swamp state
32 33 34 35 36 37 38 39 40 41 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb', line 32 def detect_swamp last_in_swamp = @in_swamp super if @in_swamp detect_swamp_entering(last_in_swamp) detect_deep_swamp_sinking(last_in_swamp) else detect_swamp_leaving(last_in_swamp) end end |
#detect_swamp_entering(last_in_swamp)
Detect if we are entering in the swamp, then update the state
52 53 54 55 56 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb', line 52 def detect_swamp_entering(last_in_swamp) return unless last_in_swamp return unless @state == :walking || @state == :running @state == :walking ? enter_in_walking_state : enter_in_running_state end |
#detect_swamp_leaving(last_in_swamp)
Detect if we are leaving the swamp, then update the state
45 46 47 48 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb', line 45 def detect_swamp_leaving(last_in_swamp) return unless last_in_swamp @state == :swamp ? enter_in_walking_state : enter_in_running_state end |
#encounter_count
Returns the number of steps remaining to the next encounter
72 73 74 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 72 def encounter_count return @encounter_count end |
#enter_in_acro_bike_state
Jump on the acro bike
122 123 124 125 126 127 128 129 130 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 122 def enter_in_acro_bike_state $game_switches[::Yuki::Sw::EV_Bicycle] = false $game_switches[::Yuki::Sw::EV_AccroBike] = true self.on_acro_bike = true $game_map.need_refresh = true @state = moving? ? :cycling : :cycle_stop update_move_parameter(:wheeling) update_appearance(@pattern) end |
#enter_in_cycling_state
Jump on the mach bike
111 112 113 114 115 116 117 118 119 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 111 def enter_in_cycling_state $game_switches[::Yuki::Sw::EV_Bicycle] = true $game_switches[::Yuki::Sw::EV_AccroBike] = false self.on_acro_bike = false $game_map.need_refresh = true @state = moving? ? :cycling : :cycle_stop update_move_parameter(:cycling) update_appearance(@pattern) end |
#enter_in_fishing_state
Enter in fishing state
155 156 157 158 159 160 161 162 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 155 def enter_in_fishing_state @offset_screen_y = 8 unless @surfing leave_cycling_state if cycling? @state = @surfing ? :surf_fishing : :fishing @update_callback = :update_enter_fishing_state @update_callback_count = 0 update_appearance(0) end |
#enter_in_giving_pokemon_state
Enter in giving_pokemon state
260 261 262 263 264 265 266 267 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 260 def enter_in_giving_pokemon_state @state = :giving_pokemon @update_callback = :update_giving_pokemon_state @update_callback_count = 0 @prelock_direction = @direction @direction = 2 update_appearance(0) end |
#enter_in_running_state
Enter in running state (supports the swamp state)
51 52 53 54 55 56 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 51 def enter_in_running_state $game_switches[::Yuki::Sw::EV_Run] = true @state = @in_swamp ? :swamp_running : :running update_move_parameter(:running) update_appearance(@pattern) end |
#enter_in_saving_state
Enter in saving state
240 241 242 243 244 245 246 247 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 240 def enter_in_saving_state @state = :saving @update_callback = :update_4_step_animation @update_callback_count = 0 @prelock_direction = @direction @direction = 8 update_appearance(0) end |
#enter_in_sinking_state
Enter in sinking state
194 195 196 197 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 194 def enter_in_sinking_state @update_callback = :update_enter_sinking_state @update_callback_count = 0 end |
#enter_in_surfing_state
Enter in surfing state
59 60 61 62 63 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 59 def enter_in_surfing_state @state = :surfing update_move_parameter(:surfing) update_appearance(@pattern) end |
#enter_in_taking_pokemon_state
Enter in taking_pokemon state
283 284 285 286 287 288 289 290 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 283 def enter_in_taking_pokemon_state @state = :taking_pokemon @update_callback = :update_taking_pokemon_state @update_callback_count = 0 @prelock_direction = @direction @direction = 4 update_appearance(3) end |
#enter_in_using_skill_state
Enter in using_skill state
250 251 252 253 254 255 256 257 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 250 def enter_in_using_skill_state @state = :using_skill @update_callback = :update_4_step_animation @update_callback_count = 0 @prelock_direction = @direction @direction = 6 update_appearance(0) end |
#enter_in_walking_state ⇒ :walking
Enter in walking state (supports the swamp state)
42 43 44 45 46 47 48 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 42 def enter_in_walking_state $game_switches[Yuki::Sw::EV_Run] = false if $game_switches @state = @in_swamp ? :swamp : :walking update_move_parameter(:walking) update_appearance(@pattern) return @state end |
#enter_in_wheel_state
Enter in the wheel state
73 74 75 76 77 78 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 73 def enter_in_wheel_state @update_callback = :update_enter_wheel_state @update_callback_count = 0 @state = :roll_to_wheel update_appearance(0) end |
#event_passable_check?(new_x, new_y, z, game_map) ⇒ Boolean
Check the passage related to events
91 92 93 94 95 96 97 98 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00405 Game_Player_passable.rb', line 91 def event_passable_check?(new_x, new_y, z, game_map) game_map.events.each_value do |event| next unless event.contact?(new_x, new_y, z) next if event.through return false unless event.character_name.empty? end return true end |
#falling_hole_warp
7 8 9 10 11 12 13 14 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00465 Game_Player_hole.rb', line 7 def falling_hole_warp return unless (hole_data = FALLING_HOLES[$game_map.map_id]) $game_temp.player_transferring = true $game_temp.player_new_map_id = hole_data[0] $game_temp.player_new_x = @x + hole_data[1] $game_temp.player_new_y = @y + hole_data[2] $game_temp.player_new_direction = @direction end |
#follower_tail ⇒ Game_Character, self
Return the tail of the following queue (Game_Event exclusive)
4 5 6 7 8 9 10 11 12 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00445 Game_Player_follower.rb', line 4 def follower_tail return self unless (current_follower = @follower) return self unless current_follower.is_a?(Game_Event) while (next_follower = current_follower.follower) break unless next_follower.is_a?(Game_Event) current_follower = next_follower end return current_follower end |
#increase_steps
Increases a step and displays related things
63 64 65 66 67 68 69 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 63 def increase_steps super unless @move_route_forcing || $game_system.map_interpreter.running? || $game_temp. || @sliding PFM.game_state.increase_steps end end |
#leave_cycling_state Also known as: leave_acro_bike_state
Leave the cycling state
133 134 135 136 137 138 139 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 133 def leave_cycling_state $game_switches[::Yuki::Sw::EV_Bicycle] = false $game_switches[::Yuki::Sw::EV_AccroBike] = false self.on_acro_bike = false $game_map.need_refresh = true enter_in_walking_state end |
#leave_fishing_state
Leave fishing state
174 175 176 177 178 179 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 174 def leave_fishing_state @state = @surfing ? :surf_fishing : :fishing @update_callback = :update_leave_fishing_state @update_callback_count = 0 update_appearance(3) end |
#leave_sinking_state
Leave sinking state
221 222 223 224 225 226 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 221 def leave_sinking_state @state = :sinking @update_callback = :update_leave_sinking_state @update_callback_count = 0 update_appearance(0) end |
#leave_surfing_state
Leave the surfing state
66 67 68 69 70 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 66 def leave_surfing_state change_shadow_disabled_state(false) @surfing = false return_to_previous_state end |
#leave_wheel_state
Leave the wheel state
92 93 94 95 96 97 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 92 def leave_wheel_state @update_callback = :update_leave_wheel_state @update_callback_count = 0 @state = :roll_to_wheel update_appearance(3) end |
#make_encounter_count
Generate the number of steps remaining to the next encounter
77 78 79 80 81 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 77 def make_encounter_count return if $game_map.map_id == 0 n = $game_map.encounter_step @encounter_count = rand(n) + rand(n) + 1 end |
#moveto(x, y)
Warp the player to a specific position. The map display will be centered
40 41 42 43 44 45 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 40 def moveto(x, y) super center(x, y) make_encounter_count @reflection_enabled = true if @reflection_enabled.nil? end |
#moveto_system_tag_manage
Manage the system_tag part of the moveto method
48 49 50 51 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 48 def moveto_system_tag_manage # We remove the bridge z processing because it's breaking return super(true) end |
#particle_push_sand
2 3 4 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00435 Game_Player_particles.rb', line 2 def particle_push_sand super unless cycling? end |
#passable?(x, y, d) ⇒ Boolean
is the tile in front of the player passable ? / Plays a BUMP SE in some conditions
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00405 Game_Player_passable.rb', line 7 def passable?(x, y, d) return true if debug? && Input::Keyboard.press?(Input::Keyboard::LControl) # or Yuki::SystemTag.running? new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0) return maplinker_passable?(new_x, new_y) unless $game_map.valid?(new_x, new_y) result = super #> Check passable avec acro bike result = acro_passable_check(d, result) =begin #Lignes pour faire le bump à la Pokémon, faut les conserver !!! if(!result and @bump_count < 1 and $game_temp.common_event_id == 0) # #Audio.se_play(BUMP_FILE) puts "bmp" @bump_count = 30 @step_anime = true if @lastdir4 != 0 and !@surfing and !@sliding end =end return result end |
#passage_surf_check?(sys_tag) ⇒ Boolean
Check the surf related passabilities
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00405 Game_Player_passable.rb', line 58 def passage_surf_check?(sys_tag) if !@surfing && SurfTag.include?(sys_tag) if $game_switches[Yuki::Sw::NoSurfContact] event = front_tile_event return false unless event&.through || event&.character_name&.empty? $game_temp.common_event_id = Game_CommonEvent::SURF_ENTER end return false elsif @surfing unless SurfLTag.include?(sys_tag) # unless $game_switches[Yuki::Sw::NoSurfContact] event = front_tile_event return false if event && !event.through && !event.character_name.empty? change_shadow_disabled_state(false) @surfing = false $game_temp.common_event_id = Game_CommonEvent::SURF_LEAVE # end return false end if sys_tag == WaterFall $game_temp.common_event_id = Game_CommonEvent::WATERFALL return false end end return true end |
#player_move
Move the player. Does some calibration for the Acro Bike.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 52 def player_move #> gestion du vélo cross jumping = false jumping_dist = 1 if @acro_bike_bunny_hop return if (jumping = update_acro_bike(5, front_system_tag)) == false jumping_dist = 2 if JumpTags.include?(front_system_tag) end last_dir = @direction case @lastdir4 when 2 jumping ? jump(0, jumping_dist) : move_down when 4 turn_left jumping ? jump(-jumping_dist, 0) : move_left when 6 turn_right jumping ? jump(jumping_dist, 0) : move_right when 8 jumping ? jump(0, -jumping_dist) : move_up #else #@cant_bump=true end calibrate_acro_direction(last_dir) update_cycling_state if @state == :cycle_stop && moving? end |
#player_move_on_cracked_floor_update
Update the cracked floor when the player move on it
223 224 225 226 227 228 229 230 231 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 223 def player_move_on_cracked_floor_update if (sys_tag = system_tag) == CrackedSoil $game_map.data[@x, @y, 0] = $game_map.data[@x, @y, 0] + 1 # The player falls if it has not the right speed and it's now a hole $game_temp.common_event_id = Game_CommonEvent::HOLE_FALLING if system_tag == Hole && @move_speed < 5 elsif sys_tag == Hole $game_temp.common_event_id = Game_CommonEvent::HOLE_FALLING end end |
#player_turn(swamp_detect)
Turn the player on himself. Does some calibration for the Acro Bike.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 26 def player_turn(swamp_detect) if swamp_detect && @lastdir4 != @direction && @lastdir4 != 0 @in_swamp -= 1 end last_dir = @direction case @lastdir4 when 2 turn_down when 4 turn_left when 6 turn_right when 8 turn_up else if system_tag == Hole $game_temp.common_event_id = Game_CommonEvent::HOLE_FALLING elsif @on_acro_bike update_acro_bike_turn(system_tag) end end calibrate_acro_direction(last_dir) end |
#player_update_move
Move or turn the player according to its input. The common event 2 can be triggered there
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 6 def player_update_move # mouse_input = Input.kpress?(1) # Turn on itself system @wturn = 10 - @move_speed if @lastdir4 == 0 && !(Input.repeat?(:UP) || Input.repeat?(:DOWN) || Input.repeat?(:LEFT) || Input.repeat?(:RIGHT)) @lastdir4 = Input.dir4 # (mouse_input ? mouse_dir4 : Input.dir4) swamp_detect = (@in_swamp and @in_swamp > 4) if bool = ((@wturn > 0) | swamp_detect) player_turn(swamp_detect) else player_move end player_update_move_bump(bool) player_update_move_common_events(bool) end |
#player_update_move_bump(bool)
Manage the bump part of the player_update_move
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 137 def player_update_move_bump(bool) unless moving? unless $game_temp.common_event_id != 0 or @surfing or @sliding if @last_x == @x and @last_y == @y if @lastdir4 != 0 and !bool @step_anime = true if (@old_pattern == 3 and @pattern == 0) or (@old_pattern == 1 and @pattern == 2) Audio.se_play(BUMP_FILE) end else @step_anime = false end else @last_x = @x @last_y = @y end else if @surfing if @last_x == @x and @last_y == @y if @lastdir4 != 0 and !bool if (@old_pattern == 3 and @pattern == 0) or (@old_pattern == 1 and @pattern == 2) Audio.se_play(BUMP_FILE) end end else @last_x = @x @last_y = @y end end end else @step_anime = false unless @surfing end @old_pattern = @pattern # _BUMP # Lines for the Pokemon like bump =begin if(@bump_count>0) @bump_count -= 1 unless @surfing or @sliding if @on_acro_bike or $game_switches[::Yuki::Sw::EV_Bicycle] @step_anime = false else @step_anime = !(@bump_count==0 or @lastdir4==0) end if @step_anime if (@old_pattern == 0 and @pattern == 1) or (@old_pattern == 2 and @pattern == 3) Audio.se_play(BUMP_FILE) end end @old_pattern = @pattern end end =end end |
#player_update_move_common_events(bool)
Manage the common event calling of player_update_move
195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 195 def player_update_move_common_events(bool) if @on_acro_bike if !@acro_appearence && Input.press?(:B) @acro_appearence = true enter_in_wheel_state # $game_temp.common_event_id = Game_CommonEvent::APPEARANCE elsif @acro_appearence && !Input.press?(:B) && !jumping? &&!@acro_bike_bunny_hop @acro_appearence = false leave_wheel_state # $game_temp.common_event_id = Game_CommonEvent::APPEARANCE end else player_update_move_running_state(bool) unless @surfing || cycling? end end |
#player_update_move_running_state(bool)
Manage the running update of player_update_move inside player_update_move_common_events
211 212 213 214 215 216 217 218 219 220 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 211 def player_update_move_running_state(bool) # Make the player run if !bool && @lastdir4 != 0 && $game_switches[::Yuki::Sw::EV_CanRun] && !$game_switches[::Yuki::Sw::EV_Run] && Input.press?(:B) && !@step_anime # Test avec bump enter_in_running_state unless @state == :sinking # $game_temp.common_event_id = Game_CommonEvent::APPEARANCE # Stop to run elsif $game_switches[::Yuki::Sw::EV_Run] && (@lastdir4 == 0 || !Input.press?(:B) || $game_system.map_interpreter.running? || @step_anime) enter_in_walking_state unless @state == :sinking # $game_temp.common_event_id = Game_CommonEvent::APPEARANCE end end |
#process_slope_y_modifier(y_modifier)
123 124 125 126 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 123 def process_slope_y_modifier(y_modifier) super(y_modifier) $game_map.start_scroll(y_modifier < 0 ? 8 : 2, 1, 4, false, true) end |
#refresh
Refresh the player graphics
84 85 86 87 88 89 90 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 84 def refresh return set_appearance(nil.to_s) if $game_party.actors.empty? actor = $game_party.actors[0] set_appearance(actor.character_name, actor.character_hue) @opacity = 255 @blend_type = 0 end |
#reset_follower
Reset the follower stack to prevent any issue
31 32 33 34 35 36 37 38 39 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00445 Game_Player_follower.rb', line 31 def reset_follower return unless (current_follower = @follower) while (next_follower = current_follower.follower) current_follower.set_follower(nil) current_follower = next_follower end @follower = nil end |
#return_to_previous_state
Return to the correct state
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 327 def return_to_previous_state @update_callback = nil @direction = @prelock_direction if @prelock_direction > 0 @prelock_direction = 0 @pattern = 0 if @surfing enter_in_surfing_state elsif $game_switches[::Yuki::Sw::EV_Bicycle] enter_in_cycling_state elsif $game_switches[::Yuki::Sw::EV_AccroBike] enter_in_acro_bike_state else enter_in_walking_state end end |
#screen_y ⇒ Integer
Overwrite the screen_y to add the surfing animation
56 57 58 59 60 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 56 def screen_y value = super return value unless surfing? return value + SURF_OFFSET_Y[Graphics.frame_count / 6 % SURF_OFFSET_Y.size] end |
#search_item
Search an invisible item
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00450 Game_Player_Ext.rb', line 14 def search_item $game_map.events.each do |event_id, event| if event.invisible_event dx = (event.x - @x).abs dy = (event.y - @y).abs if dx <= 10 and dy <= 7 Audio.se_play("audio/se/nintendo") $game_player = event turn_toward_player $game_player = self return true end end end return false end |
#set_appearance_set(charset_base)
Change the appearance set for the player. The argument is the base of the charset name. For exemple : for the file “HeroRed001_M_walk”, the charset base will be “HeroRed001”
27 28 29 30 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00430 Game_Player_appearance.rb', line 27 def set_appearance_set(charset_base) @charset_base = charset_base update_appearance end |
#set_follower(follower, force = false)
Define the follower of the player, if the player already has event following him, it'll put them at the tail of the following events
18 19 20 21 22 23 24 25 26 27 28 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00445 Game_Player_follower.rb', line 18 def set_follower(follower, force = false) return @follower = follower if force return reset_follower unless follower return if @follower == follower return @follower = follower unless @follower # If the instance_variable is a game event we put the event at the end of the queue return follower_tail.set_follower(follower) if @follower.is_a?(Game_Event) # If the follower wasn't Game_Event but the current one is follower.set_follower(@follower) if follower.is_a?(Game_Event) @follower = follower end |
#update
Update the player movements according to inputs
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00400 Game_Player.rb', line 93 def update return send(@update_callback) if @update_callback last_moving = moving? if moving? || $game_system.map_interpreter.running? || @move_route_forcing || $game_temp. || @sliding # or follower_sliding? if $game_system.map_interpreter.running? @step_anime = false enter_in_walking_state if @state == :running end else player_update_move player_move_on_cracked_floor_update if moving? && !last_moving end @wturn -= 1 if @wturn > 0 last_real_x = @real_x last_real_y = @real_y super # _BUMP =begin if(@cant_bump and moving?) @cant_bump=false end =end update_scroll_map(last_real_x, last_real_y) update_check_trigger(last_moving) unless moving? || @sliding end |
#update_4_step_animation(factor = 1)
Callback called when we only want the character to show it's 4 pattern (it'll lock the player, use return_to_previous_state to unlock)
307 308 309 310 311 312 313 314 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 307 def update_4_step_animation(factor = 1) @update_callback_count += 1 return unless (@update_callback_count % 12) == 0 @pattern += factor return unless @pattern > 3 || @pattern < 0 @update_callback = :update_locked_state @pattern = @pattern > 3 ? 3 : 0 end |
#update_4_step_animation_to_previous(factor = 1)
Callback called when we only want the character to show it's 4 pattern and return to previous state
318 319 320 321 322 323 324 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 318 def update_4_step_animation_to_previous(factor = 1) @update_callback_count += 1 return unless (@update_callback_count % 12) == 0 @pattern += factor return unless @pattern > 3 || @pattern < 0 return_to_previous_state end |
#update_acro_bike(count, sys_tag) ⇒ Boolean?
Update the Acro Bike jump info
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 99 def update_acro_bike(count, sys_tag) return false if jumping? if SlideTags.include?(sys_tag) or sys_tag == MachBike return nil end if @wturn == 0 && !$game_map.jump_passable?(@x, @y, @lastdir4) return nil if system_tag != AcroBike && !@__bridge end if @acro_count < count @acro_count += 1 return false end @acro_count = 0 return true end |
#update_acro_bike_turn(sys_tag) ⇒ Boolean?
Update the Acro Bike jump info when not moving
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00420 Game_Player_update_move.rb', line 120 def update_acro_bike_turn(sys_tag) if sys_tag == AcroBike if update_acro_bike(5, sys_tag) jump(0,0) end elsif Input.press?(:B) if update_acro_bike((@acro_bike_bunny_hop ? 5 : 35), sys_tag) jump(0,0) @acro_bike_bunny_hop = true end elsif !Input.press?(:B) @acro_bike_bunny_hop = false end end |
#update_appearance(forced_pattern = 0)
Launch the player update appearance
7 8 9 10 11 12 13 14 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00430 Game_Player_appearance.rb', line 7 def update_appearance(forced_pattern = 0) return unless @charset_base set_appearance("#{@charset_base}_#{$game_switches[Yuki::Sw::Gender] ? 'f' : 'm'}#{chara_by_state}") @pattern = forced_pattern update_pattern_state return true end |
#update_cycling_state
Update the cycling state
143 144 145 146 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 143 def update_cycling_state @state = moving? ? :cycling : :cycle_stop update_appearance(@pattern) end |
#update_enter_fishing_state
Callback called when we are entering in wheel state
165 166 167 168 169 170 171 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 165 def update_enter_fishing_state @update_callback_count += 1 return unless (@update_callback_count % 6) == 0 @pattern += 1 return unless @pattern > 2 @update_callback = :update_locked_state end |
#update_enter_sinking_state
Callback called when we are entering in wheel state
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 200 def update_enter_sinking_state if moving? last_real_x = @real_x last_real_y = @real_y update_move update_scroll_map(last_real_x, last_real_y) return update_pattern end unless @state == :sinking @state = :sinking update_appearance(3) end @update_callback_count += 1 return unless (@update_callback_count % 6) == 0 @pattern -= 1 return unless @pattern < 0 @update_callback = nil update_appearance(0) end |
#update_enter_wheel_state
Callback called when we are entering in wheel state
81 82 83 84 85 86 87 88 89 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 81 def update_enter_wheel_state @update_callback_count += 1 return unless (@update_callback_count % 6) == 0 @pattern += 1 return unless @pattern > 3 @state = :wheeling @update_callback = nil update_appearance(0) end |
#update_giving_pokemon_state
Update the Pokemon giving animation
270 271 272 273 274 275 276 277 278 279 280 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 270 def update_giving_pokemon_state if @direction == 2 update_4_step_animation if @update_callback == :update_locked_state @direction = 4 @update_callback = :update_giving_pokemon_state end return end update_4_step_animation_to_previous end |
#update_leave_fishing_state
Callback called when we are leaving in wheel state
182 183 184 185 186 187 188 189 190 191 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 182 def update_leave_fishing_state @update_callback_count += 1 return unless (@update_callback_count % 6) == 0 @pattern -= 1 return unless @pattern < 0 @state = @surfing ? :surfing : :walking @update_callback = nil @offset_screen_y = nil update_appearance(0) end |
#update_leave_sinking_state
Callback called when we are leaving in wheel state
229 230 231 232 233 234 235 236 237 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 229 def update_leave_sinking_state @update_callback_count += 1 return unless (@update_callback_count % 6) == 0 @pattern += 1 return unless @pattern > 3 @update_callback = nil @pattern = 3 enter_in_walking_state end |
#update_leave_wheel_state
Callback called when we are leaving in wheel state
100 101 102 103 104 105 106 107 108 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 100 def update_leave_wheel_state @update_callback_count += 1 return unless (@update_callback_count % 6) == 0 @pattern -= 1 return unless @pattern < 0 @state = :cycling @update_callback = nil update_appearance(0) end |
#update_locked_state
Update the locked state
344 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 344 def update_locked_state() end |
#update_move_parameter(state)
Update the move_speed & move_frequency parameters
34 35 36 37 38 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 34 def update_move_parameter(state) @move_speed, @move_frequency = STATE_MOVEMENT_INFO[state] # Make sure event gets the same speed as the player even if there is pokemons between them next_event_follower&.move_speed = @move_speed end |
#update_taking_pokemon_state
Update the Pokemon taking animation
293 294 295 296 297 298 299 300 301 302 303 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00460 Game_Player_state.rb', line 293 def update_taking_pokemon_state if @direction == 4 update_4_step_animation(-1) if @update_callback == :update_locked_state @direction = 2 @update_callback = :update_taking_pokemon_state end return end update_4_step_animation_to_previous(-1) end |