Balloon: Difference between revisions
From CC Wiki
Jump to navigationJump to search
m (Add ballon respawn time) |
m (Added this page to the mechanics category) |
||
| Line 42: | Line 42: | ||
</pre> | </pre> | ||
[[Category:Mechanics]] | |||
Latest revision as of 04:34, 23 January 2024
Balloons are floating objects that restore your dash when Madeline collides with them. They float in the air and bob up and down slightly. When collected, they respawn after 60 frames (2 seconds).

Original Code
balloon = {
tile=22,
init=function(this)
this.offset=rnd(1)
this.start=this.y
this.timer=0
this.hitbox={x=-1,y=-1,w=10,h=10}
end,
update=function(this)
if this.spr==22 then
this.offset+=0.01
this.y=this.start+sin(this.offset)*2
local hit = this.collide(player,0,0)
if hit~=nil and hit.djump<max_djump then
psfx(6)
init_object(smoke,this.x,this.y)
hit.djump=max_djump
this.spr=0
this.timer=60
end
elseif this.timer>0 then
this.timer-=1
else
psfx(7)
init_object(smoke,this.x,this.y)
this.spr=22
end
end,
draw=function(this)
if this.spr==22 then
spr(13+(this.offset*8)%3,this.x,this.y+6)
spr(this.spr,this.x,this.y)
end
end
}