查看: 2256|回复: 7

[已经解决] 如何將透明選框改成小三角形箭頭

[复制链接]
梦石
0
星屑
50
在线时间
6 小时
注册时间
2014-6-1
回帖
4
发表于 2014-6-1 23:54:09 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 沒有牙齒的我 于 2014-6-2 16:13 编辑

在下剛接觸RPG MAKER
想請問如何將透明選框改成前面一個小三角形鍵頭呢??
雖然我附上的圖片是標題畫面的
但希望遊戲中的選項也能改成小三角形箭頭

之前有爬到相關文章 但那篇是XP適用的
在此求VA教程.........感激不盡!!!!!

選框

選框
梦石
1
星屑
7574
在线时间
2650 小时
注册时间
2013-8-23
回帖
2152

开拓者

发表于 2014-6-2 02:03:03 | 显示全部楼层
[pre lang="ruby" line="1"]#==============================================================================
# +++ MOG - Animated Cursor (V1.1) +++
#==============================================================================
# By Moghunter
# http://www.atelier-rgss.com/
#==============================================================================
# Adiciona um cursor animado nos menus de comandos.
#==============================================================================
# Será necessário ter a imagem
#
# Menu_Cursor.png
#
# gravado na pasta GRAPHICS/SYSTEM/
#==============================================================================
# Ativando a animação do cursor
#
# Basta criar uma imagem que tenha a largura com no minimo o dobro de altura da
# imagem do cursor.
#
# EX
# largura 32 pixel (width) altura 32 pixel = 1 frames de animação.(Sem animação)
# largura 64 pixel (width) altura 32 pixel = 2 frames de animação.
# largura 128 pixel (width) altura 32 pixel = 4 frames de animação.
# largura 256 pixel (width) altura 32 pixel = 8 frames de animação
# Etc...
#
# NOTA
# Não há limite para quantidade de frames de animação, se não quiser a animação
# basta criar uma imagem com a altura proporcional a largura da imagem.
#
#==============================================================================
# ● Histórico (Version History)
#==============================================================================
# v 1.1 - Correção da posição do cursor no cena de batalha.
#==============================================================================

module MOG_MENU_CURSOR
  #Ativar animação do cursor se movimentando para os lados.
  SIDE_ANIMATION = true
  #Definição da posição do cursor. (Ajustes na posição)
  CURSOR_POSITION = [0,0]
  #Definição da velocidade da animação de frames.
  CURSOR_ANIMATION_SPEED = 6
end

#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
  
  attr_accessor :menu_cursor_name
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------      
  alias mog_menu_cursor_initialize initialize
  def initialize
      mog_menu_cursor_initialize
      @menu_cursor_name = "Menu_Cursor"
  end  
  
end  

#==============================================================================
# ■ Game_Temp
#==============================================================================
class Game_Temp
  
  attr_accessor :menu_cursor   
   
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------      
  alias mog_cursor_sprite_initialize initialize
  def initialize
      mog_cursor_sprite_initialize
      @menu_cursor = [false,0,0,0]
  end  
  
end  

