赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 35025 |
最后登录 | 2017-9-29 |
在线时间 | 231 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 231 小时
- 注册时间
- 2007-12-17
- 帖子
- 541
|
这个脚本的作用是当MISS的时候被攻击方移动战斗图,我希望添加的是:当命中的时候被攻击方的战斗图快速地左右往复移动三个来回,用来模仿抖动的样子,在播放完攻击动画之前移回原位,应该怎么改?- 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 @battler != value and value != nil
- self.x = value.screen_x
- end
- @hzhj_x = self.x
- @battler = 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 = -64
- elsif target.is_a?(Game_Enemy)
- target.add_x = 64
- 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
复制代码 |
评分
-
查看全部评分
|