forked from Mari0-CE/Mari0-Community-Edition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fire.lua
95 lines (79 loc) · 1.88 KB
/
fire.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
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
fire = class("fire")
function fire:init(x, y)
--PHYSICS STUFF
if objects["bowser"][1] then --make bowser fire this
self.y = objects["bowser"][1].y+0.25
self.x = objects["bowser"][1].x-0.750
--get goal Y
self.targety = objects["bowser"][1].starty-math.random(3)+2/16
else
self.y = y-1+1/16
self.targety = self.y
self.x = x+6/16
end
self.speedy = 0
self.speedx = -firespeed
self.width = 24/16
self.height = 8/16
self.active = true
self.static = true
self.autodelete = true
self.gravity = 0
self.category = 17
self.mask = { true,
true, false, true, true, true,
true, true, true, true, true,
true, true, true, true, true,
true, true, true, true, true,
true, true, true, true, true,
true, true, true, true, true}
--IMAGE STUFF
self.drawable = true
self.graphic = fireimg
self.quad = firequad[1]
self.offsetX = 0
self.offsetY = 8
self.quadcenterX = 0
self.quadcenterY = 0
self.rotation = 0 --for portals
self.timer = 0
self.quadi = 1
playsound("fire")
end
function fire:update(dt)
--animate
self.timer = self.timer + dt
while self.timer > fireanimationdelay do
if self.quadi == 2 then
self.quadi = 1
else
self.quadi = 2
end
self.quad = firequad[self.quadi]
self.timer = self.timer - fireanimationdelay
end
self.x = self.x + self.speedx*dt
if self.y > self.targety then
self.y = self.y - fireverspeed*dt
if self.y < self.targety then
self.y = self.targety
end
elseif self.y < self.targety then
self.y = self.y + fireverspeed*dt
if self.y > self.targety then
self.y = self.targety
end
end
end
function fire:leftcollide(a, b)
return false
end
function fire:rightcollide(a, b)
return false
end
function fire:floorcollide(a, b)
return false
end
function fire:ceilcollide(a, b)
return false
end