本帖最后由 Sion 于 2014-6-16 22:01 编辑
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 = Mouse.x my = Mouse.y 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] return end if @picture.name.split(/_/)[1].nil? @picture.name = @picture.name + "_2" end if Mouse.trigger?(:L) && !@picture.name.split(/_/)[0].nil? @picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"") $game_temp.reserve_common_event($1.to_i) end end end
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 = Mouse.x
my = Mouse.y
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]
return
end
if @picture.name.split(/_/)[1].nil?
@picture.name = @picture.name + "_2"
end
if Mouse.trigger?(:L) && !@picture.name.split(/_/)[0].nil?
@picture.name.split(/_/)[0].sub(/cmd([0-9]+)/,"")
$game_temp.reserve_common_event($1.to_i)
end
end
end
|