Crystals are normal obstacles with a few key differences in their code, that make them glow and give balls upon breaking.
Crystal obstacles have some specific functions that differentiate them from normal obstacles. Characteristic differences include:
init() - mgGlow() and mgScore()
mgScore(3, 0, 0.6, 0.1)
mgGlow(0, 0.4, -.2)
tick() - In case the crystal is supposed to move, mgGlow() and mgScore() are set depending on the position of the obstacle body
local x,y,z = mgGetPos(body)
mgScore(3, x, y+0.6, z+0.1)
mgGlow(x, y+0.4, z+0.2)
Function definitions:
mgScore(b,x,y,z) - Spawns the crystal particle (blue circle with a number) at x, y, z. Makes the crystal give b balls upon breaking.
mgGlow(x,y,z) - Spawns a glow effect at x, y, z.