例如顯示的圖片為 1號
在公共事件內直接顯示同號的圖片
就會自動取代原來的圖片 作者: yangff 时间: 2008-6-7 21:15
class Game_Picture
attr_accessor :x # X 坐标
attr_accessor :y # Y 坐标
attr_accessor :number # 编号
attr_accessor :td # 拖动标记
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[/td/].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(/td([0-9]+)/,"")
self.bitmap.dispose
$game_temp.common_event_id = 任意事件id.to_i
end
end
class Game_Picture
attr_accessor :x # X 坐标
attr_accessor :y # Y 坐标
attr_accessor :number # 编号
attr_accessor :td # 拖动标记
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[/td/].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(/td([0-9]+)/,"")
$game_temp.common_event_id = 20
end
end