Class: Game_Follower

Inherits:
Game_Character show all
Defined in:
Game_Follower.rb

Overview

** Game_Follower


This class handles followers. A follower is an allied character, other than

the front character, displayed in the party. It is referenced within the Game_Followers class.

Constant Summary

Constant Summary

Constants inherited from Game_Character

Game_Character::ROUTE_CHANGE_BLENDING, Game_Character::ROUTE_CHANGE_FREQ, Game_Character::ROUTE_CHANGE_GRAPHIC, Game_Character::ROUTE_CHANGE_OPACITY, Game_Character::ROUTE_CHANGE_SPEED, Game_Character::ROUTE_DIR_FIX_OFF, Game_Character::ROUTE_DIR_FIX_ON, Game_Character::ROUTE_END, Game_Character::ROUTE_JUMP, Game_Character::ROUTE_MOVE_AWAY, Game_Character::ROUTE_MOVE_BACKWARD, Game_Character::ROUTE_MOVE_DOWN, Game_Character::ROUTE_MOVE_FORWARD, Game_Character::ROUTE_MOVE_LEFT, Game_Character::ROUTE_MOVE_LOWER_L, Game_Character::ROUTE_MOVE_LOWER_R, Game_Character::ROUTE_MOVE_RANDOM, Game_Character::ROUTE_MOVE_RIGHT, Game_Character::ROUTE_MOVE_TOWARD, Game_Character::ROUTE_MOVE_UP, Game_Character::ROUTE_MOVE_UPPER_L, Game_Character::ROUTE_MOVE_UPPER_R, Game_Character::ROUTE_PLAY_SE, Game_Character::ROUTE_SCRIPT, Game_Character::ROUTE_STEP_ANIME_OFF, Game_Character::ROUTE_STEP_ANIME_ON, Game_Character::ROUTE_SWITCH_OFF, Game_Character::ROUTE_SWITCH_ON, Game_Character::ROUTE_THROUGH_OFF, Game_Character::ROUTE_THROUGH_ON, Game_Character::ROUTE_TRANSPARENT_OFF, Game_Character::ROUTE_TRANSPARENT_ON, Game_Character::ROUTE_TURN_180D, Game_Character::ROUTE_TURN_90D_L, Game_Character::ROUTE_TURN_90D_R, Game_Character::ROUTE_TURN_90D_R_L, Game_Character::ROUTE_TURN_AWAY, Game_Character::ROUTE_TURN_DOWN, Game_Character::ROUTE_TURN_LEFT, Game_Character::ROUTE_TURN_RANDOM, Game_Character::ROUTE_TURN_RIGHT, Game_Character::ROUTE_TURN_TOWARD, Game_Character::ROUTE_TURN_UP, Game_Character::ROUTE_WAIT, Game_Character::ROUTE_WALK_ANIME_OFF, Game_Character::ROUTE_WALK_ANIME_ON

Instance Attribute Summary

Attributes inherited from Game_Character

#move_route_forcing

Attributes inherited from Game_CharacterBase

#animation_id, #balloon_id, #blend_type, #bush_depth, #character_index, #character_name, #direction, #direction_fix, #id, #move_frequency, #move_speed, #opacity, #pattern, #priority_type, #real_x, #real_y, #step_anime, #through, #tile_id, #transparent, #walk_anime, #x, #y

Instance Method Summary (collapse)

Methods inherited from Game_Character

#advance_move_route_index, #distance_x_from, #distance_y_from, #force_move_route, #init_private_members, #init_public_members, #jump, #memorize_move_route, #move_away_from_character, #move_away_from_player, #move_backward, #move_forward, #move_random, #move_toward_character, #move_toward_player, #process_move_command, #process_route_end, #restore_move_route, #swap, #turn_180, #turn_away_from_character, #turn_away_from_player, #turn_left_90, #turn_random, #turn_right_90, #turn_right_or_left_90, #turn_toward_character, #turn_toward_player, #update_routine_move, #update_stop

Methods inherited from Game_CharacterBase

#bush?, #check_event_trigger_touch, #check_event_trigger_touch_front, #collide_with_characters?, #collide_with_events?, #collide_with_vehicles?, #dash?, #debug_through?, #diagonal_passable?, #distance_per_frame, #increase_steps, #init_private_members, #init_public_members, #jump_height, #jumping?, #ladder?, #map_passable?, #move_diagonal, #move_straight, #moveto, #moving?, #normal_priority?, #object_character?, #passable?, #pos?, #pos_nt?, #real_move_speed, #region_id, #reverse_dir, #screen_x, #screen_y, #screen_z, #set_direction, #set_graphic, #shift_y, #stopping?, #straighten, #terrain_tag, #tile?, #update_animation, #update_anime_count, #update_anime_pattern, #update_bush_depth, #update_jump, #update_move, #update_stop

Constructor Details

- (Game_Follower) initialize(member_index, preceding_character)


  • Object Initialization




13
14
15
16
17
18
19
# File 'Game_Follower.rb', line 13

def initialize(member_index, preceding_character)
  super()
  @member_index = member_index
  @preceding_character = preceding_character
  @transparent = $data_system.opt_transparent
  @through = true
end

Instance Method Details

- (Object) actor


  • Get Corresponding Actor




30
31
32
# File 'Game_Follower.rb', line 30

def actor
  $game_party.battle_members[@member_index]
end

- (Object) chase_preceding_character


  • Pursue Preceding Character




55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'Game_Follower.rb', line 55

def chase_preceding_character
  unless moving?
    sx = distance_x_from(@preceding_character.x)
    sy = distance_y_from(@preceding_character.y)
    if sx != 0 && sy != 0
      move_diagonal(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2)
    elsif sx != 0
      move_straight(sx > 0 ? 4 : 6)
    elsif sy != 0
      move_straight(sy > 0 ? 8 : 2)
    end
  end
end

- (Boolean) gather?


  • Determine if at Same Position as Preceding Character


Returns:

  • (Boolean)


71
72
73
# File 'Game_Follower.rb', line 71

def gather?
  !moving? && pos?(@preceding_character.x, @preceding_character.y)
end

- (Object) refresh


  • Refresh




23
24
25
26
# File 'Game_Follower.rb', line 23

def refresh
  @character_name = visible? ? actor.character_name : ""
  @character_index = visible? ? actor.character_index : 0
end

- (Object) update


  • Frame Update




42
43
44
45
46
47
48
49
50
51
# File 'Game_Follower.rb', line 42

def update
  @move_speed     = $game_player.real_move_speed
  @transparent    = $game_player.transparent
  @walk_anime     = $game_player.walk_anime
  @step_anime     = $game_player.step_anime
  @direction_fix  = $game_player.direction_fix
  @opacity        = $game_player.opacity
  @blend_type     = $game_player.blend_type
  super
end

- (Boolean) visible?


  • Determine Visibility


Returns:

  • (Boolean)


36
37
38
# File 'Game_Follower.rb', line 36

def visible?
  actor && $game_player.followers.visible
end