设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 4040|回复: 1

[已经过期] 怎么能让 鼠标指针 直接选择敌人战斗图

[复制链接]

Lv4.逐梦者

梦石
8
星屑
6304
在线时间
1020 小时
注册时间
2010-7-26
帖子
1403
发表于 2011-2-15 21:47:51 | 显示全部楼层 |阅读模式
7星屑
原贴地址
http://rpg.blue/forum.php?m ... =%E9%BC%A0%E6%A0%87
以下这一段应该就是 鼠标系统选择敌人的方法吧。。
  1. #==============================================================================
  2. # ** Window_Message
  3. #==============================================================================
  4. class Window_Message < Window_Selectable
  5.   def update_mouse
  6.     (0..@item_max - 1).each do |i|
  7.       irect = item_rect(i)
  8.       irx = self.x + 16 + irect.x - self.ox
  9.       iry = self.y + 16 + irect.y - self.oy + ($game_message.choice_start * WLH)
  10.       result = Mouse.area?(irx, iry, irect.width, irect.height)
  11.       self.index = i if result
  12.       ## 控制单击条件
  13.       $click_abled = false if i == @index and !result
  14.     end
  15.   end
  16. end
复制代码
以下 是赵云的指向脚本:
  1. #本脚本来自66RPG,作者趙雲,如需转载请保留本信息。
  2. #==============================================================================
  3. # ■ Arrow_Base
  4. #------------------------------------------------------------------------------
  5. #  在战斗画面使用的箭头光标的活动块。本类作为
  6. # Arrow_Enemy 类与 Arrow_Actor 类的超级类使用。
  7. #==============================================================================

  8. class Arrow_Base < Sprite
  9.   #--------------------------------------------------------------------------
  10.   # ● 定义实例变量
  11.   #--------------------------------------------------------------------------
  12.   attr_reader   :index                    # 光标位置
  13.   attr_reader   :help_window              # 帮助窗口
  14.   #--------------------------------------------------------------------------
  15.   # ● 初始化对像
  16.   #     viewport : 显示端口
  17.   #--------------------------------------------------------------------------
  18.   def initialize(viewport)
  19.     super(viewport)
  20.     self.bitmap = Cache.system("Arrow")
  21.     self.ox = 16
  22.     self.oy = 64
  23.     self.z = 2500
  24.     @blink_count = 0
  25.     @index = 0
  26.     @help_window = nil
  27.     update
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 设置光标位置
  31.   #     index : 新的光标位置
  32.   #--------------------------------------------------------------------------
  33.   def index=(index)
  34.     @index = index
  35.     update
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 设置帮助窗口
  39.   #     help_window : 新的帮助窗口
  40.   #--------------------------------------------------------------------------
  41.   def help_window=(help_window)
  42.     @help_window = help_window
  43.     # 刷新帮助文本 (update_help 定义了继承目标)
  44.     if @help_window != nil
  45.       update_help
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 刷新画面
  50.   #--------------------------------------------------------------------------
  51.   def update
  52.     # 刷新点灭记数
  53.     @blink_count = (@blink_count + 1) % 12
  54.     # 设置传送源矩形
  55.     if @blink_count < 6
  56.       self.src_rect.set(0, 0, 32, 32)
  57.     else
  58.       self.src_rect.set(32, 0, 32, 32)
  59.     end
  60.     # 刷新帮助文本 (update_help 定义了继承目标)
  61.     if @help_window != nil
  62.       update_help
  63.     end
  64.   end
  65. end
  66. #==============================================================================
  67. # ■ Arrow_Enemy
  68. #------------------------------------------------------------------------------
  69. #  选择敌人的箭头光标。本类继承 Arrow_Base
  70. # 类。
  71. #==============================================================================

  72. class Arrow_Enemy < Arrow_Base
  73.   #--------------------------------------------------------------------------
  74.   # ● 获取光标指向的敌人
  75.   #--------------------------------------------------------------------------
  76.   def enemy
  77.     return $game_troop.members[@index]
  78.   end
  79.   
  80.   def dispose
  81.     @enemy.loop_white_flash = false unless @enemy.nil?
  82.     super
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 刷新画面
  86.   #--------------------------------------------------------------------------
  87.   def update
  88.     super
  89.      if @enemy != enemy and enemy.exist?
  90.         @enemy.loop_white_flash = false unless @enemy.nil?
  91.         enemy.loop_white_flash = true
  92.         @enemy = enemy
  93.       end  
  94.    
  95.     # 如果指向不存在的敌人就离开
  96.     $game_troop.members.size.times do
  97.       break if self.enemy.exist?
  98.       @index += 1
  99.       @index %= $game_troop.members.size
  100.     end
  101.     # 光标右
  102.     if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::DOWN)
  103.       Sound.play_cursor
  104.       $game_troop.members.size.times do
  105.         @index += 1
  106.         @index %= $game_troop.members.size
  107.         break if self.enemy.exist?
  108.       end
  109.     end
  110.     # 光标左
  111.     if Input.repeat?(Input::LEFT) or Input.repeat?(Input::UP)
  112.      Sound.play_cursor
  113.       $game_troop.members.size.times do
  114.         @index += $game_troop.members.size - 1
  115.         @index %= $game_troop.members.size
  116.         break if self.enemy.exist?
  117.       end
  118.     end
  119.     # 设置活动块坐标
  120.     if self.enemy != nil
  121.       self.x = self.enemy.screen_x
  122.       self.y = self.enemy.screen_y
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 刷新帮助文本
  127.   #--------------------------------------------------------------------------
  128.   def update_help
  129.     # 帮助窗口显示敌人的名字与状态
  130.     @help_window.set_enemy(self.enemy)
  131.   end
  132. end





  133. class Scene_Battle ##
  134.   
  135.   
  136.   #--------------------------------------------------------------------------
  137.   # ● 更新画面
  138.   #--------------------------------------------------------------------------
  139.   def update
  140.     super
  141.     update_basic(true)
  142.     update_info_viewport                  # 更新显示信息的视区
  143.     if $game_message.visible
  144.       @info_viewport.visible = false
  145.       @message_window.visible = true
  146.     end
  147.     unless $game_message.visible          # 在显示消息以外的情况
  148.       return if judge_win_loss            # 判断胜败
  149.       update_scene_change
  150.       if @enemy_arrow != nil
  151.         update_target_enemy_selection     # 选择敌方对象
  152.       elsif @target_actor_window != nil
  153.         update_target_actor_selection     # 选择对象角色
  154.       elsif @skill_window != nil
  155.         update_skill_selection            # 选择特技
  156.       elsif @item_window != nil
  157.         update_item_selection             # 选择物品
  158.       elsif @party_command_window.active
  159.         update_party_command_selection    # 选择同伴指令
  160.       elsif @actor_command_window.active
  161.         update_actor_command_selection    # 选择角色指令
  162.       else
  163.         process_battle_event              # 战斗处理
  164.         process_action                    # 战斗行动
  165.         process_battle_event              # 处理战斗事件
  166.       end
  167.     end
  168.   end
  169.   

  170.   
  171.   def set_window(visible)
  172.     if !@skill_window.nil?
  173.       @skill_window.visible = visible
  174.     elsif !@item_window.nil?
  175.       @item_window.visible = visible
  176.     end
  177.   end

  178.   #--------------------------------------------------------------------------
  179.   # ● 开始选择对象的敌方角色
  180.   #--------------------------------------------------------------------------
  181.   def start_target_enemy_selection
  182.     set_window(false)
  183.     @enemy_arrow = Arrow_Enemy.new(@spriteset.viewport3)
  184.     @enemy_window = Window_Enemy.new(176,0)
  185.     @enemy_arrow.help_window = @enemy_window
  186.     @actor_command_window.active = false
  187.   end
  188.   #--------------------------------------------------------------------------
  189.   # ● 选择对象敌方角色结束
  190.   #--------------------------------------------------------------------------
  191.   def end_target_enemy_selection
  192.     @enemy_arrow.dispose
  193.     @enemy_arrow = nil
  194.     @enemy_window.dispose
  195.     set_window(true)
  196.     if @actor_command_window.index == 0
  197.       @actor_command_window.active = true
  198.     end
  199.   end
  200.   #--------------------------------------------------------------------------
  201.   # ● 更新选择对象敌方角色
  202.   #--------------------------------------------------------------------------
  203.   def update_target_enemy_selection
  204.      @enemy_arrow.update
  205.     if Input.trigger?(Input::B)
  206.       Sound.play_cancel
  207.       end_target_enemy_selection
  208.     elsif Input.trigger?(Input::C)
  209.       Sound.play_decision
  210.       @active_battler.action.target_index = @enemy_arrow.enemy.index
  211.       end_target_enemy_selection
  212.       end_skill_selection
  213.       end_item_selection
  214.       next_actor
  215.     end
  216.   end


  217. end


  218. class Spriteset_Battle ##
  219.   def viewport3
  220.     return @viewport3
  221.   end  
  222. end

  223. class Game_Battler
  224.   attr_accessor :loop_white_flash              # 循环白色闪烁标记
  225. end

  226. class Sprite_Battler ##
  227.   alias old_setup_new_effect setup_new_effect
  228.   def setup_new_effect
  229.     if @battler.loop_white_flash and @effect_duration == 0
  230.       @battler.white_flash = true
  231.     end
  232.     old_setup_new_effect
  233.   end
  234. end


  235. #==============================================================================
  236. # ■ Window_Enemy
  237. #------------------------------------------------------------------------------
  238. #  显示敌人信息的窗口,光标Arrow用。
  239. #==============================================================================

  240. class Window_Enemy < Window_Base
  241.   #--------------------------------------------------------------------------
  242.   # ● 初始化窗口
  243.   #     x : 窗口的X坐标
  244.   #     y : 窗口的Y坐标
  245.   #--------------------------------------------------------------------------
  246.   def initialize(x, y)
  247.     super(x, y, 288, WLH * 2 + 32)   
  248.    self.opacity = 0

  249.    self.contents.font.size = 13           ####字号
  250.    self.x=130                             ##### x
  251.    self.y=35                              ##### y

  252.   end

  253.   #--------------------------------------------------------------------------
  254.   # ● 设置文本
  255.   #     text  : 窗口显示的字符串
  256.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  257.   #--------------------------------------------------------------------------
  258.   def set_text(text, align = 0)
  259.     # 如果文本和对齐方式的至少一方与上次的不同
  260.     if text != @text or align != @align
  261.       # 再描绘文本
  262.       self.contents.clear
  263.       self.contents.font.color = normal_color
  264.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  265.       @text = text
  266.       @align = align
  267.       @actor = nil
  268.     end
  269.     self.visible = true
  270.   end
  271.   
  272.   
  273.   #--------------------------------------------------------------------------
  274.   # ● 设置敌人
  275.   #     enemy : 要显示名字和状态的敌人
  276.   #--------------------------------------------------------------------------
  277.   def set_enemy(enemy)
  278.     if @enemy != enemy
  279.     text = enemy.name
  280.     set_text(text)
  281.     w = enemy.states.size * 24
  282.     draw_actor_state(enemy, contents.width - w , 0, w)
  283.     draw_actor_hp(enemy, 0 , WLH  )
  284.     draw_actor_mp(enemy, contents.width - 120 , WLH )  
  285.     @enemy = enemy
  286.     end
  287.   end
  288. end
