Project1
标题: 求助~~给脚本加开关(内附代码) [打印本页]
作者: 涂鸦boy 时间: 2011-7-20 12:03
标题: 求助~~给脚本加开关(内附代码)
本帖最后由 fux2 于 2011-7-20 15:56 编辑
想要一个即有开关又能点中即启动事件的发光脚本,求改动(自己努力了一上午无成果啊~泪奔)
附脚本1.有开关但不能启动事件(必须要这种写在名字里的开关判定)- class Sprite_Character
- alias lv50_update update
- def update
- lv50_update
- #——这里最后的"柳啊"里,可以写入文字或数字,然后只有有那些文字或数字的(不需要完全是)事件才可发光。
- return if @cw == nil or @ch == nil or @character.is_a?(Game_Player) or [email protected]_name.include?("柳啊")
- mouse_x, mouse_y = Mouse.get_mouse_pos
- if self.x - @cw/2 <= mouse_x and self.y - @ch <= mouse_y and
- (self.x + @cw/2) > mouse_x and self.y > mouse_y
- self.tone.set(100, 100, 100)
- else
- self.tone.set(0, 0, 0)
- end
- end
- end
- class Game_Event
- def event_name
- return @event.name
- end
- end
复制代码 附脚本2.能启动事件但无开关!!- #==============================================================================
- # ■ Sprite_Character
- #------------------------------------------------------------------------------
- # check the Mouse's events and lighter,start.
- #==============================================================================
- class Sprite_Character < RPG::Sprite
- alias oldupdate update
- def update
- oldupdate
- mx,my = Mouse.get_mouse_pos
- lx = self.x - self.ox
- rx = lx + self.bitmap.width/4
- ty = self.y - self.oy
- by = ty + self.bitmap.height/4
- if mx < lx or mx > rx or my < ty or my > by or
- self.bitmap.get_pixel(mx-lx,my-ty).alpha == 0
- return
- end
- if Mouse.trigger?(Mouse::LEFT)
- if @trigger == 4 or @character == $game_player
- return
- end
- @character.start
- end
- self.blend_type = 1
- end
- end
- #-------------------------------------------------------------------------------
- #end
- #-------------------------------------------------------------------------------
复制代码