赞 | 5 |
VIP | 0 |
好人卡 | 2 |
积分 | 36 |
经验 | 24079 |
最后登录 | 2024-11-22 |
在线时间 | 1891 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 3606
- 在线时间
- 1891 小时
- 注册时间
- 2010-6-19
- 帖子
- 1211
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
下面的脚本是【Miss伤害时战斗图移动】,如何改成收到攻击时战斗图移动。- class Game_Battler
- attr_accessor :add_x
- attr_accessor :add_y
- alias hzhj_old_ini initialize
- def initialize
- hzhj_old_ini
- @add_x = 0
- @add_y = 0
- end
- end
- class Sprite_Battler < RPG::Sprite
- MoveSpeed = 8 # X 方向每次移动多少像素
- MoveSpeed_Y = 6 # Y 方向每次移动多少像素
- Jump_SE = RPG::AudioFile.new("任务-翻页音效", 0, 0) #躲避显示音效,后面2个0是声音大小
-
- alias hzhj_old_initialize initialize
- def initialize(*args)
- hzhj_old_initialize(*args)
- if not @battler.nil?
- self.x = @battler.screen_x
- self.y = @battler.screen_y
- self.z = @battler.screen_y
- @hzhj_play_jump = true
- end
- @hzhj_x = self.x
- @hzhj_y = self.y
- end
- def battler=(value)
- if [url=home.php?mod=space&uid=133701]@battler[/url] != value and value != nil
- self.x = value.screen_x
- self.y = value.screen_y
- self.z = value.screen_y
- @hzhj_play_jump = true
- end
- @hzhj_x = self.x
- @hzhj_y = self.y
- @battler = value
- end
- alias hzhj_old_update update
- def update
- 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
- if @hzhj_play_jump
- Audio.se_play("Audio/SE/#{Jump_SE.name}", Jump_SE.volume, Jump_SE.pitch)
- @hzhj_play_jump = false
- end
- elsif self.x > @battler.screen_x + @battler.add_x
- self.x = [self.x - MoveSpeed, @battler.screen_x + @battler.add_x].max
- if @hzhj_play_jump
- Audio.se_play("Audio/SE/#{Jump_SE.name}", Jump_SE.volume, Jump_SE.pitch)
- @hzhj_play_jump = false
- end
- end
- if self.y < @battler.screen_y + @battler.add_y
- self.y = [self.y + MoveSpeed_Y, @battler.screen_y + @battler.add_y].min
- if @hzhj_play_jump
- Audio.se_play("Audio/SE/#{Jump_SE.name}", Jump_SE.volume, Jump_SE.pitch)
- @hzhj_play_jump = false
- end
- elsif self.y > @battler.screen_y + @battler.add_y
- self.y = [self.y - MoveSpeed_Y, @battler.screen_y + @battler.add_y].max
- if @hzhj_play_jump
- Audio.se_play("Audio/SE/#{Jump_SE.name}", Jump_SE.volume, Jump_SE.pitch)
- @hzhj_play_jump = false
- end
- end
- if self.x == @battler.screen_x and self.y == @battler.screen_y
- @hzhj_play_jump = true
- end
- end
- @hzhj_x = self.x
- @hzhj_y = self.y
- hzhj_old_update
- self.x = @hzhj_x
- self.y = @hzhj_y
- self.z = @hzhj_y
- end
- def x
- if @effect_hzhj
- if @battler.nil?
- return super
- else
- return @battler.screen_x
- end
- else
- return super
- end
- end
- def y
- if @effect_hzhj
- if @battler.nil?
- return super
- else
- return @battler.screen_y
- 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
- ACTOR_ADD_X = 10 # X 方向角色一共要移动的像素
- ACTOR_ADD_Y = 10 # Y 方向角色一共要移动的像素
- ENEMY_ADD_X = -10 # X 方向敌人一共要移动的像素
- ENEMY_ADD_Y = -10 # Y 方向敌人一共要移动的像素
- 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 = ACTOR_ADD_X
- target.add_y = ACTOR_ADD_Y
- elsif target.is_a?(Game_Enemy)
- target.add_x = ENEMY_ADD_X
- target.add_y = ENEMY_ADD_Y
- 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
- target.add_y = 0
- end
- end
- end
复制代码 |
|