An obstacle file is a LUA script, that defines the obstacle shape and how it operates. Obstacles are spawned using segment files, although you can use mgObstacle() to spawn them in room files.
init() - Runs only once, when the obstacle is spawned.
Setting up obstacle parameters (similar to room parameters)
Creating physics bodies
tick() - Runs every frame.
Body manipulation (movement, rotation, etc.)
if mgBodyIsBroken(body) then mgClear() end - Clears the obstacle after breaking it (in crystals, it saves the streak). Usually present in a similar form to this code.
draw() - Optional function. Only used for drawing body decals.