def shooting
if Input.trigger?(Input::C) or Input.repeat?(Input::C)
@me.shotn_spread
end
end
def back_menu
if Input.trigger?(Input::F5)
$scene = Scene_Map.new
end
end
def boss_info
if @boss_switch
@window_boss.refresh(@enemy[70].hp)
if @enemy[70].mode_switch
@enemy[70].attack_mode
end
end
end
def my_death
if @me.hp <=0 and @judge_over
$scene = Scene_Map.new
end
end
def hit_you_me
for i in 0..@enemy_num
if @enemy_switch
hit_enemy(i)
end
hit_myself(i)
enemy_bullet_move(i)
end
end
def enemy_animation
for i in 0..@enemy_num
if @blast_switch
@blast.animation
if @blast.control == -1
@blast.dispose
@enemy.dispose
@blast_switch = false
end
end
end
for i in 0..@enemy_num
if @blast_hit_switch
@blast_hit.animation
if @blast_hit.control == -1
@blast_hit.dispose
@blast_hit_switch = false
end
end
end
end
def me_animation
if @my_blast_hit_switch
@my_blast_hit.animation
if @my_blast_hit.control == -1
@my_blast_hit.dispose
@my_blast_hit_switch = false
end
end
if @my_blast_switch
@my_blast.animation
if @my_blast.control == -1
@me.dispose
$scene = Scene_Gameover.new
end
end
end
def move_items
if @bomb_switch
@bomb.move
if @bomb.pic.y >= 600
@bomb.dispose
@bomb_switch = false
end
end
if @level_switch
@level.move
if @level.pic.y >= 600
@level.dispose
@level_switch = false
end
end
if @power_switch
@power.move
if @power.pic.y >= 600
@power.dispose
@power_switch = false
end
end
if @food_switch
@food.move
if @food.pic.y >= 600
@food.dispose
@food_switch = false
end
end
end
def bomb_blast
if Input.trigger?(Input::A)
if @bomb_num > 0 and @bomb_ctrl == true
Audio.se_play("Audio/SE/Explosion02")
@bomb_ctrl = false
@bomb_num -= 1
for i in 0..@enemy_num
if @enemy_switch
@enemy.hp -= 10
end
end
for i in 0..5
@bomb_blast_switch = true
case i
when 0..2
@bomb_blast = Blast_Explosion2.new( i * 200,50)
when 3..5
@bomb_blast = Blast_Explosion2.new( (i - 3) * 200,220)
end
end
end
end
for i in 0..5
if @bomb_blast_switch
@bomb_blast.animation
if @bomb_blast.control == -1
@bomb_blast.dispose
@bomb_blast_switch = false
@bomb_ctrl = true
end
end
end
end
def eat_items
if @bomb_switch
if @me.eat_bomb(@bomb.pic.x,@bomb.pic.y)
@bomb_num += 1
@bomb.dispose
@bomb_switch = false
end
end
if @level_switch
if @me.eat_level(@level.pic.x,@level.pic.y)
@level.dispose
@level_switch = false
if @me.level < 4
@me.level += 2
end
end
end
if @power_switch
if @me.eat_power(@power.pic.x,@power.pic.y)
@me.power += 1
@power.dispose
@power_switch = false
end
end
if @food_switch
if @me.eat_food(@food.pic.x,@food.pic.y)
@me.hp += 50
if @me.hp >=200
@me.hp = 200
end
@food.dispose
@food_switch = false
end
end
end
def enemy_leave
for i in 0..@enemy_num
if @enemy_switch
if @enemy.pic.x < -100 or @enemy.pic.x > 700 or @enemy.pic.y > 500 or @enemy.pic.y < -150
@enemy.dispose
@enemy_switch = false
end
end
end
end
def enemy_pattern
if @speed == 5
@result.refresh(@me.hp,@score,@destroy,@bomb_num)
for i in 0..@enemy_num
if @enemy_switch
@fly_pattern.pattern(@enemy,i)
@attack_pattern.pattern(@me,i,@enemy)
end
end
@speed = 0
end
end
def game_process
if @process < 100
@window_show.refresh(0)
elsif @process == 100
@window_show.contents.clear
Audio.se_play("Audio/SE/start")
end
if @process <= 250 and @process >= 50 and @process % 50 == 0
@enemy[@enemy_num] = Enemy_Li.new(-80,100)
@enemy_switch[@enemy_num] = true
@bullet_switch[@enemy_num] = true
@enemy_num += 1
@enemy[@enemy_num] = Enemy_Li.new(640,100)
@enemy_switch[@enemy_num] = true
@bullet_switch[@enemy_num] = true
@enemy_num += 1
end
if @process < 3100 and @process>= 3000
@window_show.refresh(1)
elsif @process == 3100
@window_show.contents.clear
Audio.bgm_stop
Audio.se_play("Audio/SE/warning")
end
if @process == 3200
@enemy[@enemy_num] = Enemy_Boss.new(150,-120)
@enemy_switch[@enemy_num] = true
@bullet_switch[@enemy_num] = true
@boss_switch = true
@enemy_num += 1
Audio.bgm_play("Audio/BGM/action_world2")
end
if @victory and @record == 0
Audio.me_play("Audio/ME/victory")
@record = @process
end
if @victory
if @process != @record + 100
@window_show.refresh(2)
else
$scene = Scene_Map.new
end
end
end
def hit_myself(turn)
if @bullet_switch[turn]
for i in 0..@enemy[turn].bullet_num
if @enemy[turn].attack
if(@me.hit(@enemy[turn].bullet.pic.x,@enemy[turn].bullet.pic.y,@enemy[turn].bullet.power))
if @me.hp > 0 and @my_blast_hit_switch == false
@my_blast_hit_switch = true
@my_blast_hit = Blast_Hit.new(@me.pic.x - 30 ,@me.pic.y - 30)
end
@enemy[turn].bullet.dispose
@enemy[turn].attack = false
end
end
end
end
end
def hit_enemy(turn)
for i in [email protected]_num
if @me.attack
if(@enemy[turn].hit(@me.bullet.pic.x,@me.bullet.pic.y,@me.power))
if @enemy[turn].hp > 0 and @blast_hit_switch[turn] == false
@blast_hit[turn] = Blast_Hit.new(@enemy[turn].pic.x- 20 ,@enemy[turn].pic.y)
@blast_hit_switch[turn] = true
end
@me.bullet.dispose
@me.attack = false
end
end
end
if @enemy[turn].hp <= 0
@score += 10 * @enemy[turn].level
@destroy += 1
Audio.se_play("Audio/SE/Explosion01")
@blast[turn] = Blast_Explosion.new(@enemy[turn].pic.x - 30,@enemy[turn].pic.y)
@blast_switch[turn] = true
@enemy_switch[turn] = false
if turn == 4 or turn == 21 or turn == 53 or turn == 64
@bomb = Bomb.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
@bomb_switch = true
end
if turn == 12 or turn == 34 or turn == 47 or turn == 65
@level = Level.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
@level_switch = true
end
if turn == 33
@power = Power.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
@power_switch = true
end
if turn == 30 or turn == 66
@food = Food.new(@enemy[turn].pic.x + 50,@enemy[turn].pic.y + 40)
@food_switch = true
end
if turn == 70
@victory = true
end
end
end
def enemy_bullet_move(turn)
if @bullet_switch[turn]
for i in 0..@enemy[turn].bullet_num
if @enemy[turn].attack
if @enemy[turn].bullet.type == 0
@enemy[turn].bullet.down_fly
end
if @enemy[turn].bullet.type == 1
@enemy[turn].bullet.search_fly(1)
end
if @enemy[turn].bullet.type == 2
@enemy[turn].bullet.search_fly(1)
end
if @enemy[turn].bullet.pic.y >=500
@enemy[turn].attack=false
@enemy[turn].bullet.dispose
end
end
end
end
end
def my_bullet_move
for i in @[email protected]_num
if @me.attack
@me.bullet.search_fly(2)
if @me.bullet.pic.y <= -60
@me.attack=false
@me.bullet.dispose
@count += 1
end
end
end
end
def pl_move
if Input.trigger?(Input::UP) or Input.repeat?(Input::UP)
if @me.pic.y>=0
@me.pic.y-=20
end
end
if Input.trigger?(Input::RIGHT) or Input.repeat?(Input::RIGHT)
if @me.pic.x<=520
@me.pic.x+=20
end
end
if Input.trigger?(Input::DOWN) or Input.repeat?(Input::DOWN)
if @me.pic.y <=380
@me.pic.y+=20
end
end
if Input.trigger?(Input::LEFT) or Input.repeat?(Input::LEFT)
if @me.pic.x>=0
@me.pic.x-=20
end
end
end
end
def eat_bomb(x,y)
if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
Audio.se_play("Audio/SE/eatbomb")
return true
else
return false
end
end
def eat_level(x,y)
if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
Audio.se_play("Audio/SE/eatlevel")
return true
else
return false
end
end
def eat_power(x,y)
if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
Audio.se_play("Audio/SE/eatpower")
return true
else
return false
end
end
def eat_food(x,y)
if x <= @pic.x + 80 and x >= @pic.x + 20 and y <= @pic.y + 70 and y >= @pic.y
Audio.se_play("Audio/SE/eatlevel")
return true
else
return false
end
end
def shotn_spread
for i in 0..@level
shot_spread(i)
end
end
def shot_spread(place)
Audio.se_play("Audio/SE/destroyer_lazer1")
@bullet[@bullet_num] = My_Bullet.new(@power)
angle = Math::PI * (place + 1) / (@level + 2)
x = Math.cos(angle)
y = Math.sin(angle)
if x == 0
@bullet[@bullet_num].ratiox = 0
@bullet[@bullet_num].ratio = 1
@bullet[@bullet_num].ratioy = -1
else
@bullet[@bullet_num].ratio = y / x
if @bullet[@bullet_num].ratio > 0
@bullet[@bullet_num].ratiox = -1
@bullet[@bullet_num].ratioy = -1
else
@bullet[@bullet_num].ratiox = 1
@bullet[@bullet_num].ratioy = 1
end
end
if @power == 1
@bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + 30
@bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) - 30
elsif @power ==2
@bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle)
@bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) - 60
end
@attack[@bullet_num] = true
@bullet_num += 1
end
def hit(x,y,power)
if x >= @pic.x and x <= @pic.x + 70 and y >= @pic.y and y <= @pic.y + 40
@hp -= power
Audio.se_play("Audio/SE/lazer_hit")
return true
end
return false
end
def shotn(num)
for i in 0..num
shot_forward(i,num)
end
end
def shotn_me(plane,num)
for i in 0..num
shot_me(plane,i,num)
end
end
def shot_me(plane,place,num)
Audio.se_play("Audio/SE/117-Fire01")
@bullet[@bullet_num] = Enemy_Bullet.new(@power)
@bullet[@bullet_num].type = 1
x = (plane.pic.x - pic.x) *1.0
y = plane.pic.y - pic.y
if x == 0
@bullet[@bullet_num].ratiox = 0
if y >= 0
@bullet[@bullet_num].ratio = 1
else
@bullet[@bullet_num].ratio = -1
end
else
@bullet[@bullet_num].ratio = y / x
if @bullet[@bullet_num].ratio == 0
if x >= 0
@bullet[@bullet_num].ratiox = 1
else
@bullet[@bullet_num].ratiox = -1
end
else
if x > 0
@bullet[@bullet_num].ratiox = 1
else
@bullet[@bullet_num].ratiox = -1
@bullet[@bullet_num].ratioy = -1
end
end
end
if @power == 1
@bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 30+ @boss_suit
elsif @power == 4
@bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 60+ @boss_suit
else
@bullet[@bullet_num].pic.x = @pic.x + (place + 1) * width/ (num + 2) - 100+ @boss_suit
end
@bullet[@bullet_num].pic.y = @pic.y + 60+ @boss_suit
@attack[@bullet_num] = true
@bullet_num += 1
end
def shotn_spread(num)
for i in 0..num
shot_spread(i,num)
end
end
def shot_spread(place,num)
Audio.se_play("Audio/SE/117-Fire01")
@bullet[@bullet_num] = Enemy_Bullet.new(@power)
@bullet[@bullet_num].type = 2
angle = Math::PI * (place + 1) / (num + 2)
x = Math.cos(angle)
y = Math.sin(angle)
if x == 0
@bullet[@bullet_num].ratiox = 0
@bullet[@bullet_num].ratio = 1
else
@bullet[@bullet_num].ratio = y / x
if @bullet[@bullet_num].ratio > 0
@bullet[@bullet_num].ratiox = - 1
else
@bullet[@bullet_num].ratiox = 1
@bullet[@bullet_num].ratioy = -1
end
end
if @power == 1 or @power == 4
@bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + 30+ @boss_suit
else
@bullet[@bullet_num].pic.x = @pic.x - 40 * Math.cos(angle) + @boss_suit
end
@bullet[@bullet_num].pic.y = @pic.y + 40 * Math.sin(angle) + 40+ @boss_suit
@attack[@bullet_num] = true
@bullet_num += 1
end
def hit(x,y,power)
if x >= @pic.x- 10 and x <= @pic.x + 80 and y >= @pic.y and y <= @pic.y + 40
@hp -= power
Audio.se_play("Audio/SE/lazer_hit")
return true
end
return false
end
def dispose
@pic.dispose
end
end
class Enemy_Li < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = -1
@bullet_size = 0
@speed = 2
@level= 1
@hp = 2
@pic.bitmap = RPG::Cache.picture("LiPlane")
end
end
class Enemy_Green < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 0
@bullet_size = 0
@speed = 2
@power = 1
@level= 2
@hp = 2
@pic.bitmap = RPG::Cache.picture("GreenPlane")
end
end
class Enemy_God < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 1
@bullet_size = 0
@level = 4
@power = 1
@speed = 2
@hp = 5
@pic.bitmap = RPG::Cache.picture("GodPlane")
end
end
class Enemy_X < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 1
@bullet_size = 2
@level = 6
@power = 1
@speed = 1
@hp = 10
@pic.bitmap = RPG::Cache.picture("XPlane")
end
end
class Enemy_Jit < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 0
@bullet_size = 1
@power = 2
@level = 5
@speed = 1
@hp = 15
@pic.bitmap = RPG::Cache.picture("JitPlane")
end
end
class Enemy_Jp < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 2
@bullet_size = 3
@level = 6
@speed = 1
@power = 3
@hp = 15
@pic.bitmap = RPG::Cache.picture("JpPlane")
end
end
class Enemy_LX < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 1
@bullet_size = 4
@level = 10
@power = 4
@speed = 1
@hp = 30
@pic.bitmap = RPG::Cache.picture("LXPlane")
end
end
class Enemy_Red < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 2
@bullet_size = 1
@level = 5
@power = 3
@speed = 1
@hp = 20
@pic.bitmap = RPG::Cache.picture("RedPlane")
end
end
class Enemy_Toon < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 1
@bullet_size = 0
@level = 3
@power = 1
@speed = 2
@hp = 2
@pic.bitmap = RPG::Cache.picture("ToonPlane")
end
end
class Enemy_Ye < Enemy_Plane
def initialize(x,y)
super(x,y)
@attack_type = 0
@bullet_size = 1
@power = 1
@level = 6
@speed = 2.5
@hp = 5
@pic.bitmap = RPG::Cache.picture("YePlane")
end
end
def attack_mode
@attack_type = rand(3)
mode_switch = false
case @attack_type
when 0
@power = 4
@bullet_size = 6
when 1
@power = 3
@bullet_size = 5
when 2
@power = 2
@bullet_size = 10
end
end
def hit(x,y,power)
if x >= @pic.x - 40 and x <= @pic.x + 280 and y >= @pic.y and y <= @pic.y + 140
@hp -= power
Audio.se_play("Audio/SE/lazer_hit")
return true
end
return false
end
end
class Blast
attr_accessor :pic
attr_accessor :control
attr_accessor :speed
def initialize(x,y)
@control = 0
@speed =0
@pic = Sprite.new
@pic.x = x
@pic.y = y
@pic.bitmap = Bitmap.new(192,192)
end
def dispose
@pic.dispose
end
end
class Blast_Explosion < Blast
def initialize(x,y)
super(x,y)
end
def animation
if @speed == 5
if @control ==2 or @control == 4 or @control == 5
@pic.bitmap.dispose
@pic.bitmap = Bitmap.new(192,192)
end
if @control <= 4
@pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion01"),Rect.new(192*@control,0,192,192))
@control +=1
elsif @control > 4 and @control <= 5
@pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion01"),Rect.new(192*(@control - 4),192,192,192))
@control +=1
else
@control = -1
end
@speed = 0
end
@speed += 1
end
end
class Blast_Explosion2 < Blast
def initialize(x,y)
super(x,y)
end
def animation
if @speed == 5
if @control == 2 or @control == 4 or @control == 6 or @control == 9
@pic.bitmap.dispose
@pic.bitmap = Bitmap.new(192,192)
end
if @control <= 4
@pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion02"),Rect.new(192*@control,0,192,192))
@control +=1
elsif @control > 4 and @control <= 9
@pic.bitmap.blt(0,0,RPG::Cache.picture("Explosion02"),Rect.new(192*(@control - 4),192,192,192))
@control +=1
else
@control = -1
end
@speed = 0
end
@speed += 1
end
end
class Blast_Hit < Blast
def initialize(x,y)
super(x,y)
end
def animation
if @speed == 2
if @control ==2 or @control == 4 or @control == 6 or @control == 9
@pic.bitmap.dispose
@pic.bitmap = Bitmap.new(192,192)
end
if @control <= 4
@pic.bitmap.blt(0,0,RPG::Cache.picture("011-Weapon06"),Rect.new(192*@control,0,192,192))
@control +=1
elsif @control > 4 and @control <= 9
@pic.bitmap.blt(0,0,RPG::Cache.picture("011-Weapon06"),Rect.new(192*(@control - 4),192,192,192))
@control +=1
else
@control = -1
end
@speed = 0
end
@speed += 1
end
end
class Fly_Pattern
attr_accessor :control
attr_accessor :direction
def initialize
@control = []
@direction = 1
for i in 0..100
@control = 0
end
end
def pattern(plane,turn)
case turn
when 21
pattern_0(plane,turn)
when 22
pattern_1(plane,turn)
when 10,11,12,15,16,25,26,53
pattern_2(plane)
when 47,48
pattern_3(plane)
when 0,2,4,6,8,13,17,19,23,27,29,31,33,35,37,49,51,54,56,58,60,62,66,68
pattern_4(plane)
when 1,3,5,7,9,14,18,20,24,28,30,32,34,36,38,50,52,55,57,59,61,63,67,69
pattern_5(plane)
when 39,41,43
pattern_6(plane)
when 40,42,44
pattern_7(plane)
when 45,64
pattern_8(plane,turn)
when 46,65
pattern_9(plane,turn)
when 70
pattern_boss(plane,turn)
else
pattern_0(plane,turn)
end
end
def pattern_0(plane,turn)
@control[turn] += 1
if @control[turn]< 40
plane.pic.y += 5*plane.speed
end
if @control[turn]>= 40 and @control[turn] <= 100
plane.pic.x += 5*plane.speed
end
if @control[turn] > 100
plane.pic.y -= 5*plane.speed
end
end
def pattern_1(plane,turn)
@control[turn] += 1
if @control[turn]< 40
plane.pic.y += 5*plane.speed
end
if @control[turn]>= 40 and @control[turn] <= 100
plane.pic.x -= 5*plane.speed
end
if @control[turn] > 100
plane.pic.y -= 5*plane.speed
end
end
def pattern_2(plane)
plane.pic.y +=5*plane.speed
end
def pattern_3(plane)
plane.pic.y -=5*plane.speed
end
def pattern_4(plane)
plane.pic.x +=5*plane.speed
end
def pattern_5(plane)
plane.pic.x -= 5*plane.speed
end
def pattern_6(plane)
plane.pic.x += 4*plane.speed
plane.pic.y += 4*plane.speed
end
def pattern_7(plane)
plane.pic.x -= 4*plane.speed
plane.pic.y += 4*plane.speed
end
def pattern_8(plane,turn)
@control[turn] += 1
if @control[turn] <= 60
plane.pic.x += 4 *plane.speed
end
if @control[turn] <= 100 and @control[turn] > 60
plane.pic.y += 3*plane.speed
end
if @control[turn] <=160 and @control[turn] >100
plane.pic.x -= 4*plane.speed
end
if @control[turn] <=200 and @control[turn] >160
plane.pic.y += 3*plane.speed
end
if @control[turn] >200
plane.pic.x += 4 * plane.speed
end
end
def pattern_9(plane,turn)
@control[turn] += 1
if @control[turn] <= 60
plane.pic.x -= 4 *plane.speed
end
if @control[turn] <= 100 and @control[turn] > 60
plane.pic.y += 3*plane.speed
end
if @control[turn] <=160 and @control[turn] >100
plane.pic.x += 4 * plane.speed
end
if @control[turn] <=200 and @control[turn] >160
plane.pic.y += 3*plane.speed
end
if @control[turn] >200
plane.pic.x -= 4 * plane.speed
end
end
def pattern_boss(plane,turn)
@control[turn] += 1
if @control[turn] <= 30
plane.pic.y += 5 *plane.speed
end
if @control[turn] > 30 and @control[turn] <= 60
plane.pic.x -= 5 * plane.speed
end
if @control[turn] > 60
plane.pic.x += 5 *plane.speed * @direction
if (@control[turn] - 120) % 60 == 0
@direction = - @direction
end
end
end
end
class Attack_Pattern
attr_accessor :control
def initialize
@control = []
for i in 0..100
@control = 0
end
end
def pattern(me,turn,plane)
case plane.attack_type
when 0
forward(turn,plane)
when 1
search(me,turn,plane)
when 2
spread(turn,plane)
end
end
def forward(turn,plane)
case turn
when 10,11,12,15,16
forward_1(turn,plane)
when 21,22
forward_2(turn,plane)
when 39,40,41,42,43,44
forward_3(turn,plane)
when 70
forward_boss(turn,plane)
else
forward_1(turn,plane)
end
end
def forward_1(turn,plane)
@control[turn] += 1
if @control[turn] % 10 == 0
plane.shotn(plane.bullet_size)
end
end
def forward_2(turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn(plane.bullet_size)
end
if @control[turn] % 15 == 1
plane.shotn(plane.bullet_size)
end
if @control[turn] % 15 == 2
plane.shotn(plane.bullet_size)
end
end
def forward_3(turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn(plane.bullet_size)
end
if @control[turn] % 15 == 1
plane.shotn(plane.bullet_size)
end
end
def forward_boss(turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn(plane.bullet_size)
end
if @control[turn] % 15 == 3
plane.shotn(plane.bullet_size)
end
if @control[turn] == 60
@control[turn] == 0
plane.mode_switch = true
end
end
def search(me,turn,plane)
case turn
when 13,14,66,67,68,69
search_1(me,turn,plane)
when 23,24,25,26,49,50,51,52
search_2(me,turn,plane)
when 53,64,65
search_3(me,turn,plane)
when 70
search_boss(me,turn,plane)
else
search_1(me,turn,plane)
end
end
def search_1(me,turn,plane)
@control[turn] += 1
if @control[turn] % 10 == 0
plane.shotn_me(me,plane.bullet_size)
end
end
def search_2(me,turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn_me(me,plane.bullet_size)
end
if @control[turn] % 15 == 1
plane.shotn_me(me,plane.bullet_size)
end
if @control[turn] % 15 == 2
plane.shotn_me(me,plane.bullet_size)
end
end
def search_3(me,turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn_me(me,plane.bullet_size)
end
if @control[turn] % 15 == 3
plane.shotn_me(me,plane.bullet_size - 1)
end
end
def search_boss(me,turn,plane)
@control[turn] += 1
if @control[turn] % 10 == 0
plane.shotn_me(me,plane.bullet_size)
end
if @control[turn] % 10 == 1
plane.shotn_me(me,plane.bullet_size)
end
if @control[turn] % 10 == 2
plane.shotn_me(me,plane.bullet_size)
end
if @control[turn] == 30
@control[turn] == 0
plane.mode_switch = true
end
end
def spread(turn,plane)
case turn
when 45,46
spread_1(turn,plane)
when 37,38,47,48
spread_2(turn,plane)
when 70
spread_boss(turn,plane)
else
spread_1(turn,plane)
end
end
def spread_1(turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn_spread(plane.bullet_size)
end
if @control[turn] % 15 == 1
plane.shotn_spread(plane.bullet_size - 1)
end
if @control[turn] % 15 == 2
plane.shotn_spread(plane.bullet_size)
end
if @control[turn] % 15 == 3
plane.shotn_spread(plane.bullet_size - 1)
end
end
def spread_2(turn,plane)
@control[turn] += 1
if @control[turn] % 10 == 0
plane.shotn_spread(plane.bullet_size)
end
end
def spread_boss(turn,plane)
@control[turn] += 1
if @control[turn] % 15 == 0
plane.shotn_spread(plane.bullet_size)
end
if @control[turn] % 15 == 2
plane.shotn_spread(plane.bullet_size - 1)
end
if @control[turn] % 15 == 4
plane.shotn_spread(plane.bullet_size)
end
if @control[turn] % 15 == 6
plane.shotn_spread(plane.bullet_size - 1)
end
if control[turn] == 60
@control[turn] == 0
plane.mode_switch = true
end
end
end
class My_Bullet < Bullet
def initialize(x)
super(x)
if x == 1
@pic.bitmap = RPG::Cache.picture("bullet_1")
elsif x == 2
@pic.bitmap = RPG::Cache.picture("bullet_2")
end
end
end
class Enemy_Bullet < Bullet
def initialize(x)
super(x)
if x == 1
@power = 1
@pic.bitmap = Bitmap.new(64,64)
@pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_03"),Rect.new(0,0,64,64))
elsif x == 2
@power = 2
@pic.bitmap = Bitmap.new(128,128)
@pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_01"),Rect.new(256,0,128,128))
elsif x == 3
@power = 3
@pic.bitmap = Bitmap.new(128,128)
@pic.bitmap.blt(0,0,RPG::Cache.picture("EnemyFire_02"),Rect.new(256,0,128,128))
elsif x == 4
@power = 4
@pic.bitmap = Bitmap.new(128,128)
@pic.bitmap.blt(0,0,RPG::Cache.picture("bullet_3"),Rect.new(0,0,128,128))
end
end
end
class Items
attr_accessor :pic
def initialize(x,y)
@pic = Sprite.new
@pic.x = x
@pic.y = y
end
def move
@pic.y += 1
end
def dispose
@pic.dispose
end
end
class Bomb < Items
attr_accessor :pic
def initialize(x,y)
super(x,y)
@pic.bitmap = RPG::Cache.picture("bomb")
end
end
class Level < Items
attr_accessor :pic
def initialize(x,y)
super(x,y)
@pic.bitmap = RPG::Cache.picture("level")
end
end
class Power < Items
attr_accessor :pic
def initialize(x,y)
super(x,y)
@pic.bitmap = RPG::Cache.picture("power")
end
end
class Food < Items
attr_accessor :pic
def initialize(x,y)
super(x,y)
@pic.bitmap = RPG::Cache.picture("food")
end
end
def refresh(turn)
self.contents.clear
self.contents.font.size = 80
self.contents.font.color = Color.new(255,80,20)
self.contents.font.bold = false
case turn
when 0
self.contents.draw_text(0,0,150,150,"开始")
when 1
self.contents.draw_text(0,0,150,150,"警告")
when 2
self.contents.draw_text(0,0,150,150,"胜利")
end
end
end