O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a moving platform

We've now seen both static and dynamic physics objects in GameMaker, but what happens when we want the best of both worlds? Let's take a look at how to create a platform that can move and affect other objects via collisions but is immune to said collisions.

Getting ready

Again, we'll be using our existing physics environment, but this time, we'll need a new object. Create a sprite that is 128 px wide by 32 px high and assign it to an object called obj_platform. Also, create another object called obj_kinematicParent but don't give it a sprite. Add collision events to obj_staticParent, obj_dynamicParent, and itself. Make sure that there is a comment in each event.

How to do it

  1. In obj_platform, add a Create event.
  2. Drag a code ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required