设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
12
返回列表 发新帖
楼主: 金芒芒
打印 上一主题 下一主题

[已经解决] 能把光标改在图片的前面吗光标盖住图片

[复制链接]

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
11
 楼主| 发表于 2016-2-18 18:25:39 | 只看该作者
本帖最后由 金芒芒 于 2016-2-18 18:29 编辑
紫英晓狼1130 发表于 2016-2-18 17:00
没必要重写Window_Command,在Scene_Menu里建几个精灵就行了
范例里只做了一个为例,查找“★”就能知道在 ...
  1. class Scene_Menu
  2. def initialize(menu_index = 0)
  3.     @menu_index = menu_index
  4.   def initialize(menu_index = 0)
  5.     @menu_index = menu_index
  6.   end
  7.   def main
  8. #  check_enemy_in_map($game_player.x,$game_player.y)
  9.     Window_Command_New.new($game_party.actors.size)
  10.     cmd.index = @menu_index

  11.     Graphics.transition
  12.     loop do
  13.       Graphics.update
  14.       Input.update
  15.       cmd.update
  16.       if Input.trigger?(Input::B)
  17.         $game_system.se_play($data_system.cancel_se)
  18.         $scene = Scene_Map.new
  19.       end
  20.       if Input.trigger?(Input::C)
  21.         case cmd.index
  22.         when 0
  23.           $game_system.se_play($data_system.buzzer_se)
  24.           $scene = Scene_Equip.new
  25.         when 1
  26.           $game_system.se_play($data_system.decision_se)
  27.           $scene = Scene_Item.new
  28.         when 2
  29.           $game_system.se_play($data_system.decision_se)
  30.           $scene = Scene_Skill.new
  31.         when 3
  32.           $game_system.se_play($data_system.decision_se)
  33.           $scene = Scene_Status.new
  34.         when 4
  35.           $game_system.se_play($data_system.decision_se)
  36.          
  37.         when 5
  38.           $game_system.se_play($data_system.decision_se)
  39.           $scene = Scene_Change_Turn.new
  40.         when 6
  41.           print "可以自己结合叶子的任务系统设计"
  42.         when 7
  43.           print "自己安排什么 储存、读取、什么的等"
  44.         end
  45.       end
  46.       if $scene != self
  47.         break
  48.       end
  49.     end
  50.     Graphics.freeze
  51.     cmd.dispose
  52.   end
  53. end
复制代码
放进去马上就消失了
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
12
 楼主| 发表于 2016-2-18 18:30:05 | 只看该作者
紫英晓狼1130 发表于 2016-2-18 17:00
没必要重写Window_Command,在Scene_Menu里建几个精灵就行了
范例里只做了一个为例,查找“★”就能知道在 ...
  1. class Scene_Menu
  2. def initialize(menu_index = 0)
  3.     @menu_index = menu_index
  4.   def initialize(menu_index = 0)
  5.     @menu_index = menu_index
  6.   end
  7.   def main
  8. #  check_enemy_in_map($game_player.x,$game_player.y)
  9.     Window_Command_New.new($game_party.actors.size)
  10.     cmd.index = @menu_index

  11.     Graphics.transition
  12.     loop do
  13.       Graphics.update
  14.       Input.update
  15.       cmd.update
  16.       if Input.trigger?(Input::B)
  17.         $game_system.se_play($data_system.cancel_se)
  18.         $scene = Scene_Map.new
  19.       end
  20.       if Input.trigger?(Input::C)
  21.         case cmd.index
  22.         when 0
  23.           $game_system.se_play($data_system.buzzer_se)
  24.           $scene = Scene_Equip.new
  25.         when 1
  26.           $game_system.se_play($data_system.decision_se)
  27.           $scene = Scene_Item.new
  28.         when 2
  29.           $game_system.se_play($data_system.decision_se)
  30.           $scene = Scene_Skill.new
  31.         when 3
  32.           $game_system.se_play($data_system.decision_se)
  33.           $scene = Scene_Status.new
  34.         when 4
  35.           $game_system.se_play($data_system.decision_se)
  36.          
  37.         when 5
  38.           $game_system.se_play($data_system.decision_se)
  39.           $scene = Scene_Change_Turn.new
  40.         when 6
  41.           print "可以自己结合叶子的任务系统设计"
  42.         when 7
  43.           print "自己安排什么 储存、读取、什么的等"
  44.         end
  45.       end
  46.       if $scene != self
  47.         break
  48.       end
  49.     end
  50.     Graphics.freeze
  51.     cmd.dispose
  52.   end
  53. end
复制代码
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
13
 楼主| 发表于 2016-2-18 18:44:14 | 只看该作者
陈大帅帅帅哥 发表于 2016-2-18 15:06
不好意思,学艺不精,弄了半天也没成,要不你去下载一个动态光标脚本试一试

