赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 3120 |
最后登录 | 2015-5-3 |
在线时间 | 112 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 112 小时
- 注册时间
- 2012-3-16
- 帖子
- 65
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 沉默是惊 于 2013-8-18 16:33 编辑
来个大侠看下如何给下面的脚本加上Y坐标的移动
- class Game_Battler
- attr_accessor :add_x
- alias hzhj_old_ini initialize
- def initialize
- hzhj_old_ini
- @add_x = 0
- end
- end
- class Sprite_Battler < RPG::Sprite
- MoveSpeed = 8
- alias hzhj_old_initialize initialize
- def initialize(viewport, battler = nil)
- hzhj_old_initialize(viewport, battler)
- if not @battler.nil?
- self.x = @battler.screen_x
- end
- @hzhj_x = self.x
- end
- def battler=(value)
- if [url=home.php?mod=space&uid=133701]@battler[/url] != value and value != nil
- self.x = value.screen_x
- end
- @hzhj_x = self.x
- [url=home.php?mod=space&uid=133701]@battler[/url] = value
- end
- alias hzhj_old_update update
- def update
- hzhj_old_update
- self.x = @hzhj_x
- if not @battler.nil? and not @battler.dead?
- if self.x < @battler.screen_x + @battler.add_x
- self.x = [self.x + MoveSpeed, @battler.screen_x + @battler.add_x].min
- elsif self.x > @battler.screen_x + @battler.add_x
- self.x = [self.x - MoveSpeed, @battler.screen_x + @battler.add_x].max
- end
- end
- @hzhj_x = self.x
- end
- def x
- if @effect_hzhj
- if @battler.nil?
- return super
- else
- return @battler.screen_x
- end
- else
- return super
- end
- end
- def update_animation
- @effect_hzhj = true
- super
- @effect_hzhj = false
- end
- def animation(*args)
- @effect_hzhj = true
- super(*args)
- @effect_hzhj = false
- end
- def update_damage
- @effect_hzhj = true
- super
- @effect_hzhj = false
- end
- def damage(*args)
- @effect_hzhj = true
- super(*args)
- @effect_hzhj = false
- end
- end
- class Scene_Battle
- alias hzhj_old_update_phase4_step4 update_phase4_step4
- def update_phase4_step4
- hzhj_old_update_phase4_step4
- for target in @target_battlers
- next if target.dead?
- next if target.damage != "Miss"
- if target.is_a?(Game_Actor)
- target.add_x = 10
- elsif target.is_a?(Game_Enemy)
- target.add_x = -10
- end
- end
- end
- alias hzhj_old_update_phase4_step5 update_phase4_step5
- def update_phase4_step5
- hzhj_old_update_phase4_step5
- for target in @target_battlers
- target.add_x = 0
- end
- end
- end
复制代码 |
|