Balloon: Difference between revisions

From CC Wiki
Jump to navigationJump to search
(balloon page! but im not sure how long it takes for them to respawn)
(No difference)

Revision as of 01:35, 7 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 a pre-determined time.

A balloon in the '600m' level of Celeste Classic

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
}