复制代码
其中中这:
  1. class Arrow_Enemy < Arrow_Base
  2.   #--------------------------------------------------------------------------
  3.   # ● 获取光标指向的敌人
  4.   #--------------------------------------------------------------------------
  5.   def enemy
  6.     return $game_troop.members[@index]
  7.   end
  8.   
  9.   def dispose
  10.     @enemy.loop_white_flash = false unless @enemy.nil?
  11.     super
  12.   end
  13.   #--------------------------------------------------------------------------
  14.   # ● 刷新画面
  15.   #--------------------------------------------------------------------------
  16.   def update
  17.     super
  18.      if @enemy != enemy and enemy.exist?
  19.         @enemy.loop_white_flash = false unless @enemy.nil?
  20.         enemy.loop_white_flash = true
  21.         @enemy = enemy
  22.       end  
  23.    
  24.     # 如果指向不存在的敌人就离开
  25.     $game_troop.members.size.times do
  26.       break if self.enemy.exist?
  27.       @index += 1
  28.       @index %= $game_troop.members.size
  29.     end
  30.     # 光标右
  31.     if Input.repeat?(Input::RIGHT) or Input.repeat?(Input::DOWN)
  32.       Sound.play_cursor
  33.       $game_troop.members.size.times do
  34.         @index += 1
  35.         @index %= $game_troop.members.size
  36.         break if self.enemy.exist?
  37.       end
  38.     end
  39.     # 光标左
  40.     if Input.repeat?(Input::LEFT) or Input.repeat?(Input::UP)
  41.      Sound.play_cursor
  42.       $game_troop.members.size.times do
  43.         @index += $game_troop.members.size - 1
  44.         @index %= $game_troop.members.size
  45.         break if self.enemy.exist?
  46.       end
  47.     end
  48.     # 设置活动块坐标
  49.     if self.enemy != nil
  50.       self.x = self.enemy.screen_x
  51.       self.y = self.enemy.screen_y
  52.     end
  53.   end
