Spikes

From CC Wiki
Revision as of 16:22, 19 February 2026 by Lordsnek (talk | contribs) (Added basic summary, original code segment)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Spikes are obstacles in Celeste Classic that can kill Madeline when she touches them. Spikes are one of two ways the player can die in the base game, along with the bottom of the screen. There are four types of spikes that point in each of the cardinal directions. Spikes are typically placed next to a block so that their prongs face outward.

Original Code

function spikes_at(x,y,w,h,xspd,yspd)
 for i=max(0,flr(x/8)),min(15,(x+w-1)/8) do
 	for j=max(0,flr(y/8)),min(15,(y+h-1)/8) do
 	 local tile=tile_at(i,j)
 	 if tile==17 and ((y+h-1)%8>=6 or y+h==j*8+8) and yspd>=0 then
 	  return true
 	 elseif tile==27 and y%8<=2 and yspd<=0 then
 	  return true
 		elseif tile==43 and x%8<=2 and xspd<=0 then
 		 return true
 		elseif tile==59 and ((x+w-1)%8>=6 or x+w==i*8+8) and xspd>=0 then
 		 return true
 		end
 	end
 end
	return false
end