#==============================================================================
# ■ Sprite Cursor
#==============================================================================
class Sprite_Cursor < Sprite
  
  include MOG_MENU_CURSOR
  
  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------   
  def initialize(viewport = nil , x , y)
      super(viewport)
      @cursor_image = Cache.system($game_system.menu_cursor_name.to_s)
      @frame_max = (@cursor_image.width / @cursor_image.height) rescue 1
      @frame_range = @frame_max > 0 ? (@cursor_image.width  / @frame_max) : 1
      @frame = 0
      @ca_speed = CURSOR_ANIMATION_SPEED
      self.bitmap = Bitmap.new(@frame_range,@frame_range)
      self.z = 10000
      self.opacity = 0
      @cw = self.bitmap.width / 2
      @c_p = [-@cw + CURSOR_POSITION[0],CURSOR_POSITION[1]]
      @mx = [0,0,0]
      refresh_animation(true)
      update_move
  end
  
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------   
  def dispose
      self.bitmap.dispose
      self.bitmap = nil
      @cursor_image.dispose
  end  
  
  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------  
  def update
      if cursor_visible?
         self.visible = true
         update_move
         refresh_animation(false)
      else   
         self.visible = false
      end  
  end

  #--------------------------------------------------------------------------
  # ● Initialize
  #--------------------------------------------------------------------------      
  def refresh_animation(start = false)
      @ca_speed += 1
      return if @frame_max == 1 and !start
      return if @ca_speed < CURSOR_ANIMATION_SPEED
      @ca_speed = 0
      self.bitmap.clear
      scr_rect = Rect.new(@frame_range * @frame,0,@frame_range,@frame_range)
      self.bitmap.blt(0,0,@cursor_image, scr_rect)
      @frame += 1
      @frame = 0 if @frame >= @frame_max
  end  
   
  #--------------------------------------------------------------------------
  # ● Cursor Visible?
  #--------------------------------------------------------------------------   
  def cursor_visible?
      px = $game_temp.menu_cursor[2]
      py = $game_temp.menu_cursor[3]
      return false if $game_temp.menu_cursor[1] == 0
      return false if px < 0 or py < 0 or (px == 0 and py == 0)
      return true
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Move
  #--------------------------------------------------------------------------   
  def update_move
      self.opacity += 25
      @new_pos = [$game_temp.menu_cursor[2],$game_temp.menu_cursor[3]]
      execute_animation_s
      execute_move(0,self.x, @new_pos[0] + @mx[1] + @c_p[0])
      execute_move(1,self.y, @new_pos[1] + @c_p[1])
  end  
  
  #--------------------------------------------------------------------------
  # ● Execute Animation S
  #--------------------------------------------------------------------------      
  def execute_animation_s
      return if !SIDE_ANIMATION
      @mx[2] += 1
      return if @mx[2] < 4
      @mx[2] = 0
      @mx[0] += 1
      case @mx[0]
         when 1..7;  @mx[1] += 1            
         when 8..14; @mx[1] -= 1
         else
           @mx[0] = 0
           @mx[1] = 0
      end
  end
  
  #--------------------------------------------------------------------------
  # ● Execute Move
  #--------------------------------------------------------------------------      
  def execute_move(type,cp,np)
      sp = 5 + ((cp - np).abs / 5)
      if cp > np
         cp -= sp
         cp = np if cp < np
      elsif cp < np
         cp += sp
         cp = np if cp > np
      end     
      self.x = cp if type == 0
      self.y = cp if type == 1
  end  
  
end

#==============================================================================
# ■ CURSOR_MENU SPRITE
#==============================================================================
module CURSOR_MENU_SPRITE
  
  #--------------------------------------------------------------------------
  # ● Cursor Sprite Enable
  #--------------------------------------------------------------------------      
  def cursor_sprite_enable
      return if self.index == nil rescue return
      create_cursor_sprite
      update_cursor_sprite
      update_cusor_position
      if !self.active
         $game_temp.menu_cursor[1] -= 1 if $game_temp.menu_cursor[1] > 0
      end
  end
   
  #--------------------------------------------------------------------------
  # ● Create Cursor Sprite
  #--------------------------------------------------------------------------   
  def create_cursor_sprite
      return if @cursor != nil
      return if $game_temp.menu_cursor[0]
      $game_temp.menu_cursor[0] = true
      reset_cursor_position
      @cursor = Sprite_Cursor.new(nil,x,y)
      @cursor_name = $game_system.menu_cursor_name
  end   
  
  #--------------------------------------------------------------------------
  # ● Dispose Cursor Sprite
  #--------------------------------------------------------------------------      
  def dispose_cursor_sprite
      return if @cursor == nil
      $game_temp.menu_cursor[0] = false
      reset_cursor_position
      @cursor.dispose
      @cursor = nil
  end  

  #--------------------------------------------------------------------------
  # ● Reset Cursor Position
  #--------------------------------------------------------------------------        
  def reset_cursor_position
      $game_temp.menu_cursor[1] = 0
      $game_temp.menu_cursor[2] = -32
      $game_temp.menu_cursor[3] = -32
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Cursor
  #--------------------------------------------------------------------------         
  def update_cursor_sprite
      return if @cursor == nil
      @cursor.update
      refresh_cursor_sprite if @cursor_name != $game_system.menu_cursor_name
  end
  
  #--------------------------------------------------------------------------
  # ● Refresh Cursor Sprite
  #--------------------------------------------------------------------------            
  def refresh_cursor_sprite
      @cursor_name = $game_system.menu_cursor_name
      dispose_cursor_sprite
      create_cursor_sprite
  end  
  
  #--------------------------------------------------------------------------
  # ● Update Cursor Position
  #--------------------------------------------------------------------------         
  def update_cusor_position
      return if !can_update_cursor_position?
      x_v = [0,0]
      if self.viewport != nil and SceneManager.scene_is?(Scene_Battle)
        x_v = [-self.viewport.ox, self.viewport.rect.y]
      end
      x_e = (self.cursor_rect.x + self.x) - self.ox
      $game_temp.menu_cursor[2] = x_e + x_v[0]
      y_e = (self.cursor_rect.y + self.y + self.cursor_rect.height / 2) - self.oy
      $game_temp.menu_cursor[3] = y_e + x_v[1]
      $game_temp.menu_cursor[1] = 13
   end
   
  #--------------------------------------------------------------------------
  # ● Can Update Cursor
  #--------------------------------------------------------------------------            
   def can_update_cursor_position?
       return false if !self.active     
       return false if self.index < 0
       return false if !self.visible
       return true
   end  

