|
|
|
|
武器决定杀敌方式 v0.1 ( 66RPG, RPG MAKER XP教程 )
本站首页→制作教程→战斗系统相关 |
|
武器决定杀敌方式 v0.1
教程作者:秀秀
首发网址:点此进入本教学的原始帖
适宜用户:RMXP用户 技术通用度:★★★★★ 技术应用复杂度:50 (满分150分) 学习的理解难度:50 (满分150分)
|
作者的话: 武器决定杀敌方式 v0.1
作者:秀秀
这个是根据武器ID来判断杀敌人方式的
默认做了8种杀敌方式 截图效果不好 具体还是看范例吧
如果希望增加新的杀敌方式 请回帖,如果能做我会增加进去的
当然自己能看懂自己脚本添加也是可以的
使用方法:设置死亡方式数组里面包含的武器ID 设置件脚本开始的常量 例如:Dead_Way3 = [12,14,77] 表示武器数据库ID为12,14,77的武器使用的是第三种死亡方式 如果不包含在树组里面的 全部使用默认的死亡方式 死亡方式对照表如下: 1.右=>左 2.X压缩 3.Y压缩 4.闪烁 5.扫描线 6.斜飞 7.一文字斩 8.倒
教学正文:

-------------下载范例----------------------------------------------------------------------- http://bbs.66rpg.com/upload_program/files/武器决定杀敌方式_95795734.rar -----------------------------------------------------------------------------------------------
=begin 武器决定杀敌人方式v0.1 作者:秀秀
使用方法:设置死亡方式数组里面包含的武器ID 设置件脚本开始的常量 例如:Dead_Way3 = [12,14,77] 表示武器数据库ID为12,14,77的武器使用的是第三种死亡方式 如果不包含在树组里面的 全部使用默认的死亡方式 死亡方式对照表如下: 1.右=>左 2.X压缩 3.Y压缩 4.闪烁 5.扫描线 6.斜飞 7.一文字斩 8.倒
=end
# 这里设置 武器ID的杀敌方式
module Dead_Way Dead_Way1 = [1,2,3,4] Dead_Way2 = [5,6,7,8] Dead_Way3 = [9,10,11,12] Dead_Way4 = [13,14,15,16] Dead_Way5 = [17,18,19,20] Dead_Way6 = [21,22,23,24] Dead_Way7 = [25,26,27,28] Dead_Way8 = [29,30,31,32] end
module RPG class Sprite < ::Sprite @@kind = 0 def initialize(viewport = nil) super(viewport) @_whiten_duration = 0 @_appear_duration = 0 @_escape_duration = 0 @_collapse_duration = 0 @_damage_duration = 0 @_animation_duration = 0 @dead_way_duration = 0 @temp_sprite = nil @_blink = false end alias ori_whiten whiten def whiten ori_whiten @dead_way_duration = 0 end alias ori_appear appear def appear ori_appear @dead_way_duration = 0 end alias ori_escape escape def escape ori_escape @dead_way_duration = 0 end alias ori_collapse collapse def collapse ori_collapse @dead_way_duration = 0 end alias ori_dispose dispose def dispose dispose_temp_sprite ori_dispose end def dispose_temp_sprite if @temp_sprite != nil @temp_sprite.bitmap.dispose @temp_sprite.dispose @_damage_sprite = nil end end def dead_way(kind) @@kind = kind @width = self.bitmap.width @height = self.bitmap.height
if kind != 4 @temp_sprite = Sprite.new @temp_sprite.bitmap = self.bitmap.clone @temp_sprite.x = self.x @temp_sprite.y = self.y - @temp_sprite.bitmap.height/2 @temp_sprite.ox = @width/2 @temp_sprite.oy = @height/2 self.opacity = 0 end
case @@kind when 1 #create_sprite(1) @dead_way_duration = 60 @w = @width/8 when 2 #create_sprite(2) @dead_way_duration = 60 when 3 #create_sprite(3) @dead_way_duration = 60 when 4 @dead_way_duration = 70 when 5 #create_sprite(5) @dead_way_duration = 120 @h = @height/30 @array_lines = [] for i in 0..31 @array_lines.push(@h*i) end when 6 #create_sprite(6) @dead_way_duration = 100 when 7 #create_sprite(7) @dead_way_duration = 40 when 8 #create_sprite(8) @dead_way_duration = 40 #@temp_sprite.angle = 90 end @_escape_duration = 0 @_whiten_duration = 0 @_appear_duration = 0 @_collapse_duration = 0 end
def effect? @_whiten_duration > 0 or @_appear_duration > 0 or @_escape_duration > 0 or @_collapse_duration > 0 or @_damage_duration > 0 or @_animation_duration > 0 or @dead_way_duration > 0 end
def rigit_to_left @dead_way_duration -= 4 rect = Rect.new((@width-(1+@dead_way_duration/6)*@w)-3,0,@w+3,@height) # rect=Rect.new(0,0,10,80) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) if @dead_way_duration <= 0 @@kind = 0 end end def xx @dead_way_duration -= 4 @temp_sprite.zoom_x -= 0.1 if @dead_way_duration <= 6 @@kind = 0 end end def yy @dead_way_duration -= 6 @temp_sprite.zoom_y -= 0.12 if @dead_way_duration == 0 @@kind = 0 end end def shan @dead_way_duration -= 1 case @dead_way_duration when 69 self.opacity = 0 @temp_sprite = Sprite.new @temp_sprite.bitmap = self.bitmap.clone @temp_sprite.x = self.x @temp_sprite.y = self.y - self.bitmap.height/2 @temp_sprite.ox = @width/2 @temp_sprite.oy = @height/2 when 64..68 @temp_sprite.opacity = 0 when 58..63 @temp_sprite.opacity = 255 when 53..57 @temp_sprite.opacity = 0 when 48..52 @temp_sprite.opacity = 255 when 43..47 @temp_sprite.opacity = 0 when 38..42 @temp_sprite.opacity = 255 when 33..37 @temp_sprite.opacity = 0 when 29..32 @temp_sprite.opacity = 255 when 25..28 @temp_sprite.opacity = 0 when 22..24 @temp_sprite.opacity = 255 when 19..21 @temp_sprite.opacity = 0 when 16..18 @temp_sprite.opacity = 255 when 13..15 @temp_sprite.opacity = 0 when 10..12 @temp_sprite.opacity = 255 when 8..9 @temp_sprite.opacity = 0 when 6..7 @temp_sprite.opacity = 255 when 4..5 @temp_sprite.opacity = 0 when 2..3 @temp_sprite.opacity = 255 when 1 @temp_sprite.opacity = 0 when 0 @temp_sprite.opacity = 0 @@kind = 0 end end def line_es @dead_way_duration -= 3 if @array_lines.size == 0 return end a = rand(@array_lines.size) rect = Rect.new(0,@array_lines[a],@width,@h) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) @array_lines.delete_at a if @dead_way_duration <= 0 @@kind = 0 end end def fly_45 @dead_way_duration -= 2 @temp_sprite.x -= 3 @temp_sprite.y -= 3 @temp_sprite.angle -= 60 @temp_sprite.zoom_x -= 0.02 @temp_sprite.zoom_y -= 0.02 if @dead_way_duration <= 0 @@kind = 0 end end def yi @dead_way_duration -= 1 case @dead_way_duration when 39 rect = Rect.new(0,@temp_sprite.oy-@height/20,@width/5,@height/20) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) when 38 rect = Rect.new(@width/5,@temp_sprite.oy-@height/20,@width/5,@height/20) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) when 37 rect = Rect.new(@width/5*2,@temp_sprite.oy-@height/20,@width/5,@height/20) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) when 36 rect = Rect.new(@width/5*3,@temp_sprite.oy-@height/20,@width/5,@height/20) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) when 35 rect = Rect.new(@width/5*4,@temp_sprite.oy-@height/20,@width/5,@height/20) @temp_sprite.bitmap.fill_rect(rect,Color.new(0,0,0,0)) when 34 @temp_sprite.opacity = 0 @sprite1 = Sprite.new @sprite2 = Sprite.new @sprite1.x,@sprite1.y = @temp_sprite.x,@temp_sprite.y @sprite2.x,@sprite2.y = @temp_sprite.x,@temp_sprite.y @sprite1.ox,@sprite1.oy = @temp_sprite.ox,@temp_sprite.oy @sprite2.ox,@sprite2.oy = @temp_sprite.ox,@temp_sprite.oy
@sprite1.bitmap = Bitmap.new(@width,@height) @sprite2.bitmap = Bitmap.new(@width,@height) @sprite1.bitmap.blt(0,0,@temp_sprite.bitmap,Rect.new(0,0,@width, @temp_sprite.oy)) @sprite2.bitmap.blt(0,@temp_sprite.oy,@temp_sprite.bitmap,Rect.new(0, @temp_sprite.oy,@width,@temp_sprite.oy)) when 25..33 @sprite1.x -= 2 @sprite2.x += 2 when 1..24 @sprite1.opacity -= 10 @sprite2.opacity -= 10 when 0 @@kind = 0 @sprite1.dispose @sprite1.bitmap.dispose @sprite2.dispose @sprite2.bitmap.dispose end end def dao @dead_way_duration -= 1 case @dead_way_duration when 33..39 @temp_sprite.y -= 6 when 28..32 @temp_sprite.angle = 180 when 21..27 @temp_sprite.y += 6 when 10..20 @temp_sprite.angle = 90 when 0..9 @temp_sprite.opacity = 0 end if @dead_way_duration <= 0 @@kind = 0 end end def update super if @_whiten_duration > 0 @_whiten_duration -= 1 self.color.alpha = 128 - (16 - @_whiten_duration) * 10 end if @_appear_duration > 0 @_appear_duration -= 1 self.opacity = (16 - @_appear_duration) * 16 end if @_escape_duration > 0 @_escape_duration -= 1 self.opacity = 256 - (32 - @_escape_duration) * 10 end if @_collapse_duration > 0 @_collapse_duration -= 1 self.opacity = 256 - (48 - @_collapse_duration) * 6 end if @_damage_duration > 0 @_damage_duration -= 1 case @_damage_duration when 38..39 @_damage_sprite.y -= 4 when 36..37 @_damage_sprite.y -= 2 when 34..35 @_damage_sprite.y += 2 when 28..33 @_damage_sprite.y += 4 end @_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32 if @_damage_duration == 0 dispose_damage end end
if @dead_way_duration > 0 case @@kind when 0 @dead_way_duration -= 1 when 1 rigit_to_left when 2 xx when 3 yy when 4 shan when 5 line_es when 6 fly_45 when 7 yi when 8 dao end # @@kind = 0 end
if @_animation != nil and (Graphics.frame_count % 2 == 0) @_animation_duration -= 1 update_animation end if @_loop_animation != nil and (Graphics.frame_count % 2 == 0) update_loop_animation @_loop_animation_index += 1 @_loop_animation_index %= @_loop_animation.frame_max end if @_blink @_blink_count = (@_blink_count + 1) % 32 if @_blink_count < 16 alpha = (16 - @_blink_count) * 6 else alpha = (@_blink_count - 16) * 6 end self.color.set(255, 255, 255, alpha) end @@_animations.clear end
end end
class Sprite_Battler < RPG::Sprite def update super if @battler == nil self.bitmap = nil loop_animation(nil) return end if @battler.battler_name != @battler_name or @battler.battler_hue != @battler_hue @battler_name = @battler.battler_name @battler_hue = @battler.battler_hue self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue) @width = bitmap.width @height = bitmap.height self.ox = @width / 2 self.oy = @height if @battler.dead? or @battler.hidden self.opacity = 0 end end if @battler.damage == nil and @battler.state_animation_id != @state_animation_id @state_animation_id = @battler.state_animation_id loop_animation($data_animations[@state_animation_id]) end if @battler.is_a?(Game_Actor) and @battler_visible if $game_temp.battle_main_phase self.opacity += 3 if self.opacity < 255 else self.opacity -= 3 if self.opacity > 207 end end if @battler.blink blink_on else blink_off end unless @battler_visible if not @battler.hidden and not @battler.dead? and (@battler.damage == nil or @battler.damage_pop) appear @battler_visible = true end end if @battler_visible if @battler.hidden $game_system.se_play($data_system.escape_se) escape @battler_visible = false end if @battler.white_flash whiten @battler.white_flash = false end if @battler.animation_id != 0 animation = $data_animations[@battler.animation_id] animation(animation, @battler.animation_hit) @battler.animation_id = 0 end if @battler.damage_pop damage(@battler.damage, @battler.critical) @battler.damage = nil @battler.critical = false @battler.damage_pop = false end if @battler.damage == nil and @battler.dead? if @battler.is_a?(Game_Enemy) $game_system.se_play($data_system.enemy_collapse_se) else $game_system.se_play($data_system.actor_collapse_se) end
id = $scene.active_battler.weapon_id
for i in 1..8 if eval("Dead_Way::Dead_Way#{i}").include?(id) dead_way(i) break else collapse end end
@battler_visible = false end end
self.x = @battler.screen_x self.y = @battler.screen_y self.z = @battler.screen_z end end
class Scene_Battle attr_reader :active_battler end
教学相关RGSS类/函数: RPG::Sprite RPG::Sprite < ::Sprite
关键字:
发布日期:2008-8-6 21:14:28 点击量:226
上一篇:影子 下一篇:纸娃娃V0.1
|
|