Project1
标题:
怎让鼠标响应图片?
[打印本页]
作者:
1209701975
时间:
2012-12-31 15:39
标题:
怎让鼠标响应图片?
我想制作公共事件制作的菜单(想用鼠标链接)可是我又不会,希望各位高手指点一二!
作者:
火星·奈
时间:
2012-12-31 15:53
class Game_Picture
def name=(str)
@name = str
end
end
class Sprite_Picture
alias update_old update
def update
update_old
return if @picture_name == "" or @picture_name[/cmd/].nil?
mx,my = Mouse.get_mouse_pos
lx = self.x - self.ox
rx = lx + self.bitmap.width
ty = self.y - self.oy
by = ty + self.bitmap.height
if mx < lx or mx > rx or my < ty or my > by or
self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
@picture.name = @picture.name.split(/_/)[0]+"_"
[email protected]
(/_/)[1]
return
end
if @picture.name.split(/_/)[2].nil?
@picture.name = @picture.name + "_02"
end
if Input.trigger?(13)
@picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"")
$game_temp.common_event_id = $1.to_i
end
end
end
复制代码
作者:
1209701975
时间:
2012-12-31 16:01
可是怎么用啊?
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1