查看: 2332|回复: 1

[已经解决] 如何添加鼠标特效?在线等!

[复制链接]
梦石
0
星屑
50
在线时间
207 小时
注册时间
2014-8-16
回帖
62
发表于 2015-6-6 17:22:17 | 显示全部楼层 |阅读模式

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

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

×
如题:如何添加鼠标特效?我想让鼠标点击左键时,在角色行走和寻路状态下添加一个动画效果或者添加一组连续的图片作为动画特效,
鼠标点击图片按钮除外,有办法实现吗?附上我自己的鼠标脚本。最好来个范例工程。谢谢!


[pre lang="ruby"]# 八向行走鼠标脚本系列处理★★★★★★★★★★★★★★★★★★★★★★★★★
#=================以下两个用来调整战斗时的手感问题,可以自己试试。
$敌人选框扩大 = 20
$角色选框扩大 = 30
#==============================================================================
# ● API调用
#==============================================================================
$ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
$GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
$ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
$GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
$Window_HWND = $GetActiveWindow.call
$GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
module Mouse  
LEFT = 0x01
RIGHT = 0x02
def self.init(sprite = nil)
   $ShowCursor.call(0)
   
   
   @cun = 8
    @show_cursor = false
    @mouse_sprite = Sprite.new
    @mouse_sprite.z = 99999
    @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/Normal_p")
    @mouse_sprite.src_rect.set(0, 0, 40, 39)
    @mouse_sprite.src_rect.x = (@cun / 8) % 8 * 40

   
   
   
   
   
   
   
   
   
  
   
   @left_press = false
   @right_press = false
   @left_trigger = false
   @right_trigger = false
   @left_repeat = false
   @right_repeat = false
   @click_lock = false
   update
end
def self.exit
   @mouse_sprite.bitmap.dispose
   @mouse_sprite.dispose
   @show_cursor = true
   $ShowCursor.call(1)
end
def self.mouse_debug
   return @mouse_debug.bitmap
end
def self.update
   left_down = $GetKeyState.call(0x01)
   right_down = $GetKeyState.call(0x02)
    if @cun < 9999
      #if Graphics.frame_count % 2 == 0
        @cun += 1
      #end
    elsif @cun >= 9999 and @cun > 0
      #if Graphics.frame_count % 2 == 0
        @cun -= 1
      #end
    end
    @mouse_sprite.src_rect.set(0, 0, 40, 39)
    @mouse_sprite.src_rect.x = (@cun / 8) % 8 * 40
    @click_lock = false
   
   
     mouse_x, mouse_y = self.get_mouse_pos
    if @mouse_sprite != nil
      @mouse_sprite.x = mouse_x
      @mouse_sprite.y = mouse_y
    end
    if left_down[7] == 1
      @left_repeat = (not @left_repeat)
      @left_trigger = (not @left_press)
      @left_press = true
    else
      @left_press = false
      @left_trigger = false
      @left_repeat = false
    end
    if right_down[7] == 1
      @right_repeat = (not @right_repeat)
      @right_trigger = (not @right_press)
      @right_press = true
    else
      @right_press = false
      @right_trigger = false
      @right_repeat = false
    end
  end
  def self.get_mouse_pos
    point_var = [0, 0].pack('ll')
    if $GetCursorPos.call(point_var) != 0
      if $ScreenToClient.call($Window_HWND, point_var) != 0
        x, y = point_var.unpack('ll')
        if (x < 0) or (x > 10000) then x = 0 end
        if (y < 0) or (y > 10000) then y = 0 end
        if x > 640 then x = 640 end
        if y > 480 then y = 480 end
        return x, y
      else
        return 0, 0
      end
    else
      return 0, 0
    end
  end
  def self.press?(mouse_code)
    if mouse_code == LEFT
      if @click_lock
        return false
      else
        return @left_press
      end
    elsif mouse_code == RIGHT
      return @right_press
    else
      return false
    end
  end
  def self.trigger?(mouse_code)
    if mouse_code == LEFT
      if @click_lock
        return false
      else
        return @left_trigger
      end
    elsif mouse_code == RIGHT
      return @right_trigger
    else
      return false
    end
  end
  def self.repeat?(mouse_code)
    if mouse_code == LEFT
      if @click_lock
        return false
      else
        return @left_repeat
      end
    elsif mouse_code == RIGHT
      return @right_repeat
    else
      return false
    end
  end
  def self.click_lock?
    return @click_lock
  end
  def self.click_lock
    @click_lock = true
  end
  def self.click_unlock
    @click_lock = false
  end
