查看: 2383|回复: 1

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

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

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

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

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


  1. # 八向行走鼠标脚本系列处理★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  3. $敌人选框扩大 = 20
  4. $角色选框扩大 = 30
  5. #==============================================================================
  6. # ● API调用
  7. #==============================================================================
  8. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  9. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  10. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  11. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  12. $Window_HWND = $GetActiveWindow.call
  13. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  14. module Mouse  
  15. LEFT = 0x01
  16. RIGHT = 0x02
  17. def self.init(sprite = nil)
  18.    $ShowCursor.call(0)
  19.    
  20.    
  21.    @cun = 8
  22.     @show_cursor = false
  23.     @mouse_sprite = Sprite.new
  24.     @mouse_sprite.z = 99999
  25.     @mouse_sprite.bitmap = Bitmap.new("Graphics/Mouse/Normal_p")
  26.     @mouse_sprite.src_rect.set(0, 0, 40, 39)
  27.     @mouse_sprite.src_rect.x = (@cun / 8) % 8 * 40

  28.    
  29.    
  30.    
  31.    
  32.    
  33.    
  34.    
  35.    
  36.    
  37.   
  38.    
  39.    @left_press = false
  40.    @right_press = false
  41.    @left_trigger = false
  42.    @right_trigger = false
  43.    @left_repeat = false
  44.    @right_repeat = false
  45.    @click_lock = false
  46.    update
  47. end
  48. def self.exit
  49.    @mouse_sprite.bitmap.dispose
  50.    @mouse_sprite.dispose
  51.    @show_cursor = true
  52.    $ShowCursor.call(1)
  53. end
  54. def self.mouse_debug
  55.    return @mouse_debug.bitmap
  56. end
  57. def self.update
  58.    left_down = $GetKeyState.call(0x01)
  59.    right_down = $GetKeyState.call(0x02)
  60.     if @cun < 9999
  61.       #if Graphics.frame_count % 2 == 0
  62.         @cun += 1
  63.       #end
  64.     elsif @cun >= 9999 and @cun > 0
  65.       #if Graphics.frame_count % 2 == 0
  66.         @cun -= 1
  67.       #end
  68.     end
  69.     @mouse_sprite.src_rect.set(0, 0, 40, 39)
  70.     @mouse_sprite.src_rect.x = (@cun / 8) % 8 * 40
  71.     @click_lock = false
  72.    
  73.    
  74.      mouse_x, mouse_y = self.get_mouse_pos
  75.     if @mouse_sprite != nil
  76.       @mouse_sprite.x = mouse_x
  77.       @mouse_sprite.y = mouse_y
  78.     end
  79.     if left_down[7] == 1
  80.       @left_repeat = (not @left_repeat)
  81.       @left_trigger = (not @left_press)
  82.       @left_press = true
  83.     else
  84.       @left_press = false
  85.       @left_trigger = false
  86.       @left_repeat = false
  87.     end
  88.     if right_down[7] == 1
  89.       @right_repeat = (not @right_repeat)
  90.       @right_trigger = (not @right_press)
  91.       @right_press = true
  92.     else
  93.       @right_press = false
  94.       @right_trigger = false
  95.       @right_repeat = false
  96.     end
  97.   end
  98.   def self.get_mouse_pos
  99.     point_var = [0, 0].pack('ll')
  100.     if $GetCursorPos.call(point_var) != 0
  101.       if $ScreenToClient.call($Window_HWND, point_var) != 0
  102.         x, y = point_var.unpack('ll')
  103.         if (x < 0) or (x > 10000) then x = 0 end
  104.         if (y < 0) or (y > 10000) then y = 0 end
  105.         if x > 640 then x = 640 end
  106.         if y > 480 then y = 480 end
  107.         return x, y
  108.       else
  109.         return 0, 0
  110.       end
  111.     else
  112.       return 0, 0
  113.     end
  114.   end
  115.   def self.press?(mouse_code)
  116.     if mouse_code == LEFT
  117.       if @click_lock
  118.         return false
  119.       else
  120.         return @left_press
  121.       end
  122.     elsif mouse_code == RIGHT
  123.       return @right_press
  124.     else
  125.       return false
  126.     end
  127.   end
  128.   def self.trigger?(mouse_code)
  129.     if mouse_code == LEFT
  130.       if @click_lock
  131.         return false
  132.       else
  133.         return @left_trigger
  134.       end
  135.     elsif mouse_code == RIGHT
  136.       return @right_trigger
  137.     else
  138.       return false
  139.     end
  140.   end
  141.   def self.repeat?(mouse_code)
  142.     if mouse_code == LEFT
  143.       if @click_lock
  144.         return false
  145.       else
  146.         return @left_repeat
  147.       end
  148.     elsif mouse_code == RIGHT
  149.       return @right_repeat
  150.     else
  151.       return false
  152.     end
  153.   end
  154.   def self.click_lock?
  155.     return @click_lock
  156.   end
  157.   def self.click_lock
  158.     @click_lock = true
  159.   end
  160.   def self.click_unlock
  161.     @click_lock = false
  162.   end
  163. end
  164.    
  165.    
  166. module Input
  167. if @self_update == nil
  168.    @self_update = method('update')
  169.    @self_press = method('press?')
  170.    @self_trigger = method('trigger?')
  171.    @self_repeat = method('repeat?')
  172. end
  173. def self.update
  174.    @self_update.call
  175.    Mouse.update
  176. end
  177. def self.press?(key_code)
  178.    if @self_press.call(key_code)
  179.      return true
  180.    end
  181.    if key_code == C
  182.      return Mouse.press?(Mouse::LEFT)
  183.    elsif key_code == B
  184.      return Mouse.press?(Mouse::RIGHT)
  185.    else
  186.      return @self_press.call(key_code)
  187.    end
  188. end
  189. def self.trigger?(key_code)
  190.    if @self_trigger.call(key_code)
  191.      return true
  192.    end
  193.    if key_code == C
  194.      return Mouse.trigger?(Mouse::LEFT)
  195.    elsif key_code == B
  196.      return Mouse.trigger?(Mouse::RIGHT)
  197.    else
  198.      return @self_trigger.call(key_code)
  199.    end
  200. end
  201. def self.repeat?(key_code)
  202.    if @self_repeat.call(key_code)
  203.      return true
  204.    end
  205.    if key_code == C
  206.      return Mouse.repeat?(Mouse::LEFT)
  207.    elsif key_code == B
  208.      return Mouse.repeat?(Mouse::RIGHT)
  209.    else
  210.      return @self_repeat.call(key_code)
  211.    end
  212. end
  213. end
  214. class Window_Selectable
  215.   if @self_alias == nil
  216.     alias self_update update
  217.     @self_alias = true
  218.   end
  219.   def update
  220.     self_update
  221.     if self.active and @item_max > 0
  222.       index_var = @index
  223.       tp_index = @index
  224.       mouse_x, mouse_y = Mouse.get_mouse_pos
  225.       mouse_not_in_rect = true
  226.       for i in 0...@item_max
  227.         @index = i
  228.         update_cursor_rect
  229.         top_x = self.cursor_rect.x + self.x + 16
  230.         top_y = self.cursor_rect.y + self.y + 16
  231.         bottom_x = top_x + self.cursor_rect.width
  232.         bottom_y = top_y + self.cursor_rect.height
  233.         if (mouse_x > top_x) and (mouse_y > top_y) and
  234.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  235.           mouse_not_in_rect = false
  236.           if tp_index != @index
  237.             tp_index = @index
  238.             $game_system.se_play($data_system.cursor_se)
  239.           end
  240.           break
  241.         end
  242.       end
  243.       if mouse_not_in_rect
  244.           # 当前行被显示开头行前面的情况下
  245.           if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT) and mouse_y>self.y+self.height/2
  246.             self.top_row +=1
  247.           end
  248.           # 当前行被显示末尾行之后的情况下
  249.           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)
  250.             # 从当前行向末尾滚动
  251.             self.top_row -=1
  252.           end
  253.         @index = index_var
  254.         if self.is_a?(Window_Target)
  255.           @index=-3
  256.         end
  257.         update_cursor_rect
  258.         Mouse.click_lock
  259.       else
  260.         Mouse.click_unlock               
  261.       end
  262.     end
  263.   end
  264.   def update_cursor_rect
  265.     # 光标位置不满 0 的情况下
  266.     if @index < 0
  267.       self.cursor_rect.empty
  268.       return
  269.     end
  270.     # 获取当前的行
  271.     row = @index / @column_max
  272.     # 当前行被显示开头行前面的情况下
  273.     if row < self.top_row
  274.       # 从当前行向开头行滚动
  275.       self.cursor_rect.empty
  276.       return
  277.     end
  278.     # 当前行被显示末尾行之后的情况下
  279.     if row > self.top_row + (self.page_row_max - 1)
  280.       # 从当前行向末尾滚动
  281.       self.cursor_rect.empty
  282.       return
  283.     end
  284.     # 计算光标的宽
  285.     cursor_width = self.width / @column_max - 32
  286.     # 计算光标坐标
  287.     x = @index % @column_max * (cursor_width + 32)
  288.     y = @index / @column_max * 32 - self.oy
  289.     # 更新光标矩形
  290.     self.cursor_rect.set(x, y, cursor_width, 32)
  291.   end
  292. end














  293. ##################################################################class Window_Selectable
  294.   class Window_Selectableshen
  295. if @self_alias == nil
  296.     alias self_update update
  297.     @self_alias = true
  298.   end
  299.   def update
  300.     self_update
  301.     if self.active and @item_max > 0
  302.       index_var = @index
  303.       tp_index = @index
  304.       mouse_x, mouse_y = Mouse.get_mouse_pos
  305.       mouse_not_in_rect = true
  306.       for i in 0...@item_max
  307.         @index = i
  308.         update_cursor_rect
  309.         top_x = self.cursor_rect.x + self.x + 16
  310.         top_y = self.cursor_rect.y + self.y + 16
  311.         bottom_x = top_x + self.cursor_rect.width
  312.         bottom_y = top_y + self.cursor_rect.height
  313.         if (mouse_x > top_x) and (mouse_y > top_y) and
  314.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  315.           mouse_not_in_rect = false
  316.           if tp_index != @index
  317.             tp_index = @index
  318.             $game_system.se_play($data_system.cursor_se)
  319.           end
  320.           break
  321.         end
  322.       end
  323.       if mouse_not_in_rect
  324.           # 当前行被显示开头行前面的情况下
  325.           if self.top_row < row_max-page_row_max and Mouse.press?(Mouse::LEFT) and mouse_y>self.y+self.height/2
  326.             self.top_row +=1
  327.           end
  328.           # 当前行被显示末尾行之后的情况下
  329.           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)
  330.             # 从当前行向末尾滚动
  331.             self.top_row -=1
  332.           end
  333.         @index = index_var
  334.         if self.is_a?(Window_Target)
  335.           @index=-3
  336.         end
  337.         update_cursor_rect
  338.         Mouse.click_lock
  339.       else
  340.         Mouse.click_unlock               
  341.       end
  342.     end
  343.   end
  344.   def update_cursor_rect
  345.     # 光标位置不满 0 的情况下
  346.     if @index < 0
  347.       self.cursor_rect.empty
  348.       return
  349.     end
  350.     # 获取当前的行
  351.     row = @index / @column_max
  352.     # 当前行被显示开头行前面的情况下
  353.     if row < self.top_row
  354.       # 从当前行向开头行滚动
  355.       self.cursor_rect.empty
  356.       return
  357.     end
  358.     # 当前行被显示末尾行之后的情况下
  359.     if row > self.top_row + (self.page_row_max - 1)
  360.       # 从当前行向末尾滚动
  361.       self.cursor_rect.empty
  362.       return
  363.     end
  364.     # 计算光标的宽
  365.     cursor_width = self.width / @column_max - 24
  366.     # 计算光标坐标
  367.     x = @index % @column_max * (cursor_width + 24)
  368.     y = @index / @column_max * 24 - self.oy
  369.     # 更新光标矩形
  370.     self.cursor_rect.set(x, y, cursor_width, 24)
  371.   end
  372. end
  373. ###############################################################################




















































  374. class Window_NameInput
  375. if @self_alias == nil
  376.    alias self_update update
  377.    @self_alias = true
  378. end
  379. def update
  380.    self_update
  381.    if self.active
  382.      index_var = @index
  383.      mouse_x, mouse_y = Mouse.get_mouse_pos
  384.      mouse_not_in_rect = true
  385.      for i in (0...CHARACTER_TABLE.size).to_a.push(180)
  386.        @index = i
  387.        update_cursor_rect
  388.        top_x = self.cursor_rect.x + self.x + 16
  389.        top_y = self.cursor_rect.y + self.y + 16
  390.        bottom_x = top_x + self.cursor_rect.width
  391.        bottom_y = top_y + self.cursor_rect.height
  392.        if (mouse_x > top_x) and (mouse_y > top_y) and
  393.           (mouse_x < bottom_x) and (mouse_y < bottom_y)
  394.          mouse_not_in_rect = false
  395.          break
  396.        end
  397.      end
  398.      if mouse_not_in_rect
  399.        @index = index_var
  400.        update_cursor_rect
  401.        Mouse.click_lock
  402.      else
  403.        Mouse.click_unlock
  404.      end
  405.    end
  406. end
  407. end
  408. class Window_InputNumber
  409. if @self_alias == nil
  410.    alias self_update update
  411.    @self_alias = true
  412. end
  413. def update
  414.    self_update
  415.    mouse_x, mouse_y = Mouse.get_mouse_pos
  416.    if self.active and @digits_max > 0
  417.      index_var = @index
  418.      mouse_not_in_rect = true
  419.      for i in 0...@digits_max
  420.        @index = i
  421.        update_cursor_rect
  422.        top_x = self.cursor_rect.x + self.x + 16
  423.        bottom_x = top_x + self.cursor_rect.width
  424.        if (mouse_x > top_x) and (mouse_x < bottom_x)
  425.          mouse_not_in_rect = false
  426.          break
  427.        end
  428.      end
  429.      if mouse_not_in_rect
  430.        @index = index_var
  431.        update_cursor_rect
  432.        Mouse.click_lock
  433.      else
  434.        Mouse.click_unlock
  435.      end
  436.    end
  437.    if @last_mouse_y == nil
  438.      @last_mouse_y = mouse_y
  439.    end
  440.    check_pos = (@last_mouse_y - mouse_y).abs
  441.    if check_pos > 10
  442.      $game_system.se_play($data_system.cursor_se)
  443.      place = 10 ** (@digits_max - 1 - @index)
  444.      n = @number / place % 10
  445.      @number -= n * place
  446.      n = (n + 1) % 10 if mouse_y < @last_mouse_y
  447.      n = (n + 9) % 10 if mouse_y > @last_mouse_y
  448.      @number += n * place
  449.      refresh
  450.      @last_mouse_y = mouse_y
  451.    end
  452. end
  453. end
  454. class Scene_File
  455. if @self_alias == nil
  456.    alias self_update update
  457.    @self_alias = true
  458. end
  459. def update
  460.    mouse_x, mouse_y = Mouse.get_mouse_pos
  461.    Mouse.click_lock
  462.    idx = 0
  463.    for i in @savefile_windows
  464.      top_x = i.x + 16
  465.      top_y = i.y + 16
  466.      bottom_x = top_x + i.width
  467.      bottom_y = top_y + i.height
  468.      if (mouse_x > top_x) and (mouse_y > top_y) and
  469.         (mouse_x < bottom_x) and (mouse_y < bottom_y)
  470.        i.selected = true
  471.        if @file_index != idx
  472.          @file_index = idx
  473.          $game_system.se_play($data_system.cursor_se)
  474.        end            
  475.        Mouse.click_unlock
  476.      else
  477.        i.selected = false
  478.      end
  479.      idx += 1
  480.    end
  481.    self_update
  482. end
  483. end
  484. class Arrow_Enemy
  485. if @self_alias == nil
  486.    alias self_update update
  487.    @self_alias = true
  488. end
  489. def update
  490.    mouse_x, mouse_y = Mouse.get_mouse_pos
  491.    idx = 0
  492.    for i in $game_troop.enemies do
  493.      if i.exist?
  494.        top_x = i.screen_x - self.ox - 420
  495.        top_y = i.screen_y - self.oy - 50
  496.        bottom_x = top_x + self.src_rect.width
  497.        bottom_y = top_y + self.src_rect.height
  498.        if (mouse_x > top_x - $敌人选框扩大) and (mouse_y > top_y - $敌人选框扩大) and
  499.           (mouse_x < bottom_x + $敌人选框扩大) and (mouse_y < bottom_y + $敌人选框扩大)
  500.          if @index != idx
  501.            $game_system.se_play($data_system.cursor_se)
  502.            @index = idx
  503.          end
  504.        end
  505.      end
  506.      idx += 1
  507.    end
  508.    self_update
  509. end
  510. end
  511. class Arrow_Actor
  512. if @self_alias == nil
  513.    alias self_update update
  514.    @self_alias = true
  515. end
  516. def update
  517.    mouse_x, mouse_y = Mouse.get_mouse_pos
  518.    idx = 0
  519.    for i in $game_party.actors do
  520.      #if i.exist? #不注释掉,角色死亡后就不能用鼠标了!
  521.        top_x = i.screen_x - self.ox - 420
  522.        top_y = i.screen_y - self.oy - 50
  523.        bottom_x = top_x + self.src_rect.width
  524.        bottom_y = top_y + self.src_rect.height
  525.        if (mouse_x > top_x - $角色选框扩大) and (mouse_y > top_y - $角色选框扩大) and
  526.           (mouse_x < bottom_x + $角色选框扩大) and (mouse_y < bottom_y + $角色选框扩大)
  527.          if @index != idx
  528.            $game_system.se_play($data_system.cursor_se)
  529.            @index = idx
  530.          end
  531.        end
  532.      #end #不注释掉,角色死亡后就不能用鼠标了!
  533.      idx += 1
  534.    end
  535.    self_update
  536. end
  537. end

  538. class Game_Player
  539. if @self_alias == nil
  540.    alias self_update update
  541.    @self_alias = true
  542. end

  543. def get_mouse_sta
  544.    return @mouse_sta
  545. end

  546. def update
  547.    mouse_x, mouse_y = Mouse.get_mouse_pos
  548.    @mtp_x = mouse_x
  549.    @mtp_y = mouse_y
  550.    
  551.     # 宝宝按扭
  552.   
  553.          
  554.            if @mtp_x >= 422 and @mtp_x <= 452 and @mtp_y >= 450 and @mtp_y <= 477
  555.      $game_screen.pictures[1].show("宠物1", 0, 418, 430, 100.0, 100.0, 255, 0)
  556.      
  557.      #$game_screen.pictures[30].show("宝宝", 0, 428, 452, 100.0, 100.0, 255, 0)
  558.      if Input.trigger?(Input::C)
  559.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[1].erase
  560.       $game_screen.pictures[30].erase
  561.         Audio.se_play("Audio/SE/"+"退出",100,100)
  562.     $scene =  Scene_Baby.new
  563.         # $scene = Scene_Menu.new
  564.         
  565.         #$game_temp.common_event_id = 21
  566.       end
  567.     else
  568.       $game_screen.pictures[1].erase
  569.             $game_screen.pictures[30].erase
  570.       end
  571.          
  572.          
  573.          
  574.          
  575.          
  576.          
  577.          
  578.          
  579.          
  580.     if @mtp_x >= 0 and @mtp_x <= 30 and @mtp_y >= 450 and @mtp_y <= 477
  581.      #$game_screen.pictures[4].show("时间", 0, 402, 452, 100.0, 100.0, 255, 0)
  582.      if Input.trigger?(Input::C)
  583.       
  584.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[50].erase
  585.        Audio.se_play("Audio/SE/"+"退出",100,100)
  586.        $game_temp.common_event_id = 60
  587.       end
  588.    else
  589.      # $game_screen.pictures[4].erase
  590.       
  591.    end
  592.    
  593.    
  594.    
  595.    
  596.    
  597.    
  598.    
  599.    
  600.    
  601.    
  602.    
  603.    
  604.    
  605.    
  606.    
  607.    
  608.    
  609.    
  610.     if @mtp_x >= 392 and @mtp_x <= 422 and @mtp_y >= 450 and @mtp_y <= 477
  611.     # $game_screen.pictures[41].show("变", 0, 398, 452, 100.0, 100.0, 255, 0)
  612.      $game_screen.pictures[40].show("变身1", 0, 388, 430, 100.0, 100.0, 255, 0)
  613.      if Input.trigger?(Input::C)
  614.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[41].erase
  615.       $game_screen.pictures[40].erase
  616.      #  Audio.se_play("Audio/SE/"+"退出",100,100)
  617.       $scene = Scene_Lvup.new
  618.         
  619.       end
  620.     else
  621.       $game_screen.pictures[41].erase
  622.             $game_screen.pictures[40].erase
  623.       end
  624.     if @mtp_x >= 40 and @mtp_x <= 80 and @mtp_y >= 450 and @mtp_y <= 477
  625.    #  $game_screen.pictures[44].show("物品", 0, 402, 452, 100.0, 100.0, 255, 0)
  626.      if Input.trigger?(Input::C)
  627.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[50].erase
  628.    #     Audio.se_play("Audio/SE/"+"退出",100,100)
  629.        #$game_temp.common_event_id = 151
  630.       end
  631.    else
  632.       
  633.    end
  634.   
  635.    ##########################
  636.    
  637.    
  638.     # 坐骑按扭
  639.    if @mtp_x >= 482 and @mtp_x <= 512 and @mtp_y >= 450 and @mtp_y <= 477
  640.     # $game_screen.pictures[46].show("坐骑", 0, 490, 452, 100.0, 100.0, 255, 0)
  641.       $game_screen.pictures[29].show("坐骑11", 0, 476, 430, 100.0, 100.0, 255, 0)
  642.      
  643.      if Input.trigger?(Input::C)
  644.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[46].erase
  645.        $game_screen.pictures[29].erase
  646.     #   Audio.se_play("Audio/SE/"+"退出",100,100)
  647.         $game_temp.common_event_id = 77
  648.         
  649.         $scene = Scene_Troop.new
  650.       end
  651.    else
  652.       $game_screen.pictures[29].erase
  653.        $game_screen.pictures[46].erase
  654.    end
  655.    
  656.     # 状态按扭
  657.   
  658.    if @mtp_x >= 530 and @mtp_x <= 550 and @mtp_y >= 0 and @mtp_y <= 40
  659.    #  $game_screen.pictures[47].show("状态", 0, 542, 452, 100.0, 100.0, 255, 0)
  660.      if Input.trigger?(Input::C)
  661.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[47].erase
  662.       $scene = Scene_Cta.new
  663.    #  Audio.se_play("Audio/SE/"+"退出",100,100)
  664.         #$game_temp.common_event_id =39
  665.          #Scene_Status
  666.       end
  667.    else
  668.      $game_screen.pictures[47].erase
  669.    end
  670.     if @mtp_x >= 550 and @mtp_x <= 640 and @mtp_y >= 0 and @mtp_y <= 40
  671.     # $game_screen.pictures[4].show("状态", 0, 542, 452, 100.0, 100.0, 255, 0)
  672.      if Input.trigger?(Input::B)
  673.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[4].erase
  674.       
  675.         # $game_temp.common_event_id = 280
  676.       end
  677.    else
  678.      $game_screen.pictures[4].erase
  679.    end
  680.    
  681.    
  682.    
  683.    
  684.    
  685.    
  686.    
  687.    
  688.    
  689.    
  690.    
  691.    
  692.    
  693.    
  694.    
  695.    
  696.    
  697.    
  698.    
  699.    
  700.    
  701.    
  702.    
  703.    
  704.   
  705.    
  706.    # 物品按扭
  707.    if @mtp_x >= 308 and @mtp_x <= 326 and @mtp_y >= 450 and @mtp_y <= 477
  708.     # $game_screen.pictures[50].show("物品", 0, 308, 452, 100.0, 100.0, 255, 0)
  709.      $game_screen.pictures[38].show("道具1", 0, 298, 430, 100.0, 100.0, 255, 0)
  710.      
  711.      if Input.trigger?(Input::C)
  712.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[50].erase
  713.         $game_screen.pictures[38].erase
  714.       
  715.     #   Audio.se_play("Audio/SE/"+"退出",100,100)
  716.       $scene = Scene_Item.new
  717.       
  718.       end
  719.    else
  720.      $game_screen.pictures[50].erase
  721.      $game_screen.pictures[38].erase
  722.    end
  723.    
  724.    # 装备按扭
  725.    if @mtp_x >= 332 and @mtp_x <= 362 and @mtp_y >= 450 and @mtp_y <= 477
  726.    #  $game_screen.pictures[48].show("装备", 0, 339, 452, 100.0, 100.0, 255, 0)
  727.      $game_screen.pictures[28].show("装备1", 0, 329, 430, 100.0, 100.0, 255, 0)
  728.      if Input.trigger?(Input::C)
  729.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[48].erase
  730.         $game_screen.pictures[28].erase
  731.       #   Audio.se_play("Audio/SE/"+"拔剑",100,100)
  732.          
  733.         $scene = Scene_Equip.new

  734.       # $game_temp.common_event_id =390
  735.     end
  736.    else
  737.      $game_screen.pictures[48].erase
  738.        $game_screen.pictures[28].erase
  739.      end  
  740.      
  741.      
  742.    
  743.    # 小地图按扭
  744.    #if @mtp_x >= 1 and @mtp_x <= 15 and @mtp_y >= 20 and @mtp_y <= 38
  745.    #  $game_screen.pictures[48].show("装备", 0, 339, 452, 100.0, 100.0, 255, 0)
  746.      #$game_screen.pictures[57].show("小地图1", 0, 44, 60, 100.0, 100.0, 255, 0)
  747.      #if Input.trigger?(Input::C)
  748.        #$game_system.se_play($data_system.decision_se); $game_screen.pictures[67].erase
  749.         #$game_screen.pictures[57].erase
  750.       #   Audio.se_play("Audio/SE/"+"拔剑",100,100)
  751.          
  752.       
  753.   


  754.       
  755.       # $game_temp.common_event_id =390
  756.       
  757.      
  758.     #end   
  759.    #else
  760.      #$game_screen.pictures[57].erase
  761.        #$game_screen.pictures[67].erase
  762.    #end  

  763.    
  764.    
  765.    
  766.    
  767.    
  768.    
  769.    # 状态按扭
  770.    if @mtp_x >= 362 and @mtp_x <= 392 and @mtp_y >= 450 and @mtp_y <= 477
  771.     # $game_screen.pictures[37].show("状态", 0, 369, 452, 100.0, 100.0, 255, 0)
  772.       $game_screen.pictures[27].show("状态1", 0, 359, 430, 100.0, 100.0, 255, 0)
  773.      if Input.trigger?(Input::C)
  774.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[37].erase
  775.         $game_screen.pictures[27].erase
  776.      # $game_temp.common_event_id = 80
  777.       $scene = Scene_Dzz.new
  778.      #  Audio.se_play("Audio/SE/"+"轮回",100,100)
  779.      #   $scene = Scene_Status.new
  780.       

  781.       end
  782.    else
  783.      $game_screen.pictures[37].erase
  784.           $game_screen.pictures[27].erase
  785.    end
  786.    # 特技按扭
  787.    if @mtp_x >= 452 and @mtp_x <= 482 and @mtp_y >= 450 and @mtp_y <= 477
  788.    #  $game_screen.pictures[49].show("特技", 0, 459, 452, 100.0, 100.0, 255, 0)
  789.       $game_screen.pictures[36].show("特技1", 0, 449, 430, 100.0, 100.0, 255, 0)
  790.      if Input.trigger?(Input::C)
  791.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[49].erase
  792.        $game_screen.pictures[36].erase
  793.       #  Audio.se_play("Audio/SE/"+"拔剑",100,100)
  794.        $scene = Scene_Skill.new
  795.       
  796.       end
  797.    else
  798.      $game_screen.pictures[49].erase
  799.          $game_screen.pictures[36].erase
  800.    end
  801.    # 任务按扭
  802.    if @mtp_x >= 512 and @mtp_x <= 542 and @mtp_y >= 450 and @mtp_y <= 477
  803.     # $game_screen.pictures[45].show("任务", 0, 519, 452, 100.0, 100.0, 255, 0)
  804.       $game_screen.pictures[35].show("任务1", 0, 509, 430, 100.0, 100.0, 255, 0)
  805.      if Input.trigger?(Input::C)
  806.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[45].erase
  807.         $game_screen.pictures[35].erase
  808. #          Audio.se_play("Audio/SE/"+"轮回",100,100)
  809.       $scene = Scene_Task.new
  810.       # $scene=Scene_RecordBook.new
  811.       end
  812.    else
  813.      $game_screen.pictures[45].erase
  814.           $game_screen.pictures[35].erase
  815.    end
  816.    # 存挡按扭
  817.    if @mtp_x >= 572 and @mtp_x <= 612 and @mtp_y >= 450 and @mtp_y <= 477
  818.   #   $game_screen.pictures[44].show("存档", 0, 579, 452, 100.0, 100.0, 255, 0)
  819.      $game_screen.pictures[34].show("存档1", 0, 569, 430, 100.0, 100.0, 255, 0)
  820.      if Input.trigger?(Input::C)
  821.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[44].erase
  822.        $game_screen.pictures[34].erase
  823.       # $scene = Scene_Save.new
  824.    #   Audio.se_play("Audio/SE/"+"轮回",100,100)
  825.         $scene = Scene_Compose.new
  826.     #   $scene = Scene_Loadsave.new
  827.       end
  828.    else
  829.      $game_screen.pictures[44].erase
  830.           $game_screen.pictures[34].erase
  831.    end
  832.    # 读挡按扭
  833.    if @mtp_x >= 542 and @mtp_x <= 572 and @mtp_y >= 450 and @mtp_y <= 477
  834.    #  $game_screen.pictures[43].show("读档", 0, 549, 452, 100.0, 100.0, 255, 0)
  835.       $game_screen.pictures[33].show("读档1", 0, 539, 430, 100.0, 100.0, 255, 0)
  836.      if Input.trigger?(Input::C)
  837.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[43].erase
  838.        $game_screen.pictures[33].erase
  839.       # $scene = Scene_Load.new
  840.      #  Audio.se_play("Audio/SE/"+"退出",100,100)
  841.        #$game_temp.common_event_id = 184
  842.         $scene = Scene_Status.new
  843.       
  844.       end
  845.    else
  846.      $game_screen.pictures[43].erase
  847.           $game_screen.pictures[33].erase
  848.    end
  849.    # 退出按扭
  850.    if @mtp_x >= 612 and @mtp_x <= 642 and @mtp_y >= 450 and @mtp_y <= 477
  851.     # $game_screen.pictures[42].show("退出", 0, 609, 450, 100.0, 100.0, 255, 0)
  852.        $game_screen.pictures[32].show("退出1", 0, 602, 430, 100.0, 100.0, 255, 0)
  853.      if Input.trigger?(Input::C)
  854.        $game_system.se_play($data_system.decision_se); $game_screen.pictures[42].erase
  855.        $game_screen.pictures[32].erase
  856.     #   Audio.se_play("Audio/SE/"+"轮回",100,100)
  857.       # $scene = Scene_End.new
  858.       $scene = Scene_Dz.new
  859.       
  860.       
  861.       end
  862.    else
  863.      $game_screen.pictures[42].erase
  864.           $game_screen.pictures[32].erase
  865.         end
  866.         
  867.       
  868.         
  869.         
  870.         
  871.    # 地图界面按扭操作系统★★★★★★★★★★★★★★★★★★★★★
  872.    unless $game_system.map_interpreter.running? and @mouse_sta == 2 #鼠标状态不为跟随状态
  873.      #得到鼠标图标方向
  874.      $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)
  875.   else
  876.      #令鼠标图标为正常
  877.      $mouse_icon_id = 0 if @mouse_sta != 2
  878.    end
  879.    #if Mouse.trigger?(Mouse::LEFT)
  880.    if Mouse.press?(Mouse::LEFT) && $game_player.move_key == true #★★★★★
  881.    #if Mouse.trigger?(Mouse::LEFT) && $game_player.move_key == true #★★★★★     
  882.    
  883.      unless $game_system.map_interpreter.running? or
  884.             # 地图界面按扭操作系统★★★★★★★★★★★★★★★★★★★★★
  885.             @move_route_forcing or $game_temp.message_window_showing or @mtp_y >= 438
  886.             # 地图界面按扭操作系统★★★★★★★★★★★★★★★★★★★★★
  887.        #初始化
  888.        @mouse_sta = 1
  889.        p_direction = 5
  890.        #检查鼠标处能否开启事件
  891.        event_start,p_direction = $game_map.check_event_custom_start(mouse_x, mouse_y)
  892.        #若在移动中再次点击鼠标左键(即双击左键),则改鼠标状态为跟随状态
  893.        @mouse_sta = 2 if @paths_id != nil and @paths_id != @paths.size
  894.        if @mouse_sta != 2
  895.          #鼠标状态不为跟随状态则取数据并初始化路径
  896.          trg_x = (mouse_x + $game_map.display_x / 4) / 32
  897.          trg_y = (mouse_y + $game_map.display_y / 4) / 32
  898.          @paths = []
  899.          @paths_id = 0
  900.          if event_start == 0 #若不能开启事件
  901.            if trg_x != $game_player.x or trg_y != $game_player.y #若目标不为自身则开始寻路
  902.              find_path = Find_Path.new
  903.              @paths = find_path.find_player_short_path(trg_x, trg_y, @mtp_x, @mtp_y)
  904.            end
  905.          else #若能开启事件则改变角色朝向
  906.            @direction = p_direction
  907.          end
  908.        end
  909.      end
  910.    end
  911.    #开始移动
  912.    if @mouse_sta != nil and @mouse_sta == 1 #若鼠标状态为寻路状态
  913.      
  914.      unless moving? or $game_system.map_interpreter.running? or
  915.             @move_route_forcing or $game_temp.message_window_showing #排除无效情况
  916.        if @paths_id != nil and @paths != nil and @paths_id <= @paths.size #若没有完成路径
  917.          case @paths[@paths_id] #判断路径
  918.          when 6
  919.            @last_move_x = true
  920.            move_right
  921.            @paths_id += 1
  922.            @direction = 6
  923.          when 4
  924.            @last_move_x = true
  925.            move_left
  926.            @paths_id += 1
  927.            @direction = 4
  928.          when 2
  929.            @last_move_x = false
  930.            move_down
  931.            @direction = 2
  932.            @paths_id += 1
  933.          when 8
  934.            @last_move_x = false
  935.            move_up
  936.            @direction = 8
  937.            @paths_id += 1
  938.          #斜四方向
  939.          when 1
  940.            @last_move_x = false
  941.            move_lower_left
  942.            @direction = 1
  943.            @paths_id += 1
  944.          when 3
  945.            @last_move_x = false
  946.            move_lower_right
  947.            @direction = 3
  948.            @paths_id += 1
  949.          when 7
  950.            @last_move_x = false
  951.            move_upper_left
  952.            @direction = 7
  953.            @paths_id += 1
  954.          when 9
  955.            @last_move_x = false
  956.            move_upper_right
  957.            @direction = 9
  958.            @paths_id += 1
  959.          end
  960.        end
  961.      end
  962.      
  963.      
  964.      
  965.      
  966.      
  967.      
  968.      
  969.      
  970.      
  971.      
  972.      
  973.      
  974.      
  975.      
  976.      
  977.      
  978.      
  979.          
  980.      
  981.      
  982.      
  983.      
  984.      
  985.      
  986.      
  987.      
  988.      
  989.      
  990.      
  991.      
  992.      
  993.      
  994.    elsif @paths != nil and @mouse_sta == 2 #当鼠标状态为跟随,且在移动中
  995.      
  996.      
  997.      
  998.    
  999.      
  1000.      
  1001.      
  1002.      #if Mouse.press?( Mouse::LEFT ) #持续按住鼠标
  1003.      if Mouse.press?(Mouse::LEFT) && $game_player.move_key == true #★★★★★     
  1004.       
  1005.        unless moving? or $game_system.map_interpreter.running? or
  1006.               @move_route_forcing or $game_temp.message_window_showing #排除无效情况
  1007.          #跟随方向判断并跟随
  1008.          rate =  $game_map.show_rate(self)
  1009.          width = (RPG::Cache.character(self.character_name,self.character_hue).width / 8) * rate
  1010.          height = (RPG::Cache.character(self.character_name,self.character_hue).height / 8) * rate
  1011.          self_ox = (self.screen_x - width / 2 + self.screen_x + width / 2) / 2
  1012.          self_oy = (self.screen_y - height + self.screen_y) / 2
  1013.          if (@mtp_x - self_ox)*(@mtp_x - self_ox) + (@mtp_y - self_oy)*(@mtp_y - self_oy) >= 961
  1014.            if @mtp_x > self_ox
  1015.              if self_oy - @mtp_y < 0.4 * (@mtp_x - self_ox) and
  1016.                 @mtp_y - self_oy < 0.4 * (@mtp_x - self_ox)
  1017.                move_right
  1018.                $mouse_icon_id = 16
  1019.                @direction = 6
  1020.              end
  1021.              if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
  1022.                 @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
  1023.                move_lower_right
  1024.                $mouse_icon_id = 13
  1025.                @direction = 3
  1026.              end
  1027.              if @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x ) and
  1028.                 @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
  1029.                move_upper_right
  1030.                $mouse_icon_id = 19
  1031.                @direction = 9
  1032.              end
  1033.              if @mtp_y - self_oy > 2.4 * ( @mtp_x - self_ox )
  1034.                move_down
  1035.                $mouse_icon_id = 12
  1036.                @direction = 2
  1037.              end
  1038.              if @mtp_y - self_oy < - 2.4 * ( @mtp_x - self_ox )
  1039.                move_up
  1040.                $mouse_icon_id = 18
  1041.                @direction = 8
  1042.              end
  1043.            end
  1044.            if @mtp_x < self_ox
  1045.              if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
  1046.                 @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x )
  1047.                move_left
  1048.                $mouse_icon_id = 14
  1049.                @direction = 4
  1050.              end
  1051.              if @mtp_y - self_oy > 0.4 * ( self_ox - @mtp_x ) and
  1052.                 @mtp_y - self_oy < 2.4 * ( self_ox - @mtp_x )
  1053.                move_lower_left
  1054.                $mouse_icon_id = 11
  1055.                @direction = 1
  1056.              end
  1057.              if @mtp_y - self_oy < - 0.4 * ( self_ox - @mtp_x ) and
  1058.                 @mtp_y - self_oy > - 2.4 * ( self_ox - @mtp_x )
  1059.                move_upper_left
  1060.                $mouse_icon_id = 17
  1061.                @direction = 7
  1062.              end
  1063.              if @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
  1064.                move_down
  1065.                $mouse_icon_id = 12
  1066.                @direction = 2
  1067.              end
  1068.              if @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
  1069.                move_up
  1070.                $mouse_icon_id = 18
  1071.                @direction = 8
  1072.              end
  1073.            end
  1074.          end
  1075.             if @mtp_x > self_ox
  1076.              if @mtp_y - self_oy > - 0.4 * ( @mtp_x - self_ox ) and
  1077.                 @mtp_y - self_oy < 0.4 * ( @mtp_x - self_ox )
  1078.                $mouse_icon_id = 16
  1079.                @direction = 6
  1080.              end
  1081.              if @mtp_y - self_oy > 0.4 * ( @mtp_x - self_ox ) and
  1082.                @mtp_y - self_oy < 2.4 * ( @mtp_x - self_ox )
  1083.                $mouse_icon_id = 13
  1084.                @direction = 3
  1085.              end
  1086.              if @mtp_y - self_oy < - 0.4 * ( @mtp_x - self_ox ) and
  1087.                @mtp_y - self_oy > - 2.4 * ( @mtp_x - self_ox )
  1088.                $mouse_icon_id = 19
  1089.                @direction = 9
  1090.              end
  1091.              if @mtp_y - self_oy > 2.4 * ( @mtp_x - self_ox )
  1092.                $mouse_icon_id = 12
  1093.                @direction = 2
  1094.              end
  1095.              if @mtp_y - self_oy < - 2.4 * ( @mtp_x - self_ox )
  1096.                $mouse_icon_id = 18
  1097.                @direction = 8
  1098.              end
  1099.            end
  1100.            if @mtp_x < self_ox
  1101.              if @mtp_y - self_oy > - 0.4 * ( self_ox - @mtp_x ) and
  1102.                 @mtp_y - self_oy < 0.4 * ( self_ox - @mtp_x )
  1103.                $mouse_icon_id = 14
  1104.                @direction = 4
  1105.              end
  1106.              if @mtp_y - self_oy > 0.4 * ( self_ox - @mtp_x ) and
  1107.                 @mtp_y - self_oy < 2.4 * ( self_ox - @mtp_x )
  1108.                $mouse_icon_id = 11
  1109.                @direction = 1
  1110.              end
  1111.              if @mtp_y - self_oy < - 0.4 * ( self_ox - @mtp_x ) and
  1112.                 @mtp_y - self_oy > - 2.4 * ( self_ox - @mtp_x )
  1113.                $mouse_icon_id = 17
  1114.                @direction = 7
  1115.              end
  1116.              if @mtp_y - self_oy > 2.4 * ( self_ox - @mtp_x )
  1117.                $mouse_icon_id = 12
  1118.                @direction = 2
  1119.              end
  1120.              if @mtp_y - self_oy < - 2.4 * ( self_ox - @mtp_x )
  1121.                $mouse_icon_id = 18
  1122.                @direction = 8
  1123.              end
  1124.            end
  1125.          end
  1126.          
  1127.   
  1128.          
  1129.          

  1130.          
  1131.          
  1132.          
  1133.          
  1134.          
  1135.          
  1136.          
  1137.          
  1138.          
  1139.          
  1140.          
  1141.      else #没状态的情况
  1142.        $mouse_icon_id = 0
  1143.        @mouse_sta = 0
  1144.        @paths_id = @paths.size #终止寻路移动
  1145.      end
  1146.    end
  1147.    self_update
  1148. end
  1149. end






  1150. Mouse.init
  1151. END { Mouse.exit }
  1152. # 八向行走鼠标脚本系列处理★★★★★★★★★★★★★★★★★★★★★★★★★
复制代码
梦石
0
星屑
34511
在线时间
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.

在本版发帖返回顶部