-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwave.lua
More file actions
103 lines (86 loc) · 2.83 KB
/
wave.lua
File metadata and controls
103 lines (86 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
push = require "push"
Class = require 'Class'
gameover = false
wave = Class{}
function wave:init(level)
self.level = level
if level == 1 then
self.aliensfireing = {
alienattack(200,400),
alienattack(300,400),
alienattack(400,400),
alienattack(500,400),
alienattack(600,400),
alienattack(700,400),
alienattack(800,400),
alienattack(900,400),
alienattack(1000,400),
alienattack(1100,400)
}
self.aliens = {
alien(200,300),
alien(300,300),
alien(400,300),
alien(500,300),
alien(600,300),
alien(700,300),
alien(800,300),
alien(900,300),
alien(1000,300),
alien(1100,300)
}
self.bosses = {
boss(700,200,1000)
}
self.remaining = 21
end
end
function wave:render()
if gameover == true then
love.graphics.printf('Game Over!',0,100,1280,'center')
elseif gameover == false then
for count = 1, table.getn(self.aliensfireing) do
self.aliensfireing[count]:render()
for count2 = 1, table.getn(user.lasers) do
if self.aliensfireing[count]:check(user.lasers[count2]) == true then
points = points + 100
self.remaining = self.remaining - 1
print(self.remaining)
user.lasers[count2].hit = true
end
end
end
for count = 1, table.getn(self.aliens) do
self.aliens[count]:render()
for count2 = 1, table.getn(user.lasers) do
if self.aliens[count]:check(user.lasers[count2]) == true then
points = points + 100
self.remaining = self.remaining - 1
print(self.remaining)
user.lasers[count2].hit = true
end
end
end
user:check()
for count = 1, table.getn(self.bosses) do
self.bosses[count]:render()
for count2 = 1, table.getn(user.lasers) do
if self.bosses[count]:check(user.lasers[count2]) == true then
points = points + 1000
self.remaining = self.remaining - 1
user.lasers[count2].hit = true
elseif self.bosses[count]:check(user.lasers[count2]) == "hitw/hp" then
user.lasers[count2].hit = true
end
end
end
end
end
function wave:check()
if self.remaining == 0 then
love.graphics.setFont(love.graphics.newFont('Press-Start-2P.ttf', 30))
love.graphics.printf('You Win!',0,15,1280,'center')
else
return
end
end