Key: Difference between revisions

From CC Wiki
Jump to navigationJump to search
(Created a bare minimum page)
 
No edit summary
 
Line 1: Line 1:
keys are collectibles that open [[Small chest|small chests]].
keys are collectibles that open [[Small chest|small chests]].
== original code ==
<pre>
key={
tile=8,
if_not_fruit=true,
update=function(this)
local was=flr(this.spr)
this.spr=9+(sin(frames/30)+0.5)*1
local is=flr(this.spr)
if is==10 and is!=was then
this.flip.x=not this.flip.x
end
if this.check(player,0,0) then
sfx(23)
sfx_timer=10
destroy_object(this)
has_key=true
end
end
}
</pre>
[[Category:Mechanics]]

Latest revision as of 20:47, 10 February 2026

keys are collectibles that open small chests.

original code

key={
	tile=8,
	if_not_fruit=true,
	update=function(this)
		local was=flr(this.spr)
		this.spr=9+(sin(frames/30)+0.5)*1
		local is=flr(this.spr)
		if is==10 and is!=was then
			this.flip.x=not this.flip.x
		end
		if this.check(player,0,0) then
			sfx(23)
			sfx_timer=10
			destroy_object(this)
			has_key=true
		end
	end
}