另外,bitmap没有z属性 ...

谢了,大哥
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4476
在线时间
1053 小时
注册时间
2013-3-28
帖子
390

开拓者

14
发表于 2016-2-18 20:27:05 | 只看该作者
本帖最后由 陈大帅帅帅哥 于 2016-2-18 20:31 编辑

RUBY 代码复制
  1. class Window_Command_New < Window_Selectable
  2.  
  3.     def initialize(actors=4,enemynums=0)
  4.  
  5.     super(160, 20, 968, 620)
  6.     self.contents = Bitmap.new(width - 32, height - 32)
  7.     self.opacity = HS::OPACITY
  8.     self.z = 90
  9.     @commands = ["装备","物品","魔法","状态","战斗","队列","任务","系统"]
  10.     @item_max = 8
  11.     @column_max = 8
  12.  
  13. #   bitmap = RPG::Cache.icon("菜单")
  14.   #  self.contents.blt( - 22,-34, bitmap, Rect.new(-5, -34, 965, 569))
  15.  
  16.     #bitmap = RPG::Cache.icon("属性养成")
  17.     #self.contents.blt(32, 48, bitmap, Rect.new(0, 0, 65, 24))
  18.  
  19.     #bitmap = RPG::Cache.icon("上阵出战")
  20.     #self.contents.blt(99, 48, bitmap, Rect.new(0, 0, 65, 24))
  21.     #bitmap = RPG::Cache.icon("出仕下野")
  22.     #self.contents.blt(164, 48, bitmap, Rect.new(0, 0, 65, 24))
  23.     #bitmap = RPG::Cache.icon("合成进阶")
  24.     #self.contents.blt(232, 48, bitmap, Rect.new(0, 0, 65, 24))
  25.     #bitmap = RPG::Cache.icon("载入史册")
  26.     #self.contents.blt(297, 48, bitmap, Rect.new(0, 0, 65, 24))
  27.     #bitmap = RPG::Cache.icon("放马南山")
  28.     #self.contents.blt(364, 48, bitmap, Rect.new(0, 0, 65, 24))
  29.  
  30.  
  31.    @actors = actors
  32.    @enemynums = enemynums
  33.    draw_item(0, @actors==0 ? disabled_color : normal_color)
  34.    draw_item(1, normal_color)
  35.    draw_item(2, @actors==0 ? disabled_color : normal_color)
  36.   draw_item(3, @actors==0 ? disabled_color : normal_color)
  37.    draw_item(4, @actors==0 ? disabled_color : normal_color)
  38.   draw_item(5, @actors==0 ? disabled_color : normal_color)
  39.    draw_item(6, normal_color)
  40.    draw_item(7, normal_color)
  41.     self.index = 0
  42.   end
  43.    def draw_item(index, color)
  44.    self.contents.font.color = color
  45.    x = 4 + index % 8 * 70
  46.    y = 2
  47. # y = index / 2 * 32
  48.    rect = Rect.new(x+32, y+47, 0, 0)
  49.    self.contents.fill_rect(rect, Color.new(200, 255,20, 200))#(0, 0, 0, 0))
  50.    self.contents.draw_text(rect, @commands[index], 1)
  51. end
  52. #########################
  53.   def refresh
  54.     self.contents.clear
  55.  
  56.    #  Color.new(红色192, 绿192, 蓝192, 透明255)
  57.     for i in 0...@item_max
  58.       if i ==  self.index #@index  #
  59.         actors = Color.new(220, 200, 20, 255)#  Color.new(红色192, 绿192, 蓝192, 透明255)
  60.         font_name = "黑体"
  61.       else
  62.      actors = normal_color #Color.new(180, 150, 60, 255)#
  63.         font_name = "黑体"
  64.      end
  65.       draw_item(i, color, font_name)#加入各种i=我,颜色,字体,
  66.     end
  67.   end
  68. ######################################################################
  69.   def update_cursor_rect
  70.     # 光标位置不满 0 的情况下
  71.     if @index < 0
  72.       self.cursor_rect.empty
  73.       return
  74.     end
  75.     # 获取当前的行
  76.     row = @index / @column_max
  77.     # 当前行被显示开头行前面的情况下
  78.     if row > self.top_row #<
  79.       # 从当前行向开头行滚动
  80.       self.top_row = row
  81.     end
  82.     # 当前行被显示末尾行之后的情况下
  83.     if row > self.top_row + (self.page_row_max - 1)
  84.       # 从当前行向末尾滚动
  85.       self.top_row = row - (self.page_row_max - 1)
  86.     end
  87.     # 计算光标的宽
  88.     cursor_width = 68               #600 / (@column_max + 1) - 32
  89.     # 计算光标坐标
  90.        x = 4 + index % 8 * 70
  91.        y = 2
  92.  
  93.     # 更新国标矩形
  94.     self.cursor_rect.set(x+32, y+47, 68, 28)
  95.  
  96.   end
  97. end
  98.  
  99.  
  100.  
  101. class Scene_Menu
  102.   def initialize(menu_index = 0)
  103.     @menu_index = menu_index
  104.   end
  105.   def main
  106. #卐-----------------------------------------------------------------------------
  107.     @sxyc = Sprite.new
  108.     @szcz = Sprite.new
  109.     @csxy = Sprite.new
  110.     @hcjj = Sprite.new
  111.     @zrsc = Sprite.new
  112.     @fmns = Sprite.new
  113.     @sxyc.bitmap = RPG::Cache.icon("属性养成")
  114.     @szcz.bitmap = RPG::Cache.icon("上阵出战")
  115.     @csxy.bitmap = RPG::Cache.icon("出仕下野")
  116.     @hcjj.bitmap = RPG::Cache.icon("合成进阶")
  117.     @zrsc.bitmap = RPG::Cache.icon("载入史册")
  118.     @fmns.bitmap = RPG::Cache.icon("放马南山")
  119.     @sxyc.x = 62
  120.     @sxyc.y = 80
  121.     @sxyc.z = 91
  122.     @szcz.x = 129
  123.     @szcz.y = 80
  124.     @szcz.z = 91
  125.     @csxy.x = 194
  126.     @csxy.y = 80
  127.     @csxy.z = 91
  128.     @hcjj.x = 262
  129.     @hcjj.y = 80
  130.     @hcjj.z = 91
  131.     @zrsc.x = 327
  132.     @zrsc.y = 80
  133.     @zrsc.z = 91
  134.     @fmns.x = 394
  135.     @fmns.y = 80
  136.     @fmns.z = 91
  137. #卐-----------------------------------------------------------------------------
  138. #   check_enemy_in_map($game_player.x,$game_player.y)
  139.     cmd = Window_Command_New.new($game_party.actors.size)
  140.     cmd.index = @menu_index
  141.  
  142.     Graphics.transition
  143.     loop do
  144.       Graphics.update
  145.       Input.update
  146.       cmd.update
  147.       if Input.trigger?(Input::B)
  148.         $game_system.se_play($data_system.cancel_se)
  149.         $scene = Scene_Map.new
  150.       end
  151.       if Input.trigger?(Input::C)
  152.         case cmd.index
  153.         when 0
  154.           $game_system.se_play($data_system.buzzer_se)
  155.           $scene = Scene_Equip.new
  156.         when 1
  157.           $game_system.se_play($data_system.decision_se)
  158.           $scene = Scene_Item.new
  159.         when 2
  160.           $game_system.se_play($data_system.decision_se)
  161.           $scene = Scene_Skill.new
  162.         when 3
  163.           $game_system.se_play($data_system.decision_se)
  164.           $scene = Scene_Status.new
  165.         when 4
  166.           $game_system.se_play($data_system.decision_se)
  167.  
  168.         when 5
  169.           $game_system.se_play($data_system.decision_se)
  170.           $scene = Scene_Change_Turn.new
  171.         when 6
  172.           print "可以自己结合叶子的任务系统设计"
  173.         when 7
  174.           print "自己安排什么 储存、读取、什么的等"
  175.         end
  176.       end
  177.       if $scene != self
  178.         break
  179.       end
  180.     end
  181.     Graphics.freeze
  182.     cmd.dispose
  183. #卐-----------------------------------------------------------------------------
  184.     # ★释放精灵
  185.     @sxyc.dispose
  186.     @szcz.dispose
  187.     @csxy.dispose
  188.     @hcjj.dispose
  189.     @zrsc.dispose
  190.     @fmns.dispose
  191. #卐-----------------------------------------------------------------------------
  192.   end
  193. end


根据刚刚的大神的思路弄了一晚上(果然自己太渣了)
x值和y值你自己调一下,z值最好不要动
这段脚本替换Scene_Menu
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
7559
在线时间
1315 小时
注册时间
2015-8-15
帖子
747
15
 楼主| 发表于 2016-2-18 20:37:01 | 只看该作者
本帖最后由 金芒芒 于 2016-2-18 21:11 编辑
陈大帅帅帅哥 发表于 2016-2-18 20:27
class Window_Command_New < Window_Selectable
   
    def initialize(actors=4,enemynums=0)


刚刚的是大神,你我送你4个字:我以成仙:

QQ截图20160218210936.jpg (165.04 KB, 下载次数: 6)

QQ截图20160218210936.jpg

QQ截图20160218211036.jpg (227.68 KB, 下载次数: 2)

QQ截图20160218211036.jpg

点评

一眼看到第2张图还以为出bug了……  发表于 2016-2-19 15:42
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 20:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表