-
Notifications
You must be signed in to change notification settings - Fork 0
/
entities.lua
56 lines (48 loc) · 1.13 KB
/
entities.lua
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
EntTypes =
{
Enemy,
Deployable,
Projectile
}
ActiveEntities = {}
ActiveBullets = {}
function DrawEntities()
for id, entity in pairs( ActiveEntities ) do
if ( entity.Base.Sprite ) then
Scale = {
x = 1,
y = 1
}
if ( entity.Base.Scale ) then
Scale = entity.Base.Scale
end
love.graphics.draw( entity.Base.Sprite, entity.Position.x, entity.Position.y, entity.Rotation, Scale.x, Scale.y )
end
end
end
function DrawBullets() -- bubbie's late night laziness
for id, entity in pairs( ActiveBullets ) do
if ( entity.Base.Sprite ) then
Scale = {
x = 1,
y = 1
}
if ( entity.Base.Scale ) then
Scale = entity.Base.Scale
end
love.graphics.draw( entity.Base.Sprite, entity.Position.x, entity.Position.y, entity.Rotation, Scale.x, Scale.y )
end
end
end
function EntityBehaviour()
for id, entity in pairs( ActiveEntities ) do
if entity.Base.Behaviour then
entity.Base.Behaviour( entity )
end
end
for id, entity in pairs( ActiveBullets ) do
if entity.Base.Behaviour then
entity.Base.Behaviour( entity )
end
end
end