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 also 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. Usually present in a similar form to this code.
draw() - Optional function. Only used for drawing body decals (for example, drawing boss decals).