查看: 3209|回复: 2

[已经解决] 标题图片按钮能否更换图片?(有工程)

  [复制链接]
梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
发表于 2011-11-6 09:42:20 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 幻耶 于 2011-11-6 09:51 编辑

茄子的图片按钮,原来标题画面的图片按钮是当鼠标移动到某个按钮上面就高亮显示,我希望当鼠标移动到按钮上面就换一张图片,鼠标移开就恢复原图片,如何做到?
工程:
★_茄孓_图片按钮1.rar (319.39 KB, 下载次数: 240)


原来设置高亮的部分:
  #--------------------------------------------------------------------------
  # ● 刷新图片项目
  #--------------------------------------------------------------------------
  def update_item
    if Mouse.get_mouse_pos != nil
    $mouse_x,$mouse_y = Mouse.get_mouse_pos
    end
    if @type == 2
    for index in @dash
     if @sprite[index] != nil
      #top_x = @sprite[index].x
      #top_y = @sprite[index].y
      top_x = @sprite[index].x - @sprite[index].bitmap.width / 2
      top_y = @sprite[index].y - @sprite[index].bitmap.height / 2
      bottom_x = top_x + @sprite[index].bitmap.width
      bottom_y = top_y + @sprite[index].bitmap.height
      if ($mouse_x > top_x) and ($mouse_y > top_y) and
           ($mouse_x < bottom_x) and ($mouse_y < bottom_y)
           self.index = @sprite[index].index
           if @move_index != self.index
           Se.ok
           @move_index = self.index
         end
      end
      if @sprite[index].index != self.index
        @sprite[index].color = Color.new(0,0,0,100)
      else
        @sprite[index].color = Color.new(0,0,0,0)
      end
    end
    end
    elsif @type == 1
     for index in @dash
        if @sprite[index].index != self.index
         @sprite[index].color = Color.new(0,0,0,100)
       else
        @sprite[index].color = Color.new(0,0,0,0)  
       end
     end  
   end
  end
囡囚囨囚囨図囨囧

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
回帖
3515
发表于 2011-11-6 09:56:11 | 显示全部楼层
  1.       if @sprite[index].index != self.index
  2.         @sprite[index].color = Color.new(0,0,0,100)
  3.       else
  4.         @sprite[index].color = Color.new(0,0,0,0)
  5.       end
复制代码
你都找到这段了,还不知道怎么改么
  1. @sprite[index].bitmap = RPG::Cache.picture("原文件名")
  2. @sprite[index].bitmap = RPG::Cache.picture("现文件名")
复制代码
我希望LZ能自己动手试试

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

使用道具 举报

梦石
3
星屑
6420
在线时间
1131 小时
注册时间
2007-12-26
回帖
914
 楼主| 发表于 2011-11-6 12:04:41 | 显示全部楼层
Wind2010 发表于 2011-11-6 09:56
你都找到这段了,还不知道怎么改么我希望LZ能自己动手试试

如果“开始”、“继续”和“退出”这三张图片是不同的文件,那么这一段应该对鼠标停在这三种按钮上做分歧判断吧,怎么写这三种分歧呢?
囡囚囨囚囨図囨囧
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部