Class: Game_Character

Inherits:
Object show all
Includes:
GameData::SystemTags
Defined in:
scripts/00650 MapSystem/00100 Game_Character_1.rb,
scripts/00650 MapSystem/00110 Game_Character_2.rb,
scripts/00650 MapSystem/00150 Game_Character_Ext.rb,
scripts/00650 MapSystem/00120 Game_Character_move.rb,
scripts/00650 MapSystem/00125 Game_Character_turn.rb,
scripts/00650 MapSystem/00140 Game_Character_state.rb,
scripts/00650 MapSystem/00155 Game_Character_bridge.rb,
scripts/00650 MapSystem/00105 Game_Character_passable.rb,
scripts/00650 MapSystem/00145 Game_Character_follower.rb,
scripts/00650 MapSystem/00160 Game_Character_particles.rb,
scripts/00650 MapSystem/00130 Game_Character_appearance.rb,
scripts/00650 MapSystem/00170 Game_Character_pathfinding.rb

Overview

Class that describe and manipulate a Character (Player/Events)

Direct Known Subclasses

Game_Event, Game_Player

Constant Summary collapse

StairsTag =

Array of SystemTag that define stairs

[StairsL, StairsD, StairsU, StairsR]
SlideTags =

SystemTags that triggers “sliding” state

[TIce, RapidsL, RapidsR, RapidsU, RapidsD]
SurfTag =

SystemTags that trigger Surfing

[TPond, TSea]
SurfLTag =

SystemTags that does not trigger leaving water

SurfTag + [BridgeUD, BridgeRL, RapidsL, RapidsR, RapidsU, RapidsD, AcroBikeRL, AcroBikeUD, WaterFall,
JumpD, JumpL, JumpR, JumpU]
PARTICLES_METHODS =

Constant defining all the particle method to call

{
TGrass => :particle_push_grass,
TTallGrass => :particle_push_tall_grass,
TSand => :particle_push_sand,
TSnow => :particle_push_snow,
TPond => :particle_push_pond,
TWetSand => :particle_push_wetsand
}
SAND_PARTICLE_NAME =

Constant telling the sand particle name to push (according to the direction)

{ 2 => :sand_d, 4 => :sand_l, 6 => :sand_r, 8 => :sand_u }
SNOW_PARTICLE_NAME =

Constant telling the snow particle name to push (according to the direction)

{ 2 => :snow_d, 4 => :snow_l, 6 => :snow_r, 8 => :snow_u }
SHADOW_DISABLED_UPDATE_VALUES =

Values that allows the shadow_disabled update in set_appearance

[false, true, nil]
EMPTY_MOVE_ROUTE =
RPG::MoveRoute.new

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::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

Instance Method Summary collapse

Methods included from GameData::SystemTags

gen

Constructor Details

#initializeGame_Character

Default initializer

Instance Attribute Details

#__bridge

The bridge state

#animation_idInteger

Returns ID of the animation to play on the character.

Returns:

  • (Integer)

    ID of the animation to play on the character

#blend_typeInteger (readonly)

Returns blending of the event (0 is the only one that actually works).

Returns:

  • (Integer)

    blending of the event (0 is the only one that actually works)

#can_make_footprintBoolean

Returns tell if the character can make footprint on the ground or not.

Returns:

  • (Boolean)

    tell if the character can make footprint on the ground or not

#character_hueIntger

Returns must be 0.

Returns:

  • (Intger)

    must be 0

#character_nameString

Returns name of the character graphic used to display the event.

Returns:

  • (String)

    name of the character graphic used to display the event

#directionInteger

Returns direction where the event is looking (2 = down, 6 = right, 4 = left, 8 = up).

Returns:

  • (Integer)

    direction where the event is looking (2 = down, 6 = right, 4 = left, 8 = up)

#direction_fixBoolean (readonly)

If the direction is fixed

Returns:

  • (Boolean)

#followerGame_Character? (readonly)

Returns the follower.

Returns:

#idInteger (readonly)

Id of the event in the map

Returns:

#in_swampInteger, false

Returns if the character is in swamp tile and the power of the swamp tile.

Returns:

  • (Integer, false)

    if the character is in swamp tile and the power of the swamp tile

#is_pokemonBoolean

Returns if the character is a Pokemon (affect the step anime).

Returns:

  • (Boolean)

    if the character is a Pokemon (affect the step anime)

#move_route (readonly)

The current move route

#move_route_forcingBoolean (readonly)

Returns if the character is forced to move using a specific route.

Returns:

  • (Boolean)

    if the character is forced to move using a specific route

#move_route_index (readonly)

The current move route index

#move_speedInteger

Dynamic move_speed value of the Game_Character, return a different value than @move_speed

