mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-03-11 19:02:00 +00:00
6.6 update
This commit is contained in:
15
Data/Scripts/053_PIF_Hoenn/OverworldPokemon.rb
Normal file
15
Data/Scripts/053_PIF_Hoenn/OverworldPokemon.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
def player_near_event?(map_id, event_id, radius)
|
||||
return false if map_id != $game_map.map_id
|
||||
event = $game_map.events[event_id]
|
||||
return false if event.nil?
|
||||
dx = $game_player.x - event.x
|
||||
dy = $game_player.y - event.y
|
||||
distance = Math.sqrt(dx * dx + dy * dy)
|
||||
return distance <= radius
|
||||
end
|
||||
|
||||
def checkOverworldPokemonFlee(radius=4)
|
||||
event = $game_map.event[@event_id]
|
||||
return player_near_event?($game_map.map_id, event.id, radius)
|
||||
end
|
||||
Reference in New Issue
Block a user