end

#==============================================================================
# ■ Window Base
#==============================================================================
class Window_Base < Window
  include CURSOR_MENU_SPRITE
  
  #--------------------------------------------------------------------------
  # ● Dispose
  #--------------------------------------------------------------------------              
  alias mog_menu_cursor_base_dispose dispose
  def dispose
      mog_menu_cursor_base_dispose
      dispose_cursor_sprite
  end  

  #--------------------------------------------------------------------------
  # ● Update
  #--------------------------------------------------------------------------              
  alias mog_cursor_update update
  def update
      mog_cursor_update
      cursor_sprite_enable
  end   
  
end

$mog_rgss3_animated_cursor = true[/pre]


素材: 请放进\Graphics\System

Menu_Cursor.png

Menu_Cursor2.png





评分

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

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
6 小时
注册时间
2014-6-1
回帖
4
 楼主| 发表于 2014-6-2 09:37:47 | 显示全部楼层
鑫晴 发表于 2014-6-2 02:03
#==============================================================================
# +++ MOG - Animated ...

是直接新增一個腳本然後貼上去嗎?
可是我貼了以後一直出現這個 是為什麼呢?
也有把素材放進\Graphics\System了呀...
回复

使用道具 举报

梦石
0
星屑
600
在线时间
1118 小时
注册时间
2012-12-24
回帖
761
发表于 2014-6-2 09:39:41 | 显示全部楼层
本帖最后由 江户川洛奇 于 2014-6-2 09:43 编辑
沒有牙齒的我 发表于 2014-6-2 09:37
是直接新增一個腳本然後貼上去嗎?
可是我貼了以後一直出現這個 是為什麼呢?
也有把素材放進\Graphics\Sys ...


那一连串是论坛的自动加的地址,你只要把104行的地址删掉就行了

点评

发帖被坑了,编辑一下吧  发表于 2014-6-2 09:43

点击签名档去一个神奇的地方
回复

使用道具 举报

梦石
0
星屑
50
在线时间
6 小时
注册时间
2014-6-1
回帖
4
 楼主| 发表于 2014-6-2 10:28:58 | 显示全部楼层
江户川洛奇 发表于 2014-6-2 09:39
那一连串是论坛的自动加的地址,你只要把104行的地址删掉就行了


我把104行刪減到剩下@mx[/url] = [0,0,0]
但又變成190行發生問題了...
如果整行刪除也還是會出問題
求解...
回复

使用道具 举报

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-6-2 10:46:16 | 显示全部楼层
沒有牙齒的我 发表于 2014-6-2 10:28
我把104行刪減到剩下@mx[/url] = [0,0,0]
但又變成190行發生問題了...
如果整行刪除也還是會出問題

把“[/url]"也删除
回复

使用道具 举报

梦石
0
星屑
60
在线时间
214 小时
注册时间
2014-1-23
回帖
177
发表于 2014-6-2 12:20:04 | 显示全部楼层
……越看越晕了@ @
要是只想改菜单的话,似乎改改menu_base还有窗口,然后把系统图片改改就行;如果想省点事儿的话……直接把系统里面那张图片边框改一下就行了……但是这样缺点就是所有带框的都会变……
回复

使用道具 举报

梦石
0
星屑
50
在线时间
6 小时
注册时间
2014-6-1
回帖
4
 楼主| 发表于 2014-6-2 16:16:47 | 显示全部楼层
已經解決了
感謝熱心替我解決問題的各位
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部