加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
#==============================================================================
# ■ ARPG_Bullet
#------------------------------------------------------------------------------
# 处理ARPG中范围攻击的东西`-____-``用了超级烂的方法。
# 例如 陨石,3,false,25
# 这样就是陨石这个技能```范围编号是3 不需要分歧方向 延迟为25
# 改動了攻擊判定的範圍,加大許多,變的更好打中
#==============================================================================
class ARPG_Rangs
attr_accessor :rangs
def initialize(obj, type)
@rangs = []
get_rang(obj,type)
end
def get_rang(obj,type)
x = obj.x
y = obj.y
d = obj.direction
# 技能的范围种类就是这里````0为前后一格..1为上下左右```汗``-___-`||
case type
# 前后一格
when 0
if d == 2
@rangs = [[x,y+1],[x,y-1]]
end
if d == 4
@rangs = [[x-1,y],[x+1,y]]
end
if d == 6
@rangs = [[x+1,y],[x-1,y]]
end
if d == 8
@rangs = [[x,y-1],[x,y+1]]
end
# 上下左右
when 1
@rangs = [[x,y+1],[x,y-1],[x+1,y],[x-1,y]]
#直线8格(魔神斩用)
when 5
if d == 2
@rangs = [[x,y+1],[x,y+2],[x,y+3],[x,y+4],[x,y+5],[x,y+6],[x,y+7],[x,y+8],[x+1,y+1],[x-1,y+1],[x+1,y+2],[x-1,y+2],[x+1,y+3],[x-1,y+3],[x+1,y+4],[x-1,y+4],[x+1,y+5],[x-1,y+5],[x+1,y+6],[x-1,y+6],]
end
if d == 4
@rangs = [[x-1,y],[x-2,y],[x-3,y],[x-4,y],[x-5,y],[x-6,y],[x-7,y],[x-8,y],[x-1,y+1],[x-1,y-1],[x-2,y+1],[x-2,y-1],[x-3,y+1],[x-3,y-1],[x-4,y+1],[x-4,y-1],[x-5,y+1],[x-5,y-1],[x-6,y+1],[x-6,y-1],]
end
if d == 6
@rangs = [[x+1,y],[x+2,y],[x+3,y],[x+4,y],[x+5,y],[x+6,y],[x+7,y],[x+8,y],[x+1,y+1],[x+1,y-1],[x+2,y+1],[x+2,y-1],[x+3,y+1],[x+3,y-1],[x+4,y+1],[x+4,y-1],[x+5,y+1],[x+5,y-1],[x+6,y+1],[x+6,y-1],]
end
if d == 8
@rangs = [[x,y-1],[x,y-2],[x,y-3],[x,y-4],[x,y-5],[x,y-6],[x,y-7],[x,y-8],[x+1,y-1],[x-1,y-1],[x+1,y-2],[x-1,y-2],[x+1,y-3],[x-1,y-3],[x+1,y-4],[x-1,y-4],[x+1,y-5],[x-1,y-5],[x+1,y-6],[x-1,y-6],]
end
# 直线10格(激光用)
when 6
if d == 2
@rangs = [[x,y+1],[x,y+2],[x,y+3],[x,y+4],[x,y+5],[x,y+6],[x,y+7],[x,y+8],[x,y+9],[x,y+10],[x,y+11]]
end
if d == 4
@rangs = [[x-1,y],[x-2,y],[x-3,y],[x-4,y],[x-5,y],[x-6,y],[x-7,y],[x-8,y],[x-9,y],[x-10,y],[x-11,y]]
end
if d == 6
@rangs = [[x+1,y],[x+2,y],[x+3,y],[x+4,y],[x+5,y],[x+6,y],[x+7,y],[x+8,y],[x+9,y],[x+10,y],[x+11,y]]
end
if d == 8
@rangs = [[x,y-1],[x,y-2],[x,y-3],[x,y-4],[x,y-5],[x,y-6],[x,y-7],[x,y-8],[x,y-9],[x,y-10],[x,y-11]]
end
# 直线2格(枪用)
when 2
if d == 2
@rangs = [[x,y+1],[x,y+2]]
end
if d == 4
@rangs = [[x-1,y],[x-2,y]]
end
if d == 6
@rangs = [[x+1,y],[x+2,y]]
end
if d == 8
@rangs = [[x,y-1],[x,y-2]]
end
# 面向的3个敌人
when 4
case d
when 2
@rangs = [[x-1,y+1],[x,y+1],[x+1,y+1],[x-1,y+2],[x,y+2],[x+1,y+2],[x+1,y],[x-1,y]]
when 4
@rangs = [[x-1,y-1],[x-1,y],[x-1,y+1],[x-2,y-1],[x-2,y],[x-2,y+1],[x,y+1],[x,y-1]]
when 6
@rangs = [[x+1,y+1],[x+1,y],[x+1,y-1],[x+2,y+1],[x+2,y],[x+2,y-1],[x,y+1],[x,y-1]]
when 8
@rangs = [[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y-2],[x,y-2],[x+1,y-2],[x+1,y],[x-1,y]]
when 1
@rangs = [[x+1,y+1],[x+1,y+2],[x-1,y-1],[x-1,y+1],[x-1,y+2],[x-2,y+1],[x-2,y-1],[x-2,y-2],[x,y]]
when 3
@rangs = [[x+1,y-1],[x+2,y-1],[x-1,y+1],[x-1,y+2],[x+1,y+1],[x+1,y+2],[x+2,y+1],[x+2,y+2],[x,y]]
when 7
@rangs = [[x+1,y-1],[x+1,y-2],[x-1,y-1],[x-1,y-2],[x-2,y-1],[x-2,y-2],[x-1,y+1],[x-2,y+1],[x,y]]
when 9
@rangs = [[x+1,y+1],[x+2,y+1],[x+1,y-1],[x+2,y-1],[x+1,y-2],[x+2,y-2],[x-1,y-1],[x-1,y-2],[x,y]]
end
# 以角色为中心的6X6格
when 3
t = []
for ex in x-2..x+2
for ey in y-2..y+2
t.push([ex,ey])
end
end
@rangs = t
end
end
end
怎么在修改出跟大的来
其实义角色为中心的6x6格子在游戏中是3x3的 求高手帮忙 在后面加个更大的。 |