图中黑点距离为1,橙红点距离为2. 我想把以玩家坐标为中心,一定范围内,所含有某区域的数量代入变量进行判定再达成如下目的…… 7号区域,当以玩家为中心,距离1以内(包括1),7号区域数量不为0时,才能使用 ...
class Game_Interpreter def region_count(region_id, distance) x = $game_player.x y = $game_player.y (-distance..distance).inject(0) do |result, dx| dy_max = distance - dx.abs (-dy_max..dy_max).count { |dy| $game_map.region_id(x + dx, y + dy) == region_id } + result end endend
class Game_Interpreter def region_count(region_id, distance) x = $game_player.x y = $game_player.y (-distance..distance).inject(0) do |result, dx| dy_max = distance - dx.abs (-dy_max..dy_max).count { |dy| $game_map.region_id(x + dx, y + dy) == region_id } + result end end end
查看全部评分
折叠内容标题(非必须)
折叠内容
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-11-15 18:01
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.