Project1

标题: 标题图片按钮能否更换图片?(有工程) [打印本页]

作者: 幻耶    时间: 2011-11-6 09:42
标题: 标题图片按钮能否更换图片?(有工程)
本帖最后由 幻耶 于 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
  enddsu_plus_rewardpost_czw
作者: Wind2010    时间: 2011-11-6 09:56
  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能自己动手试试
作者: 幻耶    时间: 2011-11-6 12:04
Wind2010 发表于 2011-11-6 09:56
你都找到这段了,还不知道怎么改么我希望LZ能自己动手试试

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




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1