查看: 2378|回复: 2

[已经解决] 如何在游戏中修改鼠标图标?

[复制链接]
梦石
0
星屑
1319
在线时间
18 小时
注册时间
2010-12-4
回帖
2
发表于 2012-11-25 16:15:07 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 wpsof 于 2012-12-2 10:52 编辑

在鼠标系统中,我设置了一个鼠标图标:
  1. @mouse_sprite.bitmap = Bitmap.new('Graphics/mouse/mouse.png')
复制代码
但我有一个想法,就是在战斗时修改一个鼠标图标,战斗结束后又修改回来。弱弱的问一句:能实现吗?
(好像《雨血2》中有这种方法耶。)

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
回帖
3515
发表于 2012-11-25 18:23:13 | 显示全部楼层
→ →看LZ用的是哪种鼠标脚本了,就当拿最常用的鼠标脚本来吧

以下脚本当作外来脚本,插入在鼠标脚本的下方
  1. $平时鼠标 = 'Graphics/Icons/001-Weapon01.png'
  2. $战斗时鼠标 = 'Graphics/Icons/002-Weapon02.png'

  3. module Mouse  
  4.   LEFT = 0x01
  5.   RIGHT = 0x02
  6.   def self.init(sprite = nil)
  7.     $ShowCursor.call(0)
  8.     @show_cursor = false
  9.     @mouse_sprite = Sprite.new
  10.     @mouse_sprite.z = 99999
  11.     @mouse_sprite.bitmap = Bitmap.new($平时鼠标)
  12.     @in_battle = false
  13.     @left_press = false
  14.     @right_press = false
  15.     @left_trigger = false
  16.     @right_trigger = false
  17.     @left_repeat = false
  18.     @right_repeat = false
  19.     @click_lock = false
  20.     update
  21.   end
  22.   def self.update
  23.     left_down = $GetKeyState.call(0x01)
  24.     right_down = $GetKeyState.call(0x02)
  25.    
  26.     @click_lock = false
  27.     mouse_x, mouse_y = self.get_mouse_pos
  28.     @battle = $scene.is_a?(Scene_Battle)
  29.     if @battle != @in_battle
  30.       @in_battle = @battle
  31.       @mouse_sprite.bitmap = Bitmap.new(@battle ? $战斗时鼠标 : $平时鼠标)
  32.     end
  33.    
  34.     if @mouse_sprite != nil
  35.       @mouse_sprite.x = mouse_x
  36.       @mouse_sprite.y = mouse_y
  37.     end
  38.     if left_down[7] == 1
  39.       @left_repeat = (not @left_repeat)
  40.       @left_trigger = (not @left_press)
  41.       @left_press = true
  42.     else
  43.       @left_press = false
  44.       @left_trigger = false
  45.       @left_repeat = false
  46.     end
  47.     if right_down[7] == 1
  48.       @right_repeat = (not @right_repeat)
  49.       @right_trigger = (not @right_press)
  50.       @right_press = true
  51.     else
  52.       @right_press = false
  53.       @right_trigger = false
  54.       @right_repeat = false
  55.     end
  56.   end
  57. end
  58. Mouse.init
  59. END { Mouse.exit }
复制代码

评分

参与人数 1星屑 +80 收起 理由
hcm + 80 认可答案

查看全部评分


http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

梦石
0
星屑
1319
在线时间
18 小时
注册时间
2010-12-4
回帖
2
 楼主| 发表于 2012-12-1 22:51:42 | 显示全部楼层
谢了!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部