复制代码
应该是判断敌人坐标的。。。

我想请教下 懂一些脚本的高手,,,怎么把  画面上的坐标  赋予 那个鼠标指针,,,,,应该不难吧。。。求教。。


《尘沙的选择》2D动作射击剧情解谜末世题材独立游戏
STEAM地址
《午餐13:血肉机器 》全新故事线版本
STEAM连接

Lv1.梦旅人

梦石
0
星屑
50
在线时间
251 小时
注册时间
2010-7-22
帖子
88
发表于 2012-5-31 13:24:56 | 显示全部楼层
本人新手 但是发现直接用 最终幻想战斗系统就可以点选敌人。
看到帖子 也许时间很长了。不要鄙视我
有必要 留下QQ我传给你 2314996150


‘‘──szcszc156于2012-5-31 13:28补充以下内容:

[url]http://kuai.xunlei.com/d/YWQODTKRAYHY[/url]
这是我的工程 虽然只是硬凑但是我试了好几次绝对可以点选敌人
’’


‘‘──szcszc156于2012-5-31 13:38补充以下内容:

或者最推荐的是 vx官方范例Dragoness
用这个鼠标脚本
代码复制
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. #=================以下两个用来调整战斗时的手感问题,可以自己试试。
  6. $敌人选框扩大 = 20
  7. $角色选框扩大 = 30
  8.  
  9.  
  10. #==============================================================================
  11. # API调用
  12. #==============================================================================
  13. $ShowCursor = Win32API.new("user32", "ShowCursor", 'i', 'l')
  14. $GetCursorPos = Win32API.new("user32", "GetCursorPos", 'p', 'i')
  15. $ScreenToClient = Win32API.new("user32", "ScreenToClient", 'ip', 'i')
  16. $GetActiveWindow = Win32API.new("user32", "GetActiveWindow", nil, 'l')
  17. $Window_HWND = $GetActiveWindow.call
  18. $GetKeyState = Win32API.new("user32", "GetKeyState", 'i', 'i')
  19. #$FindWindow = Win32API.new("user32", "FindWindow", 'pp', 'i')
  20. #$HookStart  = Win32API.new("mouse_hook.dll", "HookStart", 'i', nil)
  21. #$HookEnd  = Win32API.new("mouse_hook.dll", "HookEnd", nil, nil)
  22. #$GetMouseStatus  = Win32API.new("mouse_hook.dll", "GetMouseStatus", 'i', 'i')
  23. #$Window_HWND = $FindWindow.call(nil, 'mousetry')
  24.  
  25. module Mouse  
  26.   LEFT = 0x01
  27.   RIGHT = 0x02
  28.  
  29.   def self.init(sprite = nil)
  30. #   $HookStart.call($Window_HWND)
  31.     $ShowCursor.call(0)
  32.  
  33.     @show_cursor = false
  34.  
  35.     @mouse_sprite = Sprite.new
  36.     @mouse_sprite.z = 99999
  37.     @mouse_sprite.bitmap = Bitmap.new('Graphics/Icons/001-Weapon01.png')
  38.     #@mouse_sprite.bitmap.fill_rect(Rect.new(0, 0, 32, 32), Color.new(0, 0, 0))
  39.  
  40.     @left_press = false
  41.     @right_press = false
  42.     @left_trigger = false
  43.     @right_trigger = false
  44.     @left_repeat = false
  45.     @right_repeat = false
  46.     @click_lock = false
  47.  
  48.     update
  49.   end
  50.   def self.exit
  51.     @mouse_sprite.bitmap.dispose
  52.     @mouse_sprite.dispose
  53.     @show_cursor = true
  54. #    $HookEnd.call
  55.     $ShowCursor.call(1)
  56.   end
  57.   def self.mouse_debug
  58.     return @mouse_debug.bitmap
  59.   end
  60.   def self.update
  61.     left_down = $GetKeyState.call(0x01)
  62.     right_down = $GetKeyState.call(0x02)
  63.  
  64.     @click_lock = false
  65.     mouse_x, mouse_y = self.get_mouse_pos
  66.     if @mouse_sprite != nil
  67.       @mouse_sprite.x = mouse_x
  68.       @mouse_sprite.y = mouse_y
  69.     end
  70.     if left_down[7] == 1
  71.       @left_repeat = (not @left_repeat)
  72.       @left_trigger = (not @left_press)
  73.       @left_press = true
  74.     else
  75.       @left_press = false
  76.       @left_trigger = false
  77.       @left_repeat = false
  78.     end
  79.     if right_down[7] == 1
  80.       @right_repeat = (not @right_repeat)
  81.       @right_trigger = (not @right_press)
  82.       @right_press = true
  83.     else
  84.       @right_press = false
  85.       @right_trigger = false
  86.       @right_repeat = false
  87.     end
  88.   end
  89.   def self.get_mouse_pos
  90.     point_var = [0, 0].pack('ll')
  91.     if $GetCursorPos.call(point_var) != 0
  92.       if $ScreenToClient.call($Window_HWND, point_var) != 0
  93.         x, y = point_var.unpack('ll')
  94.         if (x < 0) or (x > 10000) then x = 0 end
  95.         if (y < 0) or (y > 10000) then y = 0 end
  96.         if x > 544 then x = 544 end
  97.         if y > 416 then y = 416 end
  98.         return x, y
  99.       else
  100.         return 0, 0
  101.       end
  102.     else
  103.       return 0, 0
  104.     end
  105.   end
  106.   def self.press?(mouse_code)
  107.     if mouse_code == LEFT
  108.       if @click_lock
  109.         return false
  110.       else
  111.         return @left_press
  112.       end
  113.     elsif mouse_code == RIGHT
  114.       return @right_press
  115.     else
  116.       return false
  117.     end
  118.   end
  119.   def self.trigger?(mouse_code)
  120.     if mouse_code == LEFT
  121.       if @click_lock
  122.         return false
  123.       else
  124.         return @left_trigger
  125.       end
  126.     elsif mouse_code == RIGHT
  127.       return @right_trigger
  128.     else
  129.       return false
  130.     end
  131.   end
  132.   def self.repeat?(mouse_code)
  133.     if mouse_code == LEFT
  134.       if @click_lock
  135.         return false
  136.       else
  137.         return @left_repeat
  138.       end
  139.     elsif mouse_code == RIGHT
  140.       return @right_repeat
  141.     else
  142.       return false
  143.     end
  144.   end
  145.   def self.click_lock?
  146.     return @click_lock
  147.   end
  148.   def self.click_lock
  149.     @click_lock = true
  150.   end
  151.   def self.click_unlock
  152.     @click_lock = false
  153.   end
  154. end
  155. module Input
  156.   if @self_update == nil
  157.     @self_update = method('update')
  158.     @self_press = method('press?')
  159.     @self_trigger = method('trigger?')
  160.     @self_repeat = method('repeat?')
  161.   end
  162.   def self.update
  163.     @self_update.call
  164.     Mouse.update
  165.   end
  166.   def self.press?(key_code)
  167.     if @self_press.call(key_code)
  168.       return true
  169.     end
  170.     if key_code == C
  171.       return Mouse.press?(Mouse::LEFT)
  172.     elsif key_code == B
  173.       return Mouse.press?(Mouse::RIGHT)
  174.     else
  175.       return @self_press.call(key_code)
  176.     end
  177.   end
  178.   def self.trigger?(key_code)
  179.     if @self_trigger.call(key_code)
  180.       return true
  181.     end
  182.     if key_code == C
  183.       return Mouse.trigger?(Mouse::LEFT)
  184.     elsif key_code == B
  185.       return Mouse.trigger?(Mouse::RIGHT)
  186.     else
  187.       return @self_trigger.call(key_code)
  188.     end
  189.   end
  190.   def self.repeat?(key_code)
  191.     if @self_repeat.call(key_code)
  192.       return true
  193.     end
  194.     if key_code == C
  195.       return Mouse.repeat?(Mouse::LEFT)
  196.     elsif key_code == B
  197.       return Mouse.repeat?(Mouse::RIGHT)
  198.     else
  199.       return @self_repeat.call(key_code)
  200.     end
  201.   end
  202. end
  203.  
  204. class Window_Selectable
  205.   if @self_alias == nil
  206.     alias self_update update
  207.     @self_alias = true
  208.   end
  209.   def update
  210.     #self.cursor_rect.empty
  211.     self_update
  212.     if self.active and @item_max > 0
  213.       index_var = @index
  214.       tp_index = @index
  215.       mouse_x, mouse_y = Mouse.get_mouse_pos
  216.       mouse_not_in_rect = true
  217.       for i in 0...@item_max
  218.         @index = i
  219.         update_cursor
  220.         top_x = self.cursor_rect.x + self.x + 16
  221.         top_y = self.cursor_rect.y + self.y + 16
  222.         bottom_x = top_x + self.cursor_rect.width
  223.         bottom_y = top_y + self.cursor_rect.height
  224.  
  225.           top_x += self.x_mod
  226.           top_y += self.y_mod
  227.           bottom_x += self.x_mod
  228.           bottom_y += self.y_mod
  229.  
  230.         if (mouse_x > top_x) and (mouse_y > top_y) and
  231.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  232.           mouse_not_in_rect = false
  233.           if tp_index != @index
  234.             tp_index = @index
  235.             $data_system.sounds[0].play
  236.           end
  237.           break
  238.         end
  239.       end
  240.     if Input.trigger?(Input::F9)
  241.     p top_x,top_y,Mouse.get_mouse_pos
  242.     end
  243.       if mouse_not_in_rect
  244.         @index = index_var
  245.         update_cursor
  246.         Mouse.click_lock
  247.       else
  248.         Mouse.click_unlock               
  249.       end
  250.     end
  251.   end
  252. end
  253.  
  254.  
  255.  
  256.  
  257. class Window_NameInput
  258.   if @self_alias == nil
  259.     alias self_update update
  260.     @self_alias = true
  261.   end
  262.   def update
  263.     #self.cursor_rect.empty
  264.     self_update
  265.     if self.active
  266.       index_var = @index
  267.       mouse_x, mouse_y = Mouse.get_mouse_pos
  268.       mouse_not_in_rect = true
  269.       for i in (0...HIRAGANA.size).to_a.push(180)
  270.         @index = i
  271.         update_cursor
  272.         top_x = self.cursor_rect.x + self.x + 16
  273.         top_y = self.cursor_rect.y + self.y + 16
  274.         bottom_x = top_x + self.cursor_rect.width
  275.         bottom_y = top_y + self.cursor_rect.height
  276.         #
  277.         if (mouse_x > top_x) and (mouse_y > top_y) and
  278.            (mouse_x < bottom_x) and (mouse_y < bottom_y)
  279.           mouse_not_in_rect = false
  280.           break
  281.         end
  282.       end
  283.       if mouse_not_in_rect
  284.         @index = index_var
  285.         update_cursor
  286.         Mouse.click_lock
  287.       else
  288.         Mouse.click_unlock
  289.       end
  290.     end
  291.   end
  292. end
  293. =begin
  294.  
  295. class Window_InputNumber
  296.   if @self_alias == nil
  297.     alias self_update update
  298.     @self_alias = true
  299.   end
  300.   def update
  301.     #self.cursor_rect.empty
  302.     self_update
  303.     mouse_x, mouse_y = Mouse.get_mouse_pos
  304.     if self.active and @digits_max > 0
  305.       index_var = @index
  306.       mouse_not_in_rect = true
  307.       for i in 0...@digits_max
  308.         @index = i
  309.         #update_cursor
  310.         top_x = self.cursor_rect.x + self.x + 16
  311.         bottom_x = top_x + self.cursor_rect.width
  312.         #
  313.         if (mouse_x > top_x) and (mouse_x < bottom_x)
  314.           mouse_not_in_rect = false
  315.           break
  316.         end
  317.       end
  318.       if mouse_not_in_rect
  319.         @index = index_var
  320.         #update_cursor
  321.         Mouse.click_lock
  322.       else
  323.         Mouse.click_unlock
  324.       end
  325.     end
  326.     if @last_mouse_y == nil
  327.       @last_mouse_y = mouse_y
  328.     end
  329.     check_pos = (@last_mouse_y - mouse_y).abs
  330.     if check_pos > 10
  331.       #$game_system.se_play($data_system.cursor_se)
  332.       place = 10 ** (@digits_max - 1 - @index)
  333.       n = @number / place % 10
  334.       @number -= n * place
  335.       n = (n + 1) % 10 if mouse_y < @last_mouse_y
  336.       n = (n + 9) % 10 if mouse_y > @last_mouse_y
  337.       @number += n * place
  338.       refresh
  339.       @last_mouse_y = mouse_y
  340.     end
  341.   end
  342. end
  343. =end
  344. class Scene_File
  345.   if @self_alias == nil
  346.     alias self_update update
  347.     @self_alias = true
  348.   end
  349.   def update
  350.     mouse_x, mouse_y = Mouse.get_mouse_pos
  351.     Mouse.click_lock
  352.     idx = 0
  353.     for i in @savefile_windows
  354.       top_x = i.x + 16
  355.       top_y = i.y + 16
  356.       bottom_x = top_x + i.width
  357.       bottom_y = top_y + i.height
  358.       if (mouse_x > top_x) and (mouse_y > top_y) and
  359.          (mouse_x < bottom_x) and (mouse_y < bottom_y)
  360.         i.selected = true
  361.         if @file_index != idx
  362.           @file_index = idx
  363.           $data_system.sounds[0].play
  364.         end            
  365.         Mouse.click_unlock
  366.       else
  367.         i.selected = false
  368.       end
  369.       idx += 1
  370.     end
  371.     self_update
  372.   end
  373. end
  374.  
  375. class Game_Player
  376.   if @self_alias == nil
  377.     alias self_update update
  378.     @self_alias = true
  379.   end
  380.   def update
  381.     mouse_x, mouse_y = Mouse.get_mouse_pos
  382.     if @last_move_x == nil
  383.       @last_move_x = false
  384.     end
  385.     if Mouse.press?(Mouse::LEFT)
  386.    #for event in $game_map.events.values
  387.    #if event.screen_x/32 == mouse_x/32 and event.screen_y/32-1 == mouse_y/32
  388.    #event.start
  389.    #end
  390.    #end
  391.       last_moving = moving?
  392.       last_direction = @direction
  393.     #  return unless movable?
  394.     #  return if $game_map.interpreter.running?
  395.       unless moving? or $game_map.interpreter.running?
  396.       last_x = @x
  397.         if @last_move_x
  398.           @last_move_x = false
  399.         elsif mouse_x > screen_x + 16
  400.           move_right
  401.         elsif mouse_x < screen_x - 16
  402.           move_left
  403.         end
  404.         last_y = @y
  405.         if last_x != @x
  406.           @last_move_x = true
  407.         elsif mouse_y > screen_y
  408.           move_down
  409.         elsif mouse_y < screen_y - 32
  410.           move_up
  411.         end
  412. =begin        
  413.         if last_y != @y
  414.           @last_move_x = false
  415.         elsif not @last_move_x
  416.           case last_direction
  417.           when 2
  418.             turn_down
  419.           when 4
  420.             turn_left
  421.           when 6
  422.             turn_right
  423.           when 8
  424.             turn_up
  425.           end        
  426.         end
  427. =end         
  428.       end
  429.     end
  430.     self_update
  431.   end
  432. end
  433. Mouse.init
  434. END { Mouse.exit }
  435.  
  436.  
  437. class Window_Base < Window
  438.   attr_accessor :x_mod
  439.   attr_accessor :y_mod
  440.   alias ka_initialize initialize
  441.   def initialize(x, y, width, height)
  442.     ka_initialize(x, y, width, height)
  443.     self.x_mod = 0
  444.     self.y_mod = 0
  445.   end
  446. end
  447. class Window_PartyCommand < Window_Command
  448.   alias ka1_initialize initialize
  449.   def initialize
  450.     ka1_initialize
  451.     self.y_mod = 288
  452.   end
  453. end
  454. class Window_ActorCommand < Window_Command
  455.   alias ka2_initialize initialize
  456.   def initialize
  457.     ka2_initialize
  458.     self.x_mod = -128
  459.     self.y_mod = 288
  460.   end
  461. end
  462.  
  463. #==============================================================================
  464. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  465. #==============================================================================
不用那些选择脚本直接就可以选择敌人
试过N遍无冲突

’’
回复

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-3-29 22:50

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表