…and I am a material g-
Oops, wait a minute! This is supposed to be a physics lesson, not a karaoke contest! 😛
The concept of Material in the Newton physics engine is an important one. In fact, it drives the behavior of all collisions in the system. So of course Marble Maze puts materials to good use. A material is simply an assignment of common properties that can affect the behavior of objects which make contact with it..
Everything in the game is assigned a material. The level terrain itself can be made up of several materials such as Walls, Ice, and Bouncey tiles. I set up the configuration for a material (Ice provides very little friction when contacted by a player marble), and just let the system take care of itself. It really maximizes the effort:results ration when programming physics behavior.
Material checks will also let me know when a marble touches a widget, since all widgets have a “widget material”. It may bounce a marble like a Wall material would, but I hook into this to notify the game engine when a player has made contact with any widget. For instance, a Catapult will fire the arm 4 seconds after the player made contact with it.