Skip to content

Commit

Permalink
Got a wave A WAVE
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Robinson committed Jan 15, 2012
1 parent ba50e97 commit f2abe1e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 6 additions & 4 deletions bad.lua
Expand Up @@ -2,13 +2,15 @@ require 'rail'

Bad = {}

function Bad:new(x, y)
function Bad:new(rail)
local r = rail or SamRail:new(0, 0)

return setmetatable({
x = x,
y = y,
x = r.x,
y = r.y,
dead = false,
size = 15,
rail = SamRail:new(x, y),
rail = r,
shots = {}
}, {__index = self})
end
Expand Down
6 changes: 4 additions & 2 deletions main.lua
Expand Up @@ -2,6 +2,7 @@ require 'bad'
require 'boom'
require 'bullet'
require 'ship'
require 'wave'

joystick = {
n = 0,
Expand Down Expand Up @@ -37,8 +38,9 @@ function love.load(arg)
ship = Ship:new(400, 300, joystick)
table.insert(ships, ship)

for i = 1, 100, 1 do
table.insert(baddies, Bad:new(math.random() * 700 + 25, math.random() * 100))
local w = Wave:new()
for _, b in ipairs(w:spawn()) do
table.insert(baddies, b)
end
end

Expand Down

0 comments on commit f2abe1e

Please sign in to comment.