end
   
   
module Input
if @self_update == nil
   @self_update = method('update')
   @self_press = method('press?')
   @self_trigger = method('trigger?')
   @self_repeat = method('repeat?')
end
def self.update
   @self_update.call
   Mouse.update
end
def self.press?(key_code)
   if @self_press.call(key_code)
     return true
   end
   if key_code == C
     return Mouse.press?(Mouse::LEFT)
   elsif key_code == B
     return Mouse.press?(Mouse::RIGHT)
   else
     return @self_press.call(key_code)
   end
end
def self.trigger?(key_code)
   if @self_trigger.call(key_code)
     return true
   end
   if key_code == C
     return Mouse.trigger?(Mouse::LEFT)
   elsif key_code == B
     return Mouse.trigger?(Mouse::RIGHT)
   else
     return @self_trigger.call(key_code)
   end
end
def self.repeat?(key_code)
   if @self_repeat.call(key_code)
     return true
   end
   if key_code == C
     return Mouse.repeat?(Mouse::LEFT)
   elsif key_code == B
     return Mouse.repeat?(Mouse::RIGHT)
   else
     return @self_repeat.call(key_code)
   end
end
end
class Window_Selectable
  if @self_alias == nil
    alias self_update update
    @self_alias = true
  end
  def update
    self_update
    if self.active and @item_max > 0
      index_var = @index
      tp_index = @index
      mouse_x, mouse_y = Mouse.get_mouse_pos
      mouse_not_in_rect = true
      for i in 0...@item_max
        @index = i
        update_cursor_rect
        top_x = self.cursor_rect.x + self.x + 16
        top_y = self.cursor_rect.y + self.y + 16
        bottom_x = top_x + self.cursor_rect.width
        bottom_y = top_y + self.cursor_rect.height
        if (mouse_x > top_x) and (mouse_y > top_y) and
           (mouse_x < bottom_x) and (mouse_y < bottom_y)
          mouse_not_in_rect = false
          if tp_index != @index
            tp_index = @index
            $game_system.se_play($data_system.cursor_se)
          end
          break
        end
      end
      if mouse_not_in_rect
          # 当前行被显示开头行前面的情况下
          if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT) and mouse_y>self.y+self.height/2
            self.top_row +=1
          end
          # 当前行被显示末尾行之后的情况下
          if self.top_row > 0 and Mouse.press?(Mouse::LEFT) and mouse_y<=self.y+self.height/2#self.top_row + (self.page_row_max - 1)
            # 从当前行向末尾滚动
            self.top_row -=1
          end
        @index = index_var
        if self.is_a?(Window_Target)
          @index=-3
        end
        update_cursor_rect
        Mouse.click_lock
      else
        Mouse.click_unlock               
      end
    end
  end
  def update_cursor_rect
    # 光标位置不满 0 的情况下
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # 获取当前的行
    row = @index / @column_max
    # 当前行被显示开头行前面的情况下
    if row < self.top_row
      # 从当前行向开头行滚动
      self.cursor_rect.empty
      return
    end
    # 当前行被显示末尾行之后的情况下
    if row > self.top_row + (self.page_row_max - 1)
      # 从当前行向末尾滚动
      self.cursor_rect.empty
      return
    end
    # 计算光标的宽
    cursor_width = self.width / @column_max - 32
    # 计算光标坐标
    x = @index % @column_max * (cursor_width + 32)
    y = @index / @column_max * 32 - self.oy
    # 更新光标矩形
    self.cursor_rect.set(x, y, cursor_width, 32)
  end
end














##################################################################class Window_Selectable
  class Window_Selectableshen
if @self_alias == nil
    alias self_update update
    @self_alias = true
  end
  def update
    self_update
    if self.active and @item_max > 0
      index_var = @index
      tp_index = @index
      mouse_x, mouse_y = Mouse.get_mouse_pos
      mouse_not_in_rect = true
      for i in 0...@item_max
        @index = i
        update_cursor_rect
        top_x = self.cursor_rect.x + self.x + 16
        top_y = self.cursor_rect.y + self.y + 16
        bottom_x = top_x + self.cursor_rect.width
        bottom_y = top_y + self.cursor_rect.height
        if (mouse_x > top_x) and (mouse_y > top_y) and
           (mouse_x < bottom_x) and (mouse_y < bottom_y)
          mouse_not_in_rect = false
          if tp_index != @index
            tp_index = @index
            $game_system.se_play($data_system.cursor_se)
          end
          break
        end
      end
      if mouse_not_in_rect
          # 当前行被显示开头行前面的情况下
          if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT) and mouse_y>self.y+self.height/2
            self.top_row +=1
          end
          # 当前行被显示末尾行之后的情况下
          if self.top_row > 0 and Mouse.press?(Mouse::LEFT) and mouse_y<=self.y+self.height/2#self.top_row + (self.page_row_max - 1)
            # 从当前行向末尾滚动
            self.top_row -=1
          end
        @index = index_var
        if self.is_a?(Window_Target)
          @index=-3
        end
        update_cursor_rect
        Mouse.click_lock
      else
        Mouse.click_unlock               
      end
    end
  end
  def update_cursor_rect
    # 光标位置不满 0 的情况下
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # 获取当前的行
    row = @index / @column_max
    # 当前行被显示开头行前面的情况下
    if row < self.top_row
      # 从当前行向开头行滚动
      self.cursor_rect.empty
      return
    end
    # 当前行被显示末尾行之后的情况下
    if row > self.top_row + (self.page_row_max - 1)
      # 从当前行向末尾滚动
      self.cursor_rect.empty
      return
    end
    # 计算光标的宽
    cursor_width = self.width / @column_max - 24
    # 计算光标坐标
    x = @index % @column_max * (cursor_width + 24)
    y = @index / @column_max * 24 - self.oy
    # 更新光标矩形
    self.cursor_rect.set(x, y, cursor_width, 24)
  end
end
###############################################################################




















































class Window_NameInput
if @self_alias == nil
   alias self_update update
   @self_alias = true
end
def update
   self_update
   if self.active
     index_var = @index
     mouse_x, mouse_y = Mouse.get_mouse_pos
     mouse_not_in_rect = true
     for i in (0...CHARACTER_TABLE.size).to_a.push(180)
       @index = i
       update_cursor_rect
       top_x = self.cursor_rect.x + self.x + 16
       top_y = self.cursor_rect.y + self.y + 16
       bottom_x = top_x + self.cursor_rect.width
       bottom_y = top_y + self.cursor_rect.height
       if (mouse_x > top_x) and (mouse_y > top_y) and
          (mouse_x < bottom_x) and (mouse_y < bottom_y)
         mouse_not_in_rect = false
         break
       end
     end
     if mouse_not_in_rect
       @index = index_var
       update_cursor_rect
       Mouse.click_lock
     else
       Mouse.click_unlock
     end
   end
end
end
class Window_InputNumber
if @self_alias == nil
   alias self_update update
   @self_alias = true
end
def update
   self_update
   mouse_x, mouse_y = Mouse.get_mouse_pos
   if self.active and @digits_max > 0
     index_var = @index
     mouse_not_in_rect = true
     for i in 0...@digits_max
       @index = i
       update_cursor_rect
       top_x = self.cursor_rect.x + self.x + 16
       bottom_x = top_x + self.cursor_rect.width
       if (mouse_x > top_x) and (mouse_x < bottom_x)
         mouse_not_in_rect = false
         break
       end
     end
     if mouse_not_in_rect
       @index = index_var
       update_cursor_rect
       Mouse.click_lock
     else
       Mouse.click_unlock
     end
   end
   if @last_mouse_y == nil
     @last_mouse_y = mouse_y
   end
   check_pos = (@last_mouse_y - mouse_y).abs
   if check_pos > 10
     $game_system.se_play($data_system.cursor_se)
     place = 10 ** (@digits_max - 1 - @index)
     n = @number / place % 10
     @number -= n * place
     n = (n + 1) % 10 if mouse_y < @last_mouse_y
     n = (n + 9) % 10 if mouse_y > @last_mouse_y
     @number += n * place
     refresh
     @last_mouse_y = mouse_y
   end
end
end
class Scene_File
if @self_alias == nil
   alias self_update update
   @self_alias = true
end
def update
   mouse_x, mouse_y = Mouse.get_mouse_pos
   Mouse.click_lock
   idx = 0
   for i in @savefile_windows
     top_x = i.x + 16
     top_y = i.y + 16
     bottom_x = top_x + i.width
     bottom_y = top_y + i.height
     if (mouse_x > top_x) and (mouse_y > top_y) and
        (mouse_x < bottom_x) and (mouse_y < bottom_y)
       i.selected = true
       if @file_index != idx
         @file_index = idx
         $game_system.se_play($data_system.cursor_se)
       end            
       Mouse.click_unlock
     else
       i.selected = false
     end
     idx += 1
   end
   self_update
end
end
class Arrow_Enemy
if @self_alias == nil
   alias self_update update
   @self_alias = true
end
def update
   mouse_x, mouse_y = Mouse.get_mouse_pos
   idx = 0
   for i in $game_troop.enemies do
     if i.exist?
       top_x = i.screen_x - self.ox - 420
       top_y = i.screen_y - self.oy - 50
       bottom_x = top_x + self.src_rect.width
       bottom_y = top_y + self.src_rect.height
       if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
          (mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
         if @index != idx
           $game_system.se_play($data_system.cursor_se)
           @index = idx
         end
       end
     end
     idx += 1
   end
   self_update
end
end
class Arrow_Actor
if @self_alias == nil
   alias self_update update
   @self_alias = true
end
def update
   mouse_x, mouse_y = Mouse.get_mouse_pos
   idx = 0
   for i in $game_party.actors do
     #if i.exist? #不注释掉,角色死亡后就不能用鼠标了!
       top_x = i.screen_x - self.ox - 420
       top_y = i.screen_y - self.oy - 50
       bottom_x = top_x + self.src_rect.width
       bottom_y = top_y + self.src_rect.height
       if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
          (mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
         if @index != idx
           $game_system.se_play($data_system.cursor_se)
           @index = idx
         end
       end
     #end #不注释掉,角色死亡后就不能用鼠标了!
     idx += 1
   end
   self_update
end
end

class Game_Player
if @self_alias == nil
   alias self_update update
   @self_alias = true
end

def get_mouse_sta
   return @mouse_sta
end

def update
   mouse_x, mouse_y = Mouse.get_mouse_pos
   @mtp_x = mouse_x
   @mtp_y = mouse_y
   
    # 宝宝按扭
  
         
           if @mtp_x >= 422 and @mtp_x <= 452 and @mtp_y >= 450 and @mtp_y <= 477
     $game_screen.pictures[1].show("宠物1", 0, 418, 430, 100.0, 100.0, 255, 0)
     
     #$game_screen.pictures[30].show("宝宝", 0, 428, 452, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[1].erase
      $game_screen.pictures[30].erase
        Audio.se_play("Audio/SE/"+"退出",100,100)
    $scene =  Scene_Baby.new
        # $scene = Scene_Menu.new
        
        #$game_temp.common_event_id = 21
      end
    else
      $game_screen.pictures[1].erase
            $game_screen.pictures[30].erase
      end
         
         
         
         
         
         
         
         
         
    if @mtp_x >= 0 and @mtp_x <= 30 and @mtp_y >= 450 and @mtp_y <= 477
     #$game_screen.pictures[4].show("时间", 0, 402, 452, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
      
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[50].erase
       Audio.se_play("Audio/SE/"+"退出",100,100)
       $game_temp.common_event_id = 60
      end
   else
     # $game_screen.pictures[4].erase
      
   end
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
    if @mtp_x >= 392 and @mtp_x <= 422 and @mtp_y >= 450 and @mtp_y <= 477
    # $game_screen.pictures[41].show("变", 0, 398, 452, 100.0, 100.0, 255, 0)
     $game_screen.pictures[40].show("变身1", 0, 388, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[41].erase
      $game_screen.pictures[40].erase
     #  Audio.se_play("Audio/SE/"+"退出",100,100)
      $scene = Scene_Lvup.new
        
      end
    else
      $game_screen.pictures[41].erase
            $game_screen.pictures[40].erase
      end
    if @mtp_x >= 40 and @mtp_x <= 80 and @mtp_y >= 450 and @mtp_y <= 477
   #  $game_screen.pictures[44].show("物品", 0, 402, 452, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[50].erase
   #     Audio.se_play("Audio/SE/"+"退出",100,100)
       #$game_temp.common_event_id = 151
      end
   else
      
   end
  
   ##########################
   
   
    # 坐骑按扭
   if @mtp_x >= 482 and @mtp_x <= 512 and @mtp_y >= 450 and @mtp_y <= 477
    # $game_screen.pictures[46].show("坐骑", 0, 490, 452, 100.0, 100.0, 255, 0)
      $game_screen.pictures[29].show("坐骑11", 0, 476, 430, 100.0, 100.0, 255, 0)
     
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[46].erase
       $game_screen.pictures[29].erase
    #   Audio.se_play("Audio/SE/"+"退出",100,100)
        $game_temp.common_event_id = 77
        
        $scene = Scene_Troop.new
      end
   else
      $game_screen.pictures[29].erase
       $game_screen.pictures[46].erase
   end
   
    # 状态按扭
  
   if @mtp_x >= 530 and @mtp_x <= 550 and @mtp_y >= 0 and @mtp_y <= 40
   #  $game_screen.pictures[47].show("状态", 0, 542, 452, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[47].erase
      $scene = Scene_Cta.new
   #  Audio.se_play("Audio/SE/"+"退出",100,100)
        #$game_temp.common_event_id =39
         #Scene_Status
      end
   else
     $game_screen.pictures[47].erase
   end
    if @mtp_x >= 550 and @mtp_x <= 640 and @mtp_y >= 0 and @mtp_y <= 40
    # $game_screen.pictures[4].show("状态", 0, 542, 452, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::B)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[4].erase
      
        # $game_temp.common_event_id = 280
      end
   else
     $game_screen.pictures[4].erase
   end
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
  
   
   # 物品按扭
   if @mtp_x >= 308 and @mtp_x <= 326 and @mtp_y >= 450 and @mtp_y <= 477
    # $game_screen.pictures[50].show("物品", 0, 308, 452, 100.0, 100.0, 255, 0)
     $game_screen.pictures[38].show("道具1", 0, 298, 430, 100.0, 100.0, 255, 0)
     
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[50].erase
        $game_screen.pictures[38].erase
      
    #   Audio.se_play("Audio/SE/"+"退出",100,100)
      $scene = Scene_Item.new
      
      end
   else
     $game_screen.pictures[50].erase
     $game_screen.pictures[38].erase
   end
   
   # 装备按扭
   if @mtp_x >= 332 and @mtp_x <= 362 and @mtp_y >= 450 and @mtp_y <= 477
   #  $game_screen.pictures[48].show("装备", 0, 339, 452, 100.0, 100.0, 255, 0)
     $game_screen.pictures[28].show("装备1", 0, 329, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[48].erase
        $game_screen.pictures[28].erase
      #   Audio.se_play("Audio/SE/"+"拔剑",100,100)
         
        $scene = Scene_Equip.new

      # $game_temp.common_event_id =390
    end
   else
     $game_screen.pictures[48].erase
       $game_screen.pictures[28].erase
     end  
     
     
   
   # 小地图按扭
   #if @mtp_x >= 1 and @mtp_x <= 15 and @mtp_y >= 20 and @mtp_y <= 38
   #  $game_screen.pictures[48].show("装备", 0, 339, 452, 100.0, 100.0, 255, 0)
     #$game_screen.pictures[57].show("小地图1", 0, 44, 60, 100.0, 100.0, 255, 0)
     #if Input.trigger?(Input::C)
       #$game_system.se_play($data_system.decision_se); $game_screen.pictures[67].erase
        #$game_screen.pictures[57].erase
      #   Audio.se_play("Audio/SE/"+"拔剑",100,100)
         
      
  


      
      # $game_temp.common_event_id =390
      
     
    #end   
   #else
     #$game_screen.pictures[57].erase
       #$game_screen.pictures[67].erase
   #end  

   
   
   
   
   
   
   # 状态按扭
   if @mtp_x >= 362 and @mtp_x <= 392 and @mtp_y >= 450 and @mtp_y <= 477
    # $game_screen.pictures[37].show("状态", 0, 369, 452, 100.0, 100.0, 255, 0)
      $game_screen.pictures[27].show("状态1", 0, 359, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[37].erase
        $game_screen.pictures[27].erase
     # $game_temp.common_event_id = 80
      $scene = Scene_Dzz.new
     #  Audio.se_play("Audio/SE/"+"轮回",100,100)
     #   $scene = Scene_Status.new
      

      end
   else
     $game_screen.pictures[37].erase
          $game_screen.pictures[27].erase
   end
   # 特技按扭
   if @mtp_x >= 452 and @mtp_x <= 482 and @mtp_y >= 450 and @mtp_y <= 477
   #  $game_screen.pictures[49].show("特技", 0, 459, 452, 100.0, 100.0, 255, 0)
      $game_screen.pictures[36].show("特技1", 0, 449, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[49].erase
       $game_screen.pictures[36].erase
      #  Audio.se_play("Audio/SE/"+"拔剑",100,100)
       $scene = Scene_Skill.new
      
      end
   else
     $game_screen.pictures[49].erase
         $game_screen.pictures[36].erase
   end
   # 任务按扭
   if @mtp_x >= 512 and @mtp_x <= 542 and @mtp_y >= 450 and @mtp_y <= 477
    # $game_screen.pictures[45].show("任务", 0, 519, 452, 100.0, 100.0, 255, 0)
      $game_screen.pictures[35].show("任务1", 0, 509, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[45].erase
        $game_screen.pictures[35].erase
#          Audio.se_play("Audio/SE/"+"轮回",100,100)
      $scene = Scene_Task.new
      # $scene=Scene_RecordBook.new
      end
   else
     $game_screen.pictures[45].erase
          $game_screen.pictures[35].erase
   end
   # 存挡按扭
   if @mtp_x >= 572 and @mtp_x <= 612 and @mtp_y >= 450 and @mtp_y <= 477
  #   $game_screen.pictures[44].show("存档", 0, 579, 452, 100.0, 100.0, 255, 0)
     $game_screen.pictures[34].show("存档1", 0, 569, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[44].erase
       $game_screen.pictures[34].erase
      # $scene = Scene_Save.new
   #   Audio.se_play("Audio/SE/"+"轮回",100,100)
        $scene = Scene_Compose.new
    #   $scene = Scene_Loadsave.new
      end
   else
     $game_screen.pictures[44].erase
          $game_screen.pictures[34].erase
   end
   # 读挡按扭
   if @mtp_x >= 542 and @mtp_x <= 572 and @mtp_y >= 450 and @mtp_y <= 477
   #  $game_screen.pictures[43].show("读档", 0, 549, 452, 100.0, 100.0, 255, 0)
      $game_screen.pictures[33].show("读档1", 0, 539, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[43].erase
       $game_screen.pictures[33].erase
      # $scene = Scene_Load.new
     #  Audio.se_play("Audio/SE/"+"退出",100,100)
       #$game_temp.common_event_id = 184
        $scene = Scene_Status.new
      
      end
   else
     $game_screen.pictures[43].erase
          $game_screen.pictures[33].erase
   end
   # 退出按扭
   if @mtp_x >= 612 and @mtp_x <= 642 and @mtp_y >= 450 and @mtp_y <= 477
    # $game_screen.pictures[42].show("退出", 0, 609, 450, 100.0, 100.0, 255, 0)
       $game_screen.pictures[32].show("退出1", 0, 602, 430, 100.0, 100.0, 255, 0)
     if Input.trigger?(Input::C)
       $game_system.se_play($data_system.decision_se); $game_screen.pictures[42].erase
       $game_screen.pictures[32].erase
    #   Audio.se_play("Audio/SE/"+"轮回",100,100)
      # $scene = Scene_End.new
      $scene = Scene_Dz.new
      
      
      end
   else
     $game_screen.pictures[42].erase
          $game_screen.pictures[32].erase
        end
        
      
        
        
        
   # 地图界面按扭操作系统★★★★★★★★★★★★★★★★★★★★★
   unless $game_system.map_interpreter.running? and @mouse_sta == 2 #鼠标状态不为跟随状态
     #得到鼠标图标方向
     $mouse_icon_id = $game_map.check_event_custom(mouse_x,mouse_y)  if not [11, 12, 13, 14, 16, 17, 18, 19].include?($mouse_icon_id)
  else
     #令鼠标图标为正常
     $mouse_icon_id = 0 if @mouse_sta != 2
   end
   #if Mouse.trigger?(Mouse::LEFT)
   if Mouse.press?(Mouse::LEFT) && $game_player.move_key == true #★★★★★
   #if Mouse.trigger?(Mouse::LEFT) && $game_player.move_key == true #★★★★★     
   
     unless $game_system.map_interpreter.running? or
            # 地图界面按扭操作系统★★★★★★★★★★★★★★★★★★★★★
            @move_route_forcing or $game_temp.message_window_showing or @mtp_y >= 438
            # 地图界面按扭操作系统★★★★★★★★★★★★★★★★★★★★★
       #初始化
       @mouse_sta = 1
       p_direction = 5
       #检查鼠标处能否开启事件
       event_start,p_direction = $game_map.check_event_custom_start(mouse_x, mouse_y)
       #若在移动中再次点击鼠标左键(即双击左键),则改鼠标状态为跟随状态
       @mouse_sta = 2 if @paths_id != nil and @paths_id != @paths.size
       if @mouse_sta != 2
         #鼠标状态不为跟随状态则取数据并初始化路径
         trg_x = (mouse_x + $game_map.display_x / 4) / 32
         trg_y = (mouse_y + $game_map.display_y / 4) / 32
         @paths = []
         @paths_id = 0
         if event_start == 0 #若不能开启事件
           if trg_x != $game_player.x or trg_y != $game_player.y #若目标不为自身则开始寻路
             find_path = Find_Path.new
             @paths = find_path.find_player_short_path(trg_x, trg_y, @mtp_x, @mtp_y)
           end
         else #若能开启事件则改变角色朝向
           @direction = p_direction
         end
       end
     end
   end
   #开始移动
   if @mouse_sta != nil and @mouse_sta == 1 #若鼠标状态为寻路状态
     
     unless moving? or $game_system.map_interpreter.running? or
            @move_route_forcing or $game_temp.message_window_showing #排除无效情况
       if @paths_id != nil and @paths != nil and @paths_id <= @paths.size #若没有完成路径
         case @paths[@paths_id] #判断路径
         when 6
           @last_move_x = true
           move_right
           @paths_id += 1
           @direction = 6
         when 4
           @last_move_x = true
           move_left
           @paths_id += 1
           @direction = 4
         when 2
           @last_move_x = false
           move_down
           @direction = 2
           @paths_id += 1
         when 8
           @last_move_x = false
           move_up
           @direction = 8
           @paths_id += 1
         #斜四方向
         when 1
           @last_move_x = false
           move_lower_left
           @direction = 1
           @paths_id += 1
         when 3
           @last_move_x = false
           move_lower_right
           @direction = 3
           @paths_id += 1
         when 7
           @last_move_x = false
           move_upper_left
           @direction = 7
           @paths_id += 1
         when 9
           @last_move_x = false
           move_upper_right
           @direction = 9
           @paths_id += 1
         end
       end
     end
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
         
     
     
     
     
     
     
     
     
     
     
     
     
     
     
   elsif @paths != nil and @mouse_sta == 2 #当鼠标状态为跟随,且在移动中
     
     
     
   
     
     
     
     #if Mouse.press?( Mouse::LEFT ) #持续按住鼠标
     if Mouse.press?(Mouse::LEFT) && $game_player.move_key == true #★★★★★     
      
       unless moving? or $game_system.map_interpreter.running? or
              @move_route_forcing or $game_temp.message_window_showing #排除无效情况
         #跟随方向判断并跟随
         rate =  $game_map.show_rate(self)
         width = (RPG::Cache.character(self.character_name,self.character_hue).width / 8) * rate
         height = (RPG::Cache.character(self.character_name,self.character_hue).height / 8) * rate
         self_ox = (self.screen_x - width / 2 + self.screen_x + width / 2) / 2
         self_oy = (self.screen_y - height + self.screen_y) / 2
         if (@mtp_x - self_ox)*(@mtp_x - self_ox) + (@mtp_y - self_oy)*(@mtp_y - self_oy) >= 961
           if @mtp_x > self_ox
             if self_oy - @mtp_y < 0.4 * (@mtp_x - self_ox) and
                @mtp_y - self_oy < 0.4 * (@mtp_x - self_ox)
               move_right
               $mouse_icon_id = 16
               @direction = 6
             end
             if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
               move_lower_right
               $mouse_icon_id = 13
               @direction = 3
             end
             if @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
               move_upper_right
               $mouse_icon_id = 19
               @direction = 9
             end
             if @mtp_y - self_oy > 2.4 * ( @mtp_x - self_ox )
               move_down
               $mouse_icon_id = 12
               @direction = 2
             end
             if @mtp_y - self_oy < - 2.4 * ( @mtp_x - self_ox )
               move_up
               $mouse_icon_id = 18
               @direction = 8
             end
           end
           if @mtp_x < self_ox
             if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x )
               move_left
               $mouse_icon_id = 14
               @direction = 4
             end
             if @mtp_y - self_oy > 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy < 2.4 * ( self_ox - @mtp_x )
               move_lower_left
               $mouse_icon_id = 11
               @direction = 1
             end
             if @mtp_y - self_oy < - 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy > - 2.4 * ( self_ox - @mtp_x )
               move_upper_left
               $mouse_icon_id = 17
               @direction = 7
             end
             if @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
               move_down
               $mouse_icon_id = 12
               @direction = 2
             end
             if @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
               move_up
               $mouse_icon_id = 18
               @direction = 8
             end
           end
         end
            if @mtp_x > self_ox
             if @mtp_y - self_oy > - 0.4 * ( @mtp_x - self_ox ) and
                @mtp_y - self_oy < 0.4 * ( @mtp_x - self_ox )
               $mouse_icon_id = 16
               @direction = 6
             end
             if @mtp_y - self_oy > 0.4 * ( @mtp_x - self_ox ) and
               @mtp_y - self_oy < 2.4 * ( @mtp_x - self_ox )
               $mouse_icon_id = 13
               @direction = 3
             end
             if @mtp_y - self_oy < - 0.4 * ( @mtp_x - self_ox ) and
               @mtp_y - self_oy > - 2.4 * ( @mtp_x - self_ox )
               $mouse_icon_id = 19
               @direction = 9
             end
             if @mtp_y - self_oy > 2.4 * ( @mtp_x - self_ox )
               $mouse_icon_id = 12
               @direction = 2
             end
             if @mtp_y - self_oy < - 2.4 * ( @mtp_x - self_ox )
               $mouse_icon_id = 18
               @direction = 8
             end
           end
           if @mtp_x < self_ox
             if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x )
               $mouse_icon_id = 14
               @direction = 4
             end
             if @mtp_y - self_oy > 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy < 2.4 * ( self_ox - @mtp_x )
               $mouse_icon_id = 11
               @direction = 1
             end
             if @mtp_y - self_oy < - 0.4 * ( self_ox - @mtp_x ) and
                @mtp_y - self_oy > - 2.4 * ( self_ox - @mtp_x )
               $mouse_icon_id = 17
               @direction = 7
             end
             if @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
               $mouse_icon_id = 12
               @direction = 2
             end
             if @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
               $mouse_icon_id = 18
               @direction = 8
             end
           end
         end
         
  
         
         

         
         
         
         
         
         
         
         
         
         
         
     else #没状态的情况
       $mouse_icon_id = 0
       @mouse_sta = 0
       @paths_id = @paths.size #终止寻路移动
     end
   end
   self_update
end
end






Mouse.init
END { Mouse.exit }
# 八向行走鼠标脚本系列处理★★★★★★★★★★★★★★★★★★★★★★★★★
[/pre]
梦石
0
星屑
34462
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-6-6 22:32:36 | 显示全部楼层
能实现但是比较麻烦。
再者还要除了图片按钮之外,谁知道你那个图片按钮是什么玩意儿,用什么方法显示的,显示的位置又是哪儿,
总得有个判断的依据不是?!
坐等有空的大蛇。

点评

问题已成功解决,还是要谢谢你!  发表于 2015-6-7 10:04

评分

参与人数 1星屑 +50 收起 理由
RyanBern + 50 塞糖

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部