Returns:

  • (Integer)

    the dynamic move_speed

Author:

  • Nuri Yuri

#offset_screen_yInteger?

Returns offset y of the character on the screen.

Returns:

  • (Integer, nil)

    offset y of the character on the screen

#offset_shadow_screen_yInteger?

Returns offset y of the character on the screen.

Returns:

  • (Integer, nil)

    offset y of the character on the screen

#opacityInteger

Returns opacity of the event when it's shown.

Returns:

  • (Integer)

    opacity of the event when it's shown

#particles_disabledBoolean

Returns if the particles are disabled for the Character.

Returns:

  • (Boolean)

    if the particles are disabled for the Character

#pathArray<RPG::MoveCommand>, ...

The current path

Returns:

  • (Array<RPG::MoveCommand>, :pending, nil)

#patternInteger (readonly)

Returns current pattern of the character graphic shown.

Returns:

  • (Integer)

    current pattern of the character graphic shown

#real_xInteger (readonly)

Returns “real” X position of the event, usually x * 128.

Returns:

  • (Integer)

    “real” X position of the event, usually x * 128

#real_yInteger (readonly)

Returns “real” Y position of the event, usually y * 128.

Returns:

  • (Integer)

    “real” Y position of the event, usually y * 128

#shadow_disabledBoolean

Returns if the shadow should be shown or not.

Returns:

  • (Boolean)

    if the shadow should be shown or not

#sliding

The current sliding state

#step_animeBoolean

Returns if the event has a patern animation while staying.

Returns:

  • (Boolean)

    if the event has a patern animation while staying

#surfing=(value) (writeonly)

The current surfing state

#throughBoolean

Returns if the character is traversable and it can walk through any tiles.

Returns:

  • (Boolean)

    if the character is traversable and it can walk through any tiles

#tile_idInteger (readonly)

Returns ID of the tile shown as the event (0 = no tile).

Returns:

  • (Integer)

    ID of the tile shown as the event (0 = no tile)

#transparentBoolean

Returns if the event is invisible.

Returns:

  • (Boolean)

    if the event is invisible

#xInteger

Returns X position of the event in the current map.

Returns:

  • (Integer)

    X position of the event in the current map

#yInteger

Returns Y position of the event in the current map.

Returns:

  • (Integer)

    Y position of the event in the current map

#zInteger

Returns Z priority of the event.

Returns:

  • (Integer)

    Z priority of the event

Instance Method Details

#activated?Boolean

Check if the character is activate. Useful to make difference between event without active page and others.

Returns:

  • (Boolean)

#animate_from_charset(lines, duration, reverse: false, repeat: false) ⇒ Boolean

Set the charset animation. It can be needed to set the event in direction fixed.

Parameters:

  • lines (Array<Integer>)

    list of the lines to animates (0,1,2,3)

  • duration (Integer)

    duration of the animation in frame (30 frames per secondes)

  • reverse (Boolean) (defaults to: false)

    <default: false> set it to true if the animation is reversed

  • repeat (Boolean) (defaults to: false)

    <default: false> set it to true if the animation is looped

Returns:

  • (Boolean)

#bridge_down_check(z) Also known as: bridge_up_check

Adjust the Character informations related to the brige when it moves down (or up)

Parameters:

Author:

  • Nuri Yuri

#bridge_left_check(z) Also known as: bridge_right_check

Adjust the Character informations related to the brige when it moves left (or right)

Parameters:

Author:

  • Nuri Yuri

#bush_depthInteger

bush_depth of the sprite of the character

Returns:

#cancel_charset_animation

Cancel the charset animation

#check_event_trigger_touch(*args)

Define the function check_event_trigger_touch to prevent bugs

#contact?(x, y, z) ⇒ Boolean

Check if it's possible to have contact interaction with this Game_Character at certain coordinates

Parameters:

Returns:

  • (Boolean)

Author:

  • Nuri Yuri

#define_path(path)

Define the path from path_finding

Parameters:

  • path (Array<RPG::MoveCommand>)

#detect_swamp

Detect if the event walks in a swamp or a deep swamp and change the Game_Character states.

Author:

  • Nuri Yuri

#emotion(type, wait = 34, params = {})

Show an emotion to an event or the player

Parameters:

  • type (Symbol)

    the type of emotion (see wiki)

  • wait (Integer) (defaults to: 34)

    the number of frame the event will wait after this command.

  • params (Hash) (defaults to: {})

    particle params

#event_passable_check?(new_x, new_y, z, game_map) ⇒ Boolean

Check the passage related to events

Parameters:

Returns:

  • (Boolean)

    if the tile has no event that block the way

#find_path(to:, radius: 0, tries: Pathfinding::TRY_COUNT, type: nil, tags: :DEFAULT)

