Project1
标题: 鼠标响应图片问题 [打印本页]
作者: 梦到叶子了 时间: 2011-9-3 21:42
标题: 鼠标响应图片问题
能不能将鼠标响应图片的点击方式改成鼠标右键?点击图片,需要鼠标右键而不是左键,希望各位高手帮忙解决~- #格式:显示的cmd图片的命名格式为:
- # cmd公共事件ID_名字
- # cmd公共事件ID_名字_02 # 此为鼠标经过显示的图片
- #
- #
- #即,带有cmd的为可以点击的图片,点击后执行相应的公共事件.....
- #不带cmd的图片没任何影响。。。
- #脚本:
- 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]
- $game_switches[20] = false
- return
- end
- if @picture.name.split(/_/)[2].nil?
- $game_switches[20] = true
- @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
- $game_switches[20] = false
- end
- end
- end
复制代码