Physics Functions

GameMaker: Studio has extensive, yet easy to use, physics functions based on the Box2D and Liquid Fun open source physics libraries.

The integration of a dedicated physics library to GameMaker: Studio means that you can now take control over all aspects of the physical behaviour of objects within your game world, particularly collisions and object interaction. The "traditional" collision system (which GameMaker: Studio defaults to) is a "reactive" system, where you check for a collision and then react to that collision with code that you place in individual objects. This is fine for simple games, but when you have a large number of objects and have to code how they all react to different situations in the game world, it quickly becomes obvious that this system is just not enough! That's when you have to turn to the GameMaker: Studio physics system!

The physics system works in a very different way to normal collisions. It is more of a "passive" system where you define a series of properties for your objects in the game world, as well as the properties of the game world itself, before any collisions or interactions occur. These coded "rules" will then govern the way everything in your game world interacts. In this way, with a few simple code and the correct room setup, you can create very complex interactions between objects and the world which will occur and resolve without you having to code for every single possible outcome.

There are a few things that you should note when working with the GameMaker: Studio physics world:

Information on the physics functions can be found on the following pages:

  1. The Physics World
  2. Forces
  3. Fixtures
  4. Joints
  5. Soft Body Particles
  6. Physics Variables

Finally, there are a couple of special physics functions which may be useful for more advanced physics simulations. The first is for testing for possible collisions at a specific point in the room, and the second is for generating custom mass and inertia properties within an instance:

  1. physics_test_overlap
  2. physics_mass_properties

Back: Reference
© Copyright YoYo Games Ltd. 2015 All Rights Reserved