Demo – Version 1.1 > (Demo uses old version)
#------------------------------------------------------------------------------#
# Galv's Invader Mini Game
#------------------------------------------------------------------------------#
# For: RPGMAKER VX ACE
# Version 1.2
# Thanks Ocedic for add-on ideas
#------------------------------------------------------------------------------#
# 2013-03-20 - Version 1.2 - added options for reset ratio and max gun powerup
# 2013-03-20 - Version 1.1 - added enemy types, new gun type, new powerup
# 2013-03-18 - Version 1.0 - release
#------------------------------------------------------------------------------#
# A simple shooter mini game that can be played within Ace with a script call.
#
# The game is designed to be simple. Enemies are random, they shoot random
# lazors at you. Powerups are random. Slowly during the course of the game
# the enemies spawn faster and faster until eventually the player will be
# overrun completely and die. A set time through the game, a reset powerup will
# spawn. If the player manages to get it, they get another chance at more
# points as it sets the spawn speed back to the start.
# Variables are used for current score and high score which you can use in
# your game to give your player bonuses for doing well or not.
#
# You'll need the demo for all the graphics (but feel free to create your own)
#
# NOTE: This is intended to be simple for now. Please don't ask for add-ons
# or improvements. I might improve it later but for now, it is what it is.
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# CONTROLS
#------------------------------------------------------------------------------#
# Left and Right - moves left and right
# Space/Z/Enter - fire your lazor
# ESC/X - Leave the mini game
# A - Use held item (currently only nuke)
#------------------------------------------------------------------------------#
# POWERUPS
#------------------------------------------------------------------------------#
# Heath - restores shields completely. If shields full, adds to an bonus bar
# Zzzz - resets enemy spawn rate to beginning (spawned only at a set time)
# Nuke - Can only hold one nuke at a time. Press A to destroy all enemies.
#
# Lazors - Get lazors or increases number of lazors fired
# Lazorball - Get lazorballs or increases number of lazorballs fired
#
# NOTE: Obtaining weapons equips them or improves them if already equipped
# NOTE2: Yes, I do know it's not spelled "lazor"
#------------------------------------------------------------------------------#
#------------------------------------------------------------------------------#
# SCRIPT CALL:
#------------------------------------------------------------------------------#
# SceneManager.call(Scene_Invaders) # Starts the minigame.
#------------------------------------------------------------------------------#
($imported ||= {})["Galv_Invaders"] = true
module Galv_SI
#------------------------------------------------------------------------------#
# SCRIPT SETTINGS
#------------------------------------------------------------------------------#
#----------------#
# PLAYER OPTIONS #
#----------------#
PLAYER_SHIELDS = 10 # Hits player can take before game over
MAX_SHOTS = 10 # Maxium number of shots player can have on screen at a time
Max_Gun_Level = 5 # Max gun powerup level (5 is the highest)
SE = ["Attack2",80,150] # "SE_Name",volume,pitch - SE for player laser
SE1 = ["Heal5",80,160] # "SE_Name",volume,pitch - SE for player lazorball
NSE = ["Explosion3",120,100] # "SE_Name",volume,pitch - SE for nuke
PSE = ["Damage5",90,150] # "SE_Name",volume,pitch - SE when player damaged
KSE = ["Explosion7",100,100] # "SE_Name",volume,pitch - SE when destroyed
BSE = ["Down4",120,150] # "SE_Name",volume,pitch - SE when bonus shield gain
PUSE = ["Item1",80,150] # "SE_Name",volume,pitch - SE when get powerup
SHIP_SPEED = 5 # Speed at which player can move ship left and right
LAZOR_SPEED = 5 # Speed the lazor fires
#---------------#
# ENEMY OPTIONS #
#---------------#
SPAWN_SPEED = 100 # Lower means faster spawn. Higher is slower spawn.
LEVEL2 = 30 # Seconds until level 2 ships can start spawning
LEVEL3 = 100 # Seconds until level 3 ships can start spawning
LEVEL1_HP = 1 # Level 1 enemies have this much hp
LEVEL2_HP = 4 # Level 2 enemies have this much hp
LEVEL3_HP = 12 # Level 3 enemies have this much hp
ELAZOR_SPEED = 5 # Enemy lazor speed
ASE = ["Attack2",80,110] # "SE_Name",volume,pitch - SE for enemy shooting
DSE = ["Fire3",90,150] # "SE_Name",volume,pitch - SE for enemy dying
#---------------#
# OTHER OPTIONS #
#---------------#
SCORE_VAR = 1 # Variable id to keep track of score
HIGH_SCORE_VAR = 2 # Variable id to keep track of highest score
RESET_PUP = 130 # Seconds between reset powerup spawns. If the
# player manages to get this, the enemy spawn rate is
# reset and has a chance to earn more points!
RESET_AMOUNT = 0.5 # Ratio of difficulty when reset powerup is obtained
SOUND_TIMER = 5 # Prevent enemy lazor sound spam by increasing this
DESTROY_PUPS = false # Can destroy powerups true or false
LAZOR_DAMAGE = 1 # Damage done when lazors hit
COLLIDE_DAMAGE = 4 # Damage done when collide with enemy
BGM_LIST = [ # don't touch
# List of BGM's to random. ["BGM_Name",volume,pitch]
["Battle6",100,110],
["Battle5",100,110],
# ["Battle5",100,110], # Add more as required
# ["Battle5",100,110], # Add more as required
# ["Battle5",100,110], # Add more as required
] # don't touch
#------------------------------------------------------------------------------#
# END OF SCRIPT SETTINGS
#------------------------------------------------------------------------------#
end
#-------------------------------------------------------------------------------
# CACHE
#-------------------------------------------------------------------------------
module Cache
def self.space(filename)
load_bitmap("Graphics/Invaders/", filename)
end
end # module Cache
#-------------------------------------------------------------------------------
# SCENE
#-------------------------------------------------------------------------------
class Scene_Invaders < Scene_Base
def start
$game_system.save_bgm
super
SceneManager.clear
Graphics.freeze
initialize_game
end
def initialize_game
play_bgm
init_variables
create_backdrop
create_sprites
create_stats
end
def play_bgm
m = Galv_SI::BGM_LIST[rand(Galv_SI::BGM_LIST.count)]
RPG::BGM.new(m[0],m[1],m[2]).play
end
def init_variables
@nukeall = false
@sound_timer = Galv_SI::SOUND_TIMER
@enemy_wave = 1
@guns = 1
@gun_type = 0
@bonus_shields = 0
@reset_pup = Galv_SI::RESET_PUP * 60
@player_shields = Galv_SI::PLAYER_SHIELDS
$game_variables[Galv_SI::SCORE_VAR] = 0
@plazors = []
@elazors = []
@enemies = []
@explodes = []
@pups = []
@spawn_timer = rand(Galv_SI::SPAWN_SPEED)
@ticker = 100
@game_time = 0
@alien_count = 0
@pups_count = 0
@difficulty = 0.to_f
@dead = false
end
def create_backdrop
@backdrop = Plane.new
@backdrop.bitmap = Cache.space("backdrop")
@backdrop.z = -1
@flash = Sprite.new
@flash.bitmap = Bitmap.new(Graphics.width,Graphics.height)
@flash.bitmap.fill_rect(@flash.bitmap.rect,Color.new(255,255,255))
@flash.z = 2000
@flash.opacity = 0
end
def create_sprites
@player = Sprite_Player.new(@viewport1)
@item_held = Sprite.new
@item_held.x = Graphics.width / 4 + 40
@item_held.y = 15
@item_held.z = 100
end
def draw_item_held
@item_held.bitmap.dispose if @item_held.bitmap
@item_held.opacity = 255
return @item_held.opacity = 0 if @item.nil?
@item_held.bitmap = Cache.space("item_" + @item.to_s)
end
def create_stats
@score_window = Window_InvaderScore.new
@score_window
end
def play_time
@game_time / 60
end
def update
update_flash
@game_time += 1
@reset_pup -= 1
super
update_backdrop
update_player
update_splosions
update_plazors
update_elazors
update_enemies
update_pups
if !@dead
update_spawn
else
update_game_over
end
end
def update_flash
@flash.opacity -= 3 if @flash.opacity > 0
end
def update_backdrop
@backdrop.oy -= 1
end
def update_spawn
if @spawn_timer <= 0
t = alien_type
if rand(alien_type).to_i == alien_type
@enemies << Sprite_Alien.new(@viewport1,@alien_count,t)
@alien_count += 1
else
@enemies << Sprite_Alien.new(@viewport1,@alien_count,0)
@alien_count += 1
end
@spawn_timer = 50 + rand(Galv_SI::SPAWN_SPEED) / 2 - @difficulty
end
@ticker -= 1
if @ticker <= 0
@difficulty += 1
@ticker = 100
end
@spawn_timer -= 1
end
def alien_type
r = rand(play_time)
if r < Galv_SI::LEVEL2
return 0
elsif r < Galv_SI::LEVEL3
return 1
else
return 2
end
end
def update_player
@player.update
update_player_actions
end
def init_game_over
RPG::BGM.fade(10)
@game_over = Sprite.new
@game_over.bitmap = Cache.space("game-over")
@game_over.opacity = 0
@game_over.z = 500
end
def update_game_over
@game_over.opacity += 3
if @game_over.opacity >= 255 && Input.trigger?(:C)
dispose_graphics
initialize_game
end
end
def update_player_actions
if Input.trigger?(:C) && !@dead
return if Galv_SI::MAX_SHOTS * @guns <= @plazors.count
player_shoot
end
if Input.trigger?(:B)
SceneManager.goto(Scene_Map)
end
if Input.trigger?(:X) && @item && !@dead
@nukeall = true
RPG::SE.new(Galv_SI::NSE[0],Galv_SI::NSE[1],Galv_SI::NSE[2]).play
@difficulty *= 0.75
@flash.opacity = 225
@item = nil
draw_item_held
end
end
def player_shoot
case @gun_type
when 0 # Normal Lazers
RPG::SE.new(Galv_SI::SE[0],Galv_SI::SE[1],Galv_SI::SE[2]).play
case @guns
when 1
@plazors << Sprite_Lazor.new(@viewport1,@player.x,@player.y)
when 2
2.times { |i|
@plazors << Sprite_Lazor.new(@viewport1,@player.x - 20 + i * 40,@player.y)
}
when 3
3.times { |i|
@plazors << Sprite_Lazor.new(@viewport1,@player.x - 20 + i * 20,@player.y)
}
when 4
4.times { |i|
@plazors << Sprite_Lazor.new(@viewport1,@player.x - 30 + i * 20,@player.y)
}
when 5
5.times { |i|
@plazors << Sprite_Lazor.new(@viewport1,@player.x - 30 + i * 15,@player.y)
}
end
when 1 # Lazer Ball
RPG::SE.new(Galv_SI::SE1[0],Galv_SI::SE1[1],Galv_SI::SE1[2]).play
case @guns
when 1
@plazors << Sprite_Lazor.new(@viewport1,@player.x,@player.y,1,0)
when 2
2.times { |i|
@plazors << Sprite_Lazor.new(@viewport1,@player.x,@player.y,1,1 + i)
}
when 3,4,5
@guns.times { |i|
@plazors << Sprite_Lazor.new(@viewport1,@player.x,@player.y,1,i)
}
end
end
end
def update_plazors
@plazors.each_with_index { |lazor,i|
lazor.update
if lazor.y < -10
lazor.dispose
@plazors.delete_at(i)
end
}
end
def update_elazors
@elazors.each_with_index { |lazor,i|
next if !lazor
lazor.update
if lazor.y > Graphics.height
lazor.dispose
@elazors[i] = false
elsif lazor.y > (Graphics.height - @player.height) && player_hit?(lazor.x,lazor.y)
damage_player(Galv_SI::LAZOR_DAMAGE)
lazor.dispose
@elazors[i] = false
end
}
end
def update_enemies
@sound_timer += 1
@enemies.each_with_index { |enemy,i|
next if enemy.nil?
enemy.update
if enemy_hit?(enemy) || @nukeall
enemy.hp -= @nukeall ? enemy.mhp : 1
if enemy.hp <= 0
destroy_enemy(enemy.mhp)
@explodes << Sprite_Splosion.new(@viewport1,enemy.x,enemy.y)
enemy.dispose
@enemies[i] = nil
else
RPG::SE.new(Galv_SI::PSE[0],Galv_SI::PSE[1],Galv_SI::PSE[2]).play
enemy.flash(Color.new(255,155,155),20)
end
elsif enemy.y > (Graphics.height - @player.height) && player_hit?(enemy.x,enemy.y)
destroy_enemy(enemy.mhp)
@explodes << Sprite_Splosion.new(@viewport1,enemy.x,enemy.y)
enemy.dispose
@enemies[i] = nil
damage_player(Galv_SI::COLLIDE_DAMAGE)
elsif rand(1000) > (995 - @difficulty)
if @elazors[i].nil?
if @sound_timer >= Galv_SI::SOUND_TIMER
RPG::SE.new(Galv_SI::ASE[0],Galv_SI::ASE[1],Galv_SI::ASE[2]).play
@sound_timer = 0
end
@elazors[i] = Sprite_ELazor.new(@viewport1,enemy.x,enemy.y)
end
end
}
@nukeall = false
end
def update_pups
if @reset_pup <= 0
@pups << Sprite_Powerup.new(@viewport1,@pups_count,999)
@reset_pup = (Galv_SI::RESET_PUP + @enemy_wave) * 60
end
if rand(1000) > (998) && !@dead
@pups << Sprite_Powerup.new(@viewport1,@pups_count,rand(4))
@pups_count += 1
end
@pups.each_with_index { |pup,i|
next if pup.nil?
pup.update
if enemy_hit?(pup,false) && Galv_SI::DESTROY_PUPS
RPG::SE.new(Galv_SI::DSE[0],Galv_SI::DSE[1],Galv_SI::DSE[2]).play
@explodes << Sprite_Splosion.new(@viewport1,pup.x,pup.y)
pup.dispose
@pups[i] = nil
elsif pup.y > (Graphics.height - @player.height) && player_hit?(pup.x,pup.y)
do_powerup(pup.type)
pup.dispose
@pups[i] = nil
end
}
end
def do_powerup(type)
@player.flash(Color.new(155,255,155),20)
case type
when 0 # Shield Restore
RPG::SE.new(Galv_SI::BSE[0],Galv_SI::BSE[1],Galv_SI::BSE[2]).play
if @player_shields == Galv_SI::PLAYER_SHIELDS
if @bonus_shields < Galv_SI::PLAYER_SHIELDS
@bonus_shields += 1
end
else
@player_shields = Galv_SI::PLAYER_SHIELDS
end
@score_window.refresh(@player_shields.to_f,@bonus_shields)
when 1 # Gun Type: 0 (Normal Lazor)
RPG::SE.new(Galv_SI::PUSE[0],Galv_SI::PUSE[1],Galv_SI::PUSE[2]).play
if @gun_type != 0
@gun_type = 0
elsif @guns < Galv_SI::Max_Gun_Level
@guns += 1
end
when 2 # Gun Type: 1 (Lazor Ball)
RPG::SE.new(Galv_SI::PUSE[0],Galv_SI::PUSE[1],Galv_SI::PUSE[2]).play
if @gun_type != 1
@gun_type = 1
elsif @guns < Galv_SI::Max_Gun_Level
@guns += 1
end
when 3
RPG::SE.new(Galv_SI::PUSE[0],Galv_SI::PUSE[1],Galv_SI::PUSE[2]).play
@item = "nuke"
draw_item_held
when 999 # Reset
RPG::SE.new(Galv_SI::PUSE[0],Galv_SI::PUSE[1],Galv_SI::PUSE[2]).play
@difficulty *= Galv_SI::RESET_AMOUNT
@enemy_wave += 1
end
end
def damage_player(amount)
RPG::SE.new(Galv_SI::PSE[0],Galv_SI::PSE[1],Galv_SI::PSE[2]).play
@player.flash(Color.new(255,155,155),20)
if @bonus_shields > 0
@bonus_shields = [@bonus_shields - amount,0].max
else
@player_shields -= amount
end
@score_window.refresh(@player_shields.to_f,@bonus_shields)
destroy_player if @player_shields <= 0
end
def destroy_enemy(score)
RPG::SE.new(Galv_SI::DSE[0],Galv_SI::DSE[1],Galv_SI::DSE[2]).play
$game_variables[Galv_SI::SCORE_VAR] += score
if $game_variables[Galv_SI::SCORE_VAR] > $game_variables[Galv_SI::HIGH_SCORE_VAR]
$game_variables[Galv_SI::HIGH_SCORE_VAR] += score
end
@score_window.refresh(@player_shields.to_f,@bonus_shields)
end
def destroy_player
@player_shields = 0
@explodes << Sprite_Splosion.new(@viewport1,@player.x,@player.y,2)
@player.opacity = 0
@player.x = -100
RPG::SE.new(Galv_SI::KSE[0],Galv_SI::KSE[1],Galv_SI::KSE[2]).play
@score_window.refresh(@player_shields.to_f,@bonus_shields)
init_game_over
@dead = true
end
def update_splosions
@explodes.each_with_index { |ex,i|
ex.update
if ex.finished?
ex.dispose
@explodes.delete_at(i)
end
}
end
def player_hit?(x,y)
if x.between?(@player.x - player_width / 6, @player.x + player_width / 6) &&
y.between?(@player.y - player_height, @player.y)
return true
end
return false
end
def enemy_hit?(enemy, kill = true)
@plazors.each_with_index { |lazor,i|
if lazor.x.between?(enemy.x - enemy.width / 2, enemy.x + enemy.width / 2) &&
lazor.y.between?(enemy.y - enemy.height / 2, enemy.y + enemy.height / 2)
if kill
lazor.dispose
@plazors.delete_at(i)
end
return true
end
}
false
end
def player_width
@player.bitmap.width
end
def player_height
@player.bitmap.height
end
def terminate
super
SceneManager.snapshot_for_background
dispose_graphics
$game_system.replay_bgm
end
def dispose_graphics
@item_held.bitmap.dispose if @item_held.bitmap
@plazors.each { |object| object.dispose if object }
@elazors.each { |object| object.dispose if object }
@enemies.each { |object| object.dispose if object }
@explodes.each { |object| object.dispose if object }
@pups.each { |object| object.dispose if object }
@backdrop.bitmap.dispose
@backdrop.dispose
@player.bitmap.dispose
@player.dispose
if @game_over
@game_over.bitmap.dispose
@game_over.dispose
end
@score_window.dispose
end
end # Scene_Invaders < Scene_Base
#-------------------------------------------------------------------------------
# PLAYER SPRITE
#-------------------------------------------------------------------------------
class Sprite_Player < Sprite
def initialize(viewport)
super(viewport)
init_position
end
def init_position
setup_player_image
end
def dispose
super
end
def update
super
update_src_rect
update_position
end
def setup_player_image
@cell = 1
self.bitmap = Cache.space("player")
@cw = bitmap.width / 3
self.src_rect.set(@cell * @cw, 0, @cw, height)
self.ox = @cw / 2
self.oy = height
self.x = Graphics.width / 2
self.y = Graphics.height - height / 4
end
def width
self.bitmap.width / 3
end
def height
self.bitmap.height
end
def update_src_rect
@cell = 1 if @cell > 3
sx = @cell * @cw
self.src_rect.set(sx, 0, @cw, height)
end
def update_position
if Input.press?(:LEFT) && !Input.press?(:RIGHT)
@cell = 0
self.x -= Galv_SI::SHIP_SPEED if self.x > width / 2
elsif Input.press?(:RIGHT) && !Input.press?(:LEFT)
@cell = 2
self.x += Galv_SI::SHIP_SPEED if self.x < Graphics.width - width / 2
else
@cell = 1
end
end
end # Sprite_Player < Sprite
#-------------------------------------------------------------------------------
# LAZOR SPRITES
#-------------------------------------------------------------------------------
class Sprite_Lazor < Sprite
def initialize(viewport,x,y,type = 0,dir = 0)
super(viewport)
self.x = x
self.y = y - 20
@type = type
@dir = dir
setup_lazor_image
end
def dispose
super
end
def update
super
update_position
end
def setup_lazor_image
case @type
when 0
self.bitmap = Cache.space("lazor")
when 1
self.bitmap = Cache.space("lazor_ball")
end
self.ox = bitmap.width / 2
self.oy = bitmap.height / 2
end
def update_position
self.y -= Galv_SI::LAZOR_SPEED
case @dir
when 1
self.x -= Galv_SI::LAZOR_SPEED.to_f / 4
when 2
self.x += Galv_SI::LAZOR_SPEED.to_f / 4 + 1
when 3
self.x -= Galv_SI::LAZOR_SPEED
when 4
self.x += Galv_SI::LAZOR_SPEED
end
end
end # Sprite_Lazor < Sprite
class Sprite_ELazor < Sprite
def initialize(viewport,x,y)
super(viewport)
self.x = x
self.y = y - 20
setup_lazor_image
end
def dispose
super
end
def update
super
update_position
end
def setup_lazor_image
self.bitmap = Cache.space("elazor")
self.ox = bitmap.width / 2
self.oy = bitmap.height / 2
end
def update_position
self.y += Galv_SI::ELAZOR_SPEED
end
end # Sprite_ELazor < Sprite
#-------------------------------------------------------------------------------
# ALIEN SPRITES
#-------------------------------------------------------------------------------
class Sprite_Alien < Sprite
attr_accessor :hp
attr_reader :mhp
def initialize(viewport,id,type = 0)
super(viewport)
@type = type
@id = id
@move = true # true is right, false is left
@speed = rand(2) + 1
@ticker = 0
setup_enemy
init_position
end
def init_position
self.x = rand(Graphics.width)
self.y = -10
end
def dispose
super
end
def update
super
update_move
end
def update_move
case @move
when true # Right
self.x += 1 * (@ticker * 0.06) if self.x <= Graphics.width
when false # Left
self.x -= 1 * (@ticker * 0.06) if self.x > 0
end
@ticker -= 1
self.y += @speed
if @ticker <= 0
@move = self.x < Graphics.width / 2 ? true : false
@ticker = rand(90)
end
end
def setup_enemy
self.bitmap = Cache.space("alien" + @type.to_s)
self.ox = bitmap.width / 2
self.oy = bitmap.height / 2
case @type
when 0
@hp = Galv_SI::LEVEL1_HP
when 1
@hp = Galv_SI::LEVEL2_HP
when 2
@hp = Galv_SI::LEVEL3_HP
@speed = 1
end
@mhp = @hp
end
def width
self.bitmap.width
end
def height
self.bitmap.height
end
end # Sprite_Alien < Sprite
#-------------------------------------------------------------------------------
# EXPLOSION SPRITES
#-------------------------------------------------------------------------------
class Sprite_Splosion < Sprite
def initialize(viewport,x,y,zoom = 1)
super(viewport)
self.x = x
self.y = y
@timer = 10
setup_explosion_image(zoom)
end
def dispose
super
end
def update
super
wait_for_timer
end
def setup_explosion_image(zoom)
self.bitmap = Cache.space("explode")
self.ox = bitmap.width / 2
self.oy = bitmap.height / 2
self.zoom_x = zoom
self.zoom_y = zoom
end
def wait_for_timer
@finished = true if @timer <= 0
@timer -= 1
end
def finished?
@finished
end
end # Sprite_Splosion < Sprite
#-------------------------------------------------------------------------------
# POWERUP SPRITES
#-------------------------------------------------------------------------------
class Sprite_Powerup < Sprite
attr_reader :type
def initialize(viewport,id,type)
super(viewport)
@id = id
@type = type # 0 heal 1 lazor 2 lazerball 3 nuke 999 reset
@speed = rand(1) + 1
setup_image(type)
init_position
end
def init_position
self.x = rand(Graphics.width)
self.y = -10
end
def dispose
super
end
def update
super
update_move
end
def update_move
self.y += @speed
end
def setup_image(type)
self.bitmap = Cache.space("powerup" + type.to_s)
self.ox = bitmap.width / 2
self.oy = bitmap.height / 2
end
def width
self.bitmap.width
end
def height
self.bitmap.height
end
end # Sprite_Powerup < Sprite
#-------------------------------------------------------------------------------
# SCORE WINDOW
#-------------------------------------------------------------------------------
class Window_InvaderScore < Window_Base
def initialize
super(0, 0, Graphics.width, Graphics.height)
self.opacity = 0
refresh
end
def refresh(shields = Galv_SI::PLAYER_SHIELDS.to_f,bonus_shields = 0)
contents.clear
draw_score("Score: ", score, 4, 0, contents.width - 8, 2)
draw_score("Best: ", high_score, -(Graphics.width / 2) + 70, 0, contents.width - 8, 2)
draw_shields(shields, 4, 0)
draw_bonus_shields(bonus_shields)
end
def draw_shields(shields, x, y, width = Graphics.width / 4)
draw_gauge(x, y, width, shields / Galv_SI::PLAYER_SHIELDS.to_f, text_color(1),
text_color(4))
end
def draw_bonus_shields(x,width = Graphics.width / 4)
w = width * x / Galv_SI::PLAYER_SHIELDS.to_f
rect = Rect.new(4, 0, w, 12)
contents.fill_rect(rect, text_color(1))
end
def score
$game_variables[Galv_SI::SCORE_VAR]
end
def high_score
$game_variables[Galv_SI::HIGH_SCORE_VAR]
end
def draw_score(value, unit, x, y, width, align)
cx = text_size(unit).width
draw_text(x, y, width - cx - 2, line_height, value, align)
draw_text(x, y, width, line_height, unit, align)
end
def open
refresh
super
end
end # Window_InvaderScore < Window_Base
I really like your scripts Galv! I really like your job, I hope to see and use more of your work, thank you very much!
Wow Wow Wow. This is great. I have one thought though. Can I run this mini game as two games with different enemies and damage, etc.? Using 2 different scripts and folders for graphics? I.E. (Select one trigger and the invaders game opens, select another and you have a different ship fighting different looking aliens.)
If you know ruby you could easily do that without needing to duplicate the script. Sorry, it’s not something I’m interested in doing, though :)
This looks beautiful.
I downloaded the demo but was unable to find the graphics, am I missing something? >_>
I believe you are. Look in the /Graphics/ folder for an /Invaders/ folder
I don’t have too.
Galv! Is there anyway to make enemies animated just like the player? I mean, using the same sheet as the “player” instead of 1 simple image?
Sorry this one isn’t very customizable
This is so cool! But I want to use the high score to give my player bonus. Any idea about how to get this work? Sorry for my bad english. :)
It stores the player’s score in a variable. You can use that variable in condition branches.
where can I find the demo
There’s a link at the very top of this page
This script is really cool and perfect for what I plan to use it for, but I have a question.
How hard would it be to make it so that on pressing ESC the game would pause and ask the player if he wants to quit? I understand if you don’t want to do this, but if it’s really easy I could theoretically try to do it myself…
That would be a great feature but unfortunately I am not doing requests. Knowing ruby and how rpgmaker works it wouldn’t be too hard, though.
Ok… To be honest, I have almost zero experience with scripting (aside from doing some really minor edits to existing scripts).
Thus far the best that I’ve managed to do is to get a menu with choices “Resume” or “Quit” appear on pressing ESC (as a scene call), but upon returning to the minigame scene it just restarts instead of continuing.
The main problem as I see it is with getting the minigame to pause while keeping the progress made.
Can you maybe give me a hint or should I go ask for help at the forums instead?
Please ask in the forums, sorry I don’t have time to personally help everyone here that asks :(
Is it ok if I post a link to the thread on the forums here or something in case someone else needs this?
I would rather you didn’t as it will be something I will add to the script at a later date, but yes you can.
Um… In this case, I’ll post the link here and you can delete it once you’ve updated the script and it’s no longer needed, ok?
http://www.rpgmakervxace.net/topic/24773-galv%E2%80%99s-invader-mini-game-add-exit-menu/ (working solution in post #3)
I’m sorry if I’m violating some unwritten ethiquette, as I’m still very new to all this. It’s just that I would have liked to have an answer available if I had a question like this and the answer was already found by someone else…
And again, thanks for the amazing script! Keep up the good work! :)
No worries, good idea. Thanks
Amazing script. But I have a question. Can this script go back to the game map when I reach a determined number of points in the mini game?
That’s not currently a setting. Unfortunately I don’t have time to do requests. I recommend asking in a forum as it’s likely an easy change.
ok thanks
Have you found the solution already?
I think I could help you, but I’m not sure if it’s ok to post code in the comments here
If it’s a small snippet you can post
No, I haven’t found it :(
If you can help me, thanks a lot.
Between lines 254 and 255 of the script add this code:
if $game_variables[Galv_SI::SCORE_VAR] == 100
SceneManager.goto(Scene_Map)
end
It will just return you to the map upon reaching 100 points.
You can replace 100 with any number of points you want the minigame to stop at.
If you want anything fancier it might be a better idea to ask on forums, like this one: http://www.rpgmakervxace.net/ (“RMVX Ace (RGSS3)” subforum)
Amazing! That will be useful for my game. Thanks!
Hey,i downloaded the demo1.1,and putit into the folder ->invaders but it still says graphic
backdrop is missing
Sounds like you are putting it in the wrong place. Look in the demo to see which folder it is in and then match that with the same folder located in your project.
hmm all done i would say,still the backdrop is missing,hmmmmm mistery
ok ive found the solution;)
what’s the solution? please help!
well to be honest i dont understand how to create bonuses for reaching a score.what do u mean by variables?
i dont know what i could do with a variable
Unfortunately I don’t have time to teach variables. They are one of the basics of rpgmaker so I recommend looking up tutorials.
How do I make a new enemy? I tried to put HP and their sprite and all but they never spawn, even when I set it to super low?
It wasn’t written to be able to add new enemies unfortunately.
So there’s no way to add new enemies? Like at all? I mean, if you tell me what lines would include the behavior or whatever, I think I can do the rest, I just thought of adding a 4th enemy or so would give more diversity.
Sure, you can add them via script but unfortunately I don’t have time at the moment to look at what would need to be changed.
Do you want me to pay you? Because I can give you a bit to help me out, this would be so perfect for my game and I’d just want one more enemy in. I don’t think that’s all that outrageous request, right?
It’s not an outrageous request, I just get a lot of requests to make small changes for free that they all start adding up and I usually have to decline. I will do it for you for a donation if you are willing – it would really help my situation out, too. I’ll take a look and make the change for you when I can.
Sure, I need to pay for your fishing script anyway, so how about when I pay it, I add a 5$ humble donation tip for this? Is that fair or do you need more?
Any donation amount is appreciated – thank you :) Will get on this as soon as I can
This was used and edited on the very famous Five Nights at F***boys on Mangle’s Esoteric Quest.
I had to check this out and it was awesome!
Oh and FNAFB is a very famous game on GameJolt!The amount of ppl who play it..
um my game is saying that line 66 wont work
Here’s a list of things to try and error trap:
is there a way we can move upwards and downwards as well? ;w;
Sorry, not in the Ace version. The MV version you can, though.
Whenever i use it, it says unable to find System/Graphics/Backdrop
can anyone help?
You need graphics for this plugin. You can grab them from the demo.
I know, i have all of it in my system folder, but it still says it
Your error message you say is looking for System/Graphics/Backdrop ?
Looks like you need to put them in YourProjectName/Graphics/Invaders
If you put them there, something else is happening that you’ll have to work out. Here’s some tips for error trapping: