Hey! We're back again with another series of remastered GMS2 tech blogs.
This 4 part series covers Physics! Check it out:
This 4 part series covers Physics! Check it out:
https://www.yoyogames.com/blog/69/physics-in-gamemaker-studio-2-part-1Today's tech blog takes form of a mini-tutorial, where we will be making a small physics simulation and at the same time we'll discuss some of the issues that people come up against when transitioning from the "traditional" GameMaker Studio 2 approach to movement and collisions to the physics approach.
INTRODUCTION
Even the most advanced users can be confused when using GameMaker Studio 2 physics for the first time, so we'll start this tutorial with probably the most important piece of advice we can give... Forget everything you know about how GameMaker Studio 2 deals with collisions and movement! Why? Well, when you enable physics in a room, you are changing how everything will interact at a very basic level within GameMaker, and this makes the built in variables like speed and direction obsolete. However, it does enable a whole bunch of specific physics variables which can be used instead.
The other major change that happens when you enable physics is that collisions will be handled automatically for you. With "traditional" GameMaker collisions you would have a Collision Event and then have some code or action in there to deal with what happens, but - with the physics enabled - the collisions will be resolved by GameMaker automatically, with bounce angles and velocities etc... being calculated and applied for you.
So, with that warning out of the way, lets move on and get started making a simple physics simulation... You'll need to make a new GML project in GameMaker Studio 2 and open the Room Editor before continuing.