Project1
标题:
如何在游戏中修改鼠标图标?
[打印本页]
作者:
wpsof
时间:
2012-11-25 16:15
标题:
如何在游戏中修改鼠标图标?
本帖最后由 wpsof 于 2012-12-2 10:52 编辑
在鼠标系统中,我设置了一个鼠标图标:
@mouse_sprite.bitmap = Bitmap.new('Graphics/mouse/mouse.png')
复制代码
但我有一个想法,就是在战斗时修改一个鼠标图标,战斗结束后又修改回来。弱弱的问一句:能实现吗?
(好像《雨血2》中有这种方法耶。)
作者:
Wind2010
时间:
2012-11-25 18:23
→ →看LZ用的是哪种鼠标脚本了,就当拿最常用的鼠标脚本来吧
以下脚本当作外来脚本,插入在鼠标脚本的下方
$平时鼠标 = 'Graphics/Icons/001-Weapon01.png'
$战斗时鼠标 = 'Graphics/Icons/002-Weapon02.png'
module Mouse
LEFT = 0x01
RIGHT = 0x02
def self.init(sprite = nil)
$ShowCursor.call(0)
@show_cursor = false
@mouse_sprite = Sprite.new
@mouse_sprite.z = 99999
@mouse_sprite.bitmap = Bitmap.new($平时鼠标)
@in_battle = false
@left_press = false
@right_press = false
@left_trigger = false
@right_trigger = false
@left_repeat = false
@right_repeat = false
@click_lock = false
update
end
def self.update
left_down = $GetKeyState.call(0x01)
right_down = $GetKeyState.call(0x02)
@click_lock = false
mouse_x, mouse_y = self.get_mouse_pos
@battle = $scene.is_a?(Scene_Battle)
if @battle != @in_battle
@in_battle = @battle
@mouse_sprite.bitmap = Bitmap.new(@battle ? $战斗时鼠标 : $平时鼠标)
end
if @mouse_sprite != nil
@mouse_sprite.x = mouse_x
@mouse_sprite.y = mouse_y
end
if left_down[7] == 1
@left_repeat = (not @left_repeat)
@left_trigger = (not @left_press)
@left_press = true
else
@left_press = false
@left_trigger = false
@left_repeat = false
end
if right_down[7] == 1
@right_repeat = (not @right_repeat)
@right_trigger = (not @right_press)
@right_press = true
else
@right_press = false
@right_trigger = false
@right_repeat = false
end
end
end
Mouse.init
END { Mouse.exit }
复制代码
作者:
wpsof
时间:
2012-12-1 22:51
谢了!
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1