Class: Pathfinding::Target::Border
- Defined in:
- scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb
Class Method Summary collapse
-
.load(data)
Create new target from the given data.
Instance Method Summary collapse
-
#check_move(x, y) ⇒ Boolean
Check if the character targetted has moved, considering the distance for optimisation and return true if the target is considered as moved.
-
#initialize(*args) ⇒ Border
constructor
A new instance of Border.
-
#reached?(x, y, z) ⇒ Boolean
Test if the target is reached at the given coords.
-
#save ⇒ Array<Object>
Gather the savable data.
Constructor Details
#initialize(*args) ⇒ Border
Returns a new instance of Border.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb', line 165 def initialize(*args) @border = args[0] @radius = args[1] case @border when :north @value = @radius + Yuki::MapLinker.get_OffsetY when :west @value = @radius + Yuki::MapLinker.get_OffsetX when :south @value = $game_map.height - @radius - 1 - Yuki::MapLinker.get_OffsetY when :east @value = $game_map.width - @radius - 1 - Yuki::MapLinker.get_OffsetX end end |
Class Method Details
Instance Method Details
#check_move(x, y) ⇒ Boolean
Check if the character targetted has moved, considering the distance for optimisation and return true if the target is considered as moved
203 204 205 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb', line 203 def check_move(x, y) return false end |
#reached?(x, y, z) ⇒ Boolean
Test if the target is reached at the given coords
185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb', line 185 def reached?(x, y, z) case @border when :north return y <= @value when :south return y >= @value when :east return x >= @value when :west return x <= @value end return true # Error end |
#save ⇒ Array<Object>
Gather the savable data
209 210 211 |
# File 'scripts/01450 Systems/00003 Map Engine/00002 Logic/00650 RMXP/00710 Pathfinding_targets.rb', line 209 def save return [:Border, @border, @radius] end |