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

Project1

 找回密码
 注册会员
搜索
查看: 1915|回复: 0
打印 上一主题 下一主题

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
112 小时
注册时间
2012-3-16
帖子
65
跳转到指定楼层
1
发表于 2013-8-14 10:18:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 沉默是惊 于 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
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-9-21 13:29

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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