查看: 2100|回复: 0

[已经过期] 战斗图位置移动

[复制链接]
梦石
0
星屑
50
在线时间
112 小时
注册时间
2012-3-16
回帖
43
发表于 2013-8-14 10:18:57 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 沉默是惊 于 2013-8-18 16:33 编辑

来个大侠看下如何给下面的脚本加上Y坐标的移动

  1. class Game_Battler
  2.   attr_accessor :add_x
  3.   alias hzhj_old_ini initialize
  4.   def initialize
  5.     hzhj_old_ini
  6.     @add_x = 0
  7.   end
  8. end

  9. class Sprite_Battler < RPG::Sprite
  10.   MoveSpeed = 8
  11.   alias hzhj_old_initialize initialize
  12.   def initialize(viewport, battler = nil)
  13.     hzhj_old_initialize(viewport, battler)
  14.     if not @battler.nil?
  15.       self.x = @battler.screen_x
  16.     end
  17.     @hzhj_x = self.x
  18.   end
  19.   def battler=(value)
  20.     if [url=home.php?mod=space&uid=133701]@battler[/url] != value and value != nil
  21.       self.x = value.screen_x
  22.     end
  23.     @hzhj_x = self.x
  24.     [url=home.php?mod=space&uid=133701]@battler[/url] = value
  25.   end
  26.   alias hzhj_old_update update
  27.   def update
  28.     hzhj_old_update
  29.     self.x = @hzhj_x
  30.     if not @battler.nil? and not @battler.dead?
  31.       if self.x < @battler.screen_x + @battler.add_x
  32.         self.x = [self.x + MoveSpeed, @battler.screen_x + @battler.add_x].min
  33.       elsif self.x > @battler.screen_x + @battler.add_x
  34.         self.x = [self.x - MoveSpeed, @battler.screen_x + @battler.add_x].max
  35.       end
  36.     end
  37.     @hzhj_x = self.x
  38.   end
  39.   def x
  40.     if @effect_hzhj
  41.       if @battler.nil?
  42.         return super
  43.       else
  44.         return @battler.screen_x
  45.       end
  46.     else
  47.       return super
  48.     end
  49.   end
  50.   def update_animation
  51.     @effect_hzhj = true
  52.     super
  53.     @effect_hzhj = false
  54.   end
  55.   def animation(*args)
  56.     @effect_hzhj = true
  57.     super(*args)
  58.     @effect_hzhj = false
  59.   end
  60.   def update_damage
  61.     @effect_hzhj = true
  62.     super
  63.     @effect_hzhj = false
  64.   end
  65.   def damage(*args)
  66.     @effect_hzhj = true
  67.     super(*args)
  68.     @effect_hzhj = false
  69.   end
  70. end

  71. class Scene_Battle
  72.   alias hzhj_old_update_phase4_step4 update_phase4_step4
  73.   def update_phase4_step4
  74.     hzhj_old_update_phase4_step4
  75.     for target in @target_battlers
  76.       next if target.dead?
  77.       next if target.damage != "Miss"
  78.       if target.is_a?(Game_Actor)
  79.         target.add_x = 10
  80.       elsif target.is_a?(Game_Enemy)
  81.         target.add_x = -10
  82.       end
  83.     end
  84.   end
  85.   alias hzhj_old_update_phase4_step5 update_phase4_step5
  86.   def update_phase4_step5
  87.     hzhj_old_update_phase4_step5
  88.     for target in @target_battlers
  89.       target.add_x = 0
  90.     end
  91.   end
  92. end
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

在本版发帖返回顶部