Learn
Creating and managing systems
If you want to add physics processing to your game, you can use gama built in physics.
Creating a system
You create a system using gm_system_create.
This creates a new structure of type gmSystem which you can configure,
for properties, you can see gm_system reference
And for more information about systems, you can view the system.h reference.
Creating bodies
A body is an entity in the system, it is like a physics body with it's own mass, shape and forces acting on it. Gama currently supports only two shapes of bodies, circles and rectangles, and provide differenc functions for creating objects of those different shapes:
Bodies have properties you can modify to change their behavious
mass: holds the mass of the body which is used in collisions, a body with a mass of zero is considered having infinite mass, and for example won't move during collisions but can still have a velocity.is_active: set this to zero and gama will completely ignore the body.is_static: marks the body as non-movingposition,velocity,acceleration: they are all structs of typegmPos, having.xand.y.- ...
You can view other properties in the gmbody reference.
Adding the bodies to the system
The last step is to add the bodies into the system, to do this, you are going
to pass a reference to you body object to the system.
you can use the gm_system_push and other gm_system_pushN functions where N
is the number of shapes you want to add less than six.
Updating the system
You can update the system with gm_system_update function.
Example
Getting collisions
When two bodies collide, gama creates a new gmcollision
object which holds information about the collision,
you can get and test for a collision with gm_collision_detect
