Skip to content

Commit f04dc00

Browse files
committed
Frozen enemies can collect collectables
Fix running into koopas when flipping with racoon tail
1 parent 4a42275 commit f04dc00

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

ice.lua

+16
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,23 @@ function ice:update(dt)
7373

7474
if math.abs(self.speedx) < 1 then
7575
self.timer = self.timer + dt
76+
else
77+
--collect collectables if moving
78+
local x = math.floor(self.x+self.width/2)+1
79+
local y = math.floor(self.y+self.height)+1
80+
if ismaptile(x, y) then
81+
if objects["collectable"][tilemap(x, y)] then
82+
getcollectable(x, y)
83+
end
84+
end
85+
local y = math.floor(self.y+self.height/2)+1
86+
if ismaptile(x, y) then
87+
if objects["collectable"][tilemap(x, y)] then
88+
getcollectable(x, y)
89+
end
90+
end
7691
end
92+
7793
if self.static and (not self.dontfallafterfreeze) then
7894
--start falling if static
7995
if self.timer > iceblockairtime then

mariotail.lua

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ function mariotail:init(x, y, dir, v)
99
self.width = 2
1010
self.height = 8/16
1111
if v and v.size == 10 then
12+
--should be cape instead
1213
self.height = 1
1314
self.y = self.y - 8/16
1415
end
@@ -116,6 +117,9 @@ function mariotail:hitstuff(a, b)
116117
end
117118
b:flipshell(dir)
118119
self.destroy = true
120+
if (dir == "right" and self.player.speedx >= 0) or (dir == "left" and self.player.speedx <= 0) then
121+
b.speedx = b.speedx + self.player.speedx
122+
end
119123
else
120124
--kill normally
121125
b:shotted(dir)
@@ -148,6 +152,9 @@ function mariotail:hitstuff(a, b)
148152
else
149153
makepoof(self.x, self.y+self.height/2, "pow")
150154
end
155+
if (dir == "right" and self.player.speedx >= 0) or (dir == "left" and self.player.speedx <= 0) then
156+
b.speedx = b.speedx + self.player.speedx
157+
end
151158
elseif b:shotted(dir, false, false, true) ~= false then
152159
--kill normally
153160
addpoints(b.firepoints or 200, self.x, self.y)

0 commit comments

Comments
 (0)