Class: Pathfinding::Cursor

Inherits:
Object show all
Includes:
GameData::SystemTags
Defined in:
scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb

Overview


Class that describe and manipulate the simili character used in pathfinding

Constant Summary collapse

SurfTag =

SystemTags that trigger Surfing

Game_Character::SurfTag
SurfLTag =

SystemTags that does not trigger leaving water

Game_Character::SurfLTag
SlideTags =

SystemTags that triggers “sliding” state

[TIce, RapidsL, RapidsR, RapidsU, RapidsD, RocketL, RocketU, RocketD, RocketR, RocketRL, RocketRU, RocketRD, RocketRR]
BRIDGE_TILES =

Array used to detect if a character is on a bridge tile

[BridgeRL, BridgeUD]

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

Instance Method Summary collapse

Methods included from GameData::SystemTags

gen, system_tag_db_symbol

Constructor Details

#initialize(character) ⇒ Cursor

Returns a new instance of Cursor.



20
21
22
23
24
25
26
27
28
29
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb', line 20

def initialize(character)
  @character = character
  @__bridge = character.__bridge
  @through = character.through
  @x = character.x
  @y = character.y
  @z = character.z
  @direction = character.direction
  @character_name = character.character_name
end

Instance Attribute Details

#__bridge (readonly)

Returns the value of attribute __bridge.



18
19
20
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb', line 18

def __bridge
  @__bridge
end

#x (readonly)

Returns the value of attribute x.



15
16
17
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb', line 15

def x
  @x
end

#y (readonly)

Returns the value of attribute y.



16
17
18
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb', line 16

def y
  @y
end

#z (readonly)

Returns the value of attribute z.



17
18
19
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb', line 17

def z
  @z
end

Instance Method Details

#sim_move?(sx, sy, sz, code, b = @__bridge, slide = @sliding, surf = @surfing) ⇒ Boolean

Simulate the mouvement of the character and store the data into cursor's attributes

Parameters:

Returns:

  • (Boolean)


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/00705 Pathfinding_cursor.rb', line 41

def sim_move?(sx, sy, sz, code, b = @__bridge, slide = @sliding, surf = @surfing)
  moveto(sx, sy)
  @z = sz
  @__bridge = b
  @sliding = slide
  @surfing = surf

  case code
  when 1 then move_down
  when 2 then move_left
  when 3 then move_right
  when 4 then move_up
  end
  return (@x != sx || @y != sy)
end

#state



31
32
33
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00705 Pathfinding_cursor.rb', line 31

def state
  return [@__bridge, @sliding, @surfing]
end