class HorizontalSwarm
Constants
- SWARM_COUNT
SPEED = 5 MAX_ATTACK_SPEED = 3.0 POINT_VALUE_BASE = 50 MISSILE_LAUNCHER_MIN_ANGLE = 255 MISSILE_LAUNCHER_MAX_ANGLE = 285 MISSILE_LAUNCHER_INIT_ANGLE = 270 attr_accessor :cooldown_wait, :attack_speed, :health, :armor, :x, :y
SWARM_COUNT
= 10
Public Class Methods
trigger_swarm(scale, screen_width, screen_height, y = nil, options = {})
click to toggle source
def get_image
Gosu::Image.new("#{MEDIA_DIRECTORY}/missile_boat_reverse.png")
end
# File line-em-up/models/horizontal_swarm.rb, line 18 def self.trigger_swarm(scale, screen_width, screen_height, y = nil, options = {}) # super(scale, x || rand(screen_width), y || 0, screen_width, screen_height, options) # @cooldown_wait = 0 # @attack_speed = 0.5 # @current_speed = (rand(5) * @scale).round + 1 swarm = [] x_padding = 40 * scale base_x_padding = 40 * scale y_padding = 40 * scale y = y || rand(screen_height / 3) + screen_height / 8 if rand(2) == 0 x_direction = 1 else x_direction = -1 end (0..(SWARM_COUNT - 1)).each do |i| if i.even? new_y = y else new_y = y - y_padding end if x_direction > 0 new_x = 0 - x_padding else new_x = screen_width + x_padding end x_padding = x_padding + base_x_padding swarm << Mite.new(scale, new_x, new_y, screen_width, screen_height, x_direction, options) end return swarm end