The remainder of this chapter will be a small tutorial on how to incorporate physics into a top-down style game, like our first one. We're just going to create a small engine to demonstrate how you would move around a player and get perfect collisions.
So first create a simple player sprite and wall sprite. They can be simple squares or complex shapes if you want. Make sure that you center the origins—it's important for the collisions to work properly.
Now create a player and wall object. Give the wall its sprite, a density of 0
, and a collision shape. If you made the sprite complex (although walls are usually blocky), then select the Shape option and plot a series of points to get a collision shape that matches the wall and then open up the player object. Give the player its sprite and a collision shape. If the player's sprite is complex, then use the Shape option.
Now let's make the player move and stop at the wall. Add a Create event, and set phy_fixed_rotation...