Request a path to the target and follow it as soon as it found

#follower_check?(new_x, new_y, z) ⇒ Boolean

Check the passage related to events

Parameters:

  • new_x (Integer)

    new x position

  • new_y (Integer)

    new y position

  • z (Integer)

    current z position

Returns:

  • (Boolean)

    if the tile has no event that block the way

#follower_move

Move a follower

Author:

  • Nuri Yuri

#follower_sliding?Boolean

Check if the follower slides

Returns:

  • (Boolean)

Author:

  • Nuri Yuri

#follower_tailGame_Character, self

Return the tail of the following queue

Returns:

#force_move_route(move_route)

Force the character to adopt a move route and save the original one

Parameters:

  • move_route (RPG::MoveRoute)

#front_name_check(name) ⇒ Boolean Also known as: front_name_detect

Check a the #front_event has a specific name

Returns:

  • (Boolean)

Author:

  • Nuri Yuri

#front_system_tagInteger

Return the SystemTag in the front of the Game_Character

Returns:

  • (Integer)

    ID of the SystemTag

Author:

  • Nuri Yuri

#front_tileArray(Integer, Integer)

Return tile position in front of the player

Returns:

#front_tile_eventGame_Event?

Return the event that stand in the front of the Player

Returns:

#front_tile_idInteger, 0

Return the id of the #front_tile_event

Returns:

  • (Integer, 0)

    0 if no front_tile_event

Author:

  • Nuri Yuri

#increase_steps

Increase step prototype (sets @stop_count to 0)

#jump(x_plus, y_plus, follow_move = true) ⇒ Boolean

Make the Game_Character jump

Parameters:

  • x_plus (Integer)

    the number of tile the Game_Character will jump on x

  • y_plus (Integer)

    the number of tile the Game_Character will jump on y

  • follow_move (Boolean) (defaults to: true)

    if the follower moves when the Game_Character starts jumping

Returns:

  • (Boolean)

    if the character is jumping

#jump_bridge_check(x_plus, y_plus)

Perform the bridge check for the jump operation

Parameters:

  • x_plus (Integer)

    the number of tile the Game_Character will jump on x

  • y_plus (Integer)

    the number of tile the Game_Character will jump on y

#jumping?Boolean

is the character jumping ?

Returns:

  • (Boolean)

#lock

Make the character look the player during a dialog

#lock?Boolean

Note:

in this state, the character is not able to perform automatic moveroute (rmxp conf)

Is the character locked ? (looking to the player when it's activated)

Returns:

  • (Boolean)

#look_to(event_id)

Look directly to a specific event

Parameters:

  • event_id (Integer)

    id of the event on the Map

Author:

  • Nuri Yuri

#movable?Boolean

Is the character able to execute a move action

Returns:

  • (Boolean)

#move_away_from_player

Move the Game_Character away from the player

#move_backward

Move the Game_Character backward

#move_down(turn_enabled = true)

Move Game_Character down

Parameters:

  • turn_enabled (Boolean) (defaults to: true)

    if the Game_Character turns when impossible move

#move_follower_to_character

Warp the follower to the event it follows

Author:

  • Nuri Yuri

#move_forward

Move the Game_Character forward

#move_frequency=(value)

Set the move_frequency (and define the max_stop_count value)

Parameters:

  • value (Numeric)

#move_left(turn_enabled = true)

Move Game_Character left

Parameters:

  • turn_enabled (Boolean) (defaults to: true)

    if the Game_Character turns when impossible move

#move_lower_left

Move the Game_Character lower left

#move_lower_right

Move the Game_Character lower right

#move_random

Move the Game_Character to a random direction

#move_right(turn_enabled = true)

Move Game_Character right

Parameters:

  • turn_enabled (Boolean) (defaults to: true)

    if the Game_Character turns when impossible move

#move_toward(tx, ty)

#move_toward_player

Move the Game_Character toward the player

#move_type_path

Movement induced by the Path Finding

#move_up(turn_enabled = true)

Move Game_Character up

Parameters:

  • turn_enabled (Boolean) (defaults to: true)

    if the Game_Character turns when impossible move

#move_upper_left

Move the Game_Character upper left

#move_upper_right

Move the Game_Character upper right

#movement_process_end(no_follower_move = false)

End of the movement process

Parameters:

  • no_follower_move (Boolean) (defaults to: false)

    if the follower should not move

Author:

  • Nuri Yuri

#moveto(x, y)

Warps the character on the Map to specific coordinates. Adjust the z position of the character.

Parameters:

  • x (Integer)

    new x position of the character

  • y (Integer)

    new y position of the character

#moving?Boolean

is the character moving ?

Returns:

  • (Boolean)

#particle_push

Push a particle to the particle stack if possible

Author:

  • Nuri Yuri

#particle_push_grass

Push a grass particle

#particle_push_pond

Push a pond particle

#particle_push_sand

Push a sand particle

#particle_push_snow

Push a snow particle

#particle_push_tall_grass

Push a tall grass particle

#particle_push_wetsand

Push a wet sand particle

#passable?(x, y, d, skip_event = false) ⇒ Boolean

Is the tile in front of the character passable ?

Parameters:

  • x (Integer)

    x position on the Map

  • y (Integer)

    y position on the Map

  • d (Integer)

    direction : 2, 4, 6, 8, 0. 0 = current position

  • skip_event (Boolean) (defaults to: false)

    if the function does not check events

Returns:

  • (Boolean)

    if the front/current tile is passable

#passable_bridge_check?(x, y, d, new_x, new_y, z, game_map, sys_tag) ⇒ Boolean

Check the bridge related passabilities

Parameters:

  • x (Integer)

    current x position

  • y (Integer)

    current y position

  • z (Integer)

    current direction

  • new_x (Integer)

    new x position

  • new_y (Integer)

    new y position

  • z (Integer)

    current z position

  • game_map (Game_Map)

    map object

  • sys_tag (Integer)

    current system_tag

Returns:

  • (Boolean)

    if the tile is passable according to the bridge rules

#passage_surf_check?(sys_tag) ⇒ Boolean

Check the surf related passabilities

Parameters:

  • sys_tag (Integer)

    current system_tag

Returns:

  • (Boolean)

    if the tile is passable according to the surf rules

#process_slope_y_modifier(y_modifier)

#reset_follower_move

Remove the memorized moves of the follower

Author:

  • Nuri Yuri

#screen_xInteger

Return the x position of the sprite on the screen

Returns:

#screen_yInteger

Return the y position of the sprite on the screen

Returns:

#screen_z(_height = 0) ⇒ Integer

Return the z superiority of the sprite of the character

Parameters:

  • _height (Integer) (defaults to: 0)

    height of a frame of the character (ignored)

Returns:

#set_appearance(character_name, character_hue = 0)

Define the new appearance of the character

Parameters:

  • character_name (String)

    name of the character graphic to display

  • character_hue (Integer) (defaults to: 0)

    must be 0

#set_follower(follower)

Define the follower of the event

Parameters:

Author:

  • Nuri Yuri

#set_surfing

Set the Game_Character in the “surfing” mode (not able to walk on ground but able to walk on water)

Author:

  • Nuri Yuri

#shadow_screen_xInteger

Return the x position of the shadow of the character on the screen

Returns:

#shadow_screen_yInteger

Return the y position of the shadow of the character on the screen

Returns:

#sliding?Boolean

Check if the Game_Character slides

Returns:

  • (Boolean)

Author:

  • Nuri Yuri

#slope_check_left(write = true)

Update the slope values when moving to left

#slope_check_right(write = true) ⇒ Integer

Update the slope values when moving to right, and return y slope modifier

Returns:

#stair_move_leftBoolean

Try to move the Game_Character on a stair to the left

Returns:

  • (Boolean)

    if the player cannot perform a regular movement (success or blocked)

#stair_move_rightBoolean

Try to move the Game_Character on a stair to the right

Returns:

  • (Boolean)

    if the player cannot perform a regular movement (success or blocked)

#stop_path

Stop following the path if there is one and clear the agent

#straighten

Adjust the character position

#surfing?Boolean

Check if the Game_Character is in the “surfing” mode

Returns:

  • (Boolean)

Author:

  • Nuri Yuri

#system_tagInteger

Return the SystemTag where the Game_Character stands

Returns:

  • (Integer)

    ID of the SystemTag

Author:

  • Nuri Yuri

#terrain_tagInteger?

current terrain tag on which the character steps

Returns:

#turn_180

Turn 180°

#turn_away_from_player

Turn away from the player

#turn_down

Turn down unless direction fix

#turn_left

Turn left unless direction fix

#turn_left_90

Turn 90° to the left of the Game_Character

#turn_random

Turn in a random direction

#turn_right

Turn right unless direction fix

#turn_right_90

Turn 90° to the right of the Game_Character

#turn_right_or_left_90

Turn random right or left 90°

#turn_toward_character(character)

Turn toward another character

Parameters:

#turn_toward_player

Turn toward the player

#turn_up

Turn up unless direction fix

#unlock

Release the character, can perform its natural movements

#update

Update the Game_Character (manages movements and some animations)

#z_bridge_check(sys_tag)

Check bridge information and adjust the z position of the Game_Character

Parameters:

  • sys_tag (Integer)

    the SystemTag

Author:

  • Nuri Yuri