forked from alesan99/mari0_ae
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmariotail.lua
More file actions
150 lines (138 loc) · 3.16 KB
/
mariotail.lua
File metadata and controls
150 lines (138 loc) · 3.16 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
mariotail = class:new()
function mariotail:init(x, y, dir, v)
--PHYSICS STUFF
self.x = v.x-10/16
self.y = y+10/16
self.speedy = 0
self.speedx = 0
self.width = 2
self.height = 8/16
if v and v.size == 10 then
self.height = 1
self.y = self.y - 8/16
end
self.active = true
self.static = false
self.category = 13
self.mask = { true,
false, true, false, false, true,
false, true, false, true, false,
false, true, false, true, false,
true, true, false, false, false,
false, true, false, false, true,
false, false, false, false, true,
false, true}
self.destroy = false
self.destroysoon = false
self.playhitsound = true
self.timer = 0
self.gravity = 0
self.rotation = 0 --for portals
self.player = v
end
function mariotail:update(dt)
self.timer = self.timer + dt
if self.timer > raccoonspintime then
self.destroy = true
end
self.x = self.player.x-10/16
self.y = self.player.y+10/16
if self.player.size == 10 then
self.y = self.y - 8/16
end
if self.destroy or (self.playhitsound == false) or self.player.ducking then
return true
else
return false
end
end
function mariotail:leftcollide(a, b)
self:hitstuff(a, b)
return false
end
function mariotail:rightcollide(a, b)
self:hitstuff(a, b)
return false
end
function mariotail:floorcollide(a, b)
self:hitstuff(a, b)
return false
end
function mariotail:ceilcollide(a, b)
self:hitstuff(a, b)
return false
end
function mariotail:passivecollide(a, b)
self:hitstuff(a, b)
return false
end
function mariotail:hitstuff(a, b)
if a == "tile" then
if self.playhitsound then
playsound(blockhitsound)
self.playhitsound = false
end
local x, y = b.cox, b.coy
hitblock(x, y, {size=2})
elseif a == "tilemoving" then
if self.playhitsound then
playsound(blockhitsound)
self.playhitsound = false
end
b:hit("mariotail", self)
elseif mariotailkill[a] then
local dir = "right"
if b.x+b.width/2 < self.x+self.width/2 then
dir = "left"
end
if b.flipshell then
--flip koopa shells
playsound(shotsound)
if not b.small then
addpoints(100, b.x+b.width/2, b.y)
end
b:flipshell(dir)
self.destroy = true
else
--kill normally
b:shotted(dir)
if a ~= "bowser" then
addpoints(firepoints[a], self.x, self.y)
end
if a == "koopaling" then
self.destroy = true
end
end
if dir == "right" then
makepoof(self.x+self.width, self.y+self.height/2, "pow")
else
makepoof(self.x, self.y+self.height/2, "pow")
end
elseif a == "enemy" then
local dir = "right"
if b.x+b.width/2 < self.x+self.width/2 then
dir = "left"
end
if b.shellanimal then
--flip koopa shells
if not b.small then
addpoints(100, b.x+b.width/2, b.y)
end
b:shotted(dir, true)
self.destroy = true
if dir == "right" then
makepoof(self.x+self.width, self.y+self.height/2, "pow")
else
makepoof(self.x, self.y+self.height/2, "pow")
end
elseif b:shotted(dir, false, false, true) ~= false then
--kill normally
addpoints(b.firepoints or 200, self.x, self.y)
if dir == "right" then
makepoof(self.x+self.width, self.y+self.height/2, "pow")
else
makepoof(self.x, self.y+self.height/2, "pow")
end
end
end
end