• Hey! Guest! The 37th GMC Jam will take place between May 28th, 12:00 UTC and June 1st, 12:00 UTC. Why not join in! Click here to find out more!

GMS 2 Basic Collision

I am very, very new to GMS in general. I've completed the My First Game - Code Tutorial and now I am diving into DnD. I wanted to experiment a bit on my own so I can find my (massive) short comings and, thus, see what GMS2 concepts I need to nail down. Thus far, I had no issue getting my player instance to move about using the standard WASD keys. Yay, me!

Now I've placed an instance from obj_wall with the intent of making the player instance stop moving when it collides with the wall instance. So far, I am failing at this simple task. Boo, me.

With the player object (obj_player) selected and open in the work space, I go to Add Event and select Collision>obj_wall. But now I don't know what DnD object to drag into the Code area to cause the player instance to stop when a collision is detected between the wall and player.

Any help here would be appreciated.

As a side note: both spr_player and spr_wall have basic rectangular collision masks set with collision set to middle center. Also, I did drop in a Restart Room (when I couldn't get anything else to work) and that works. So, it appears GMS2 is detecting when the player instance collides with the wall instance. I just don't know what to drag into the code area to cause the player instance to just stop.

Sorry for being so dense with this.
 
That's how it's done in GMS1, but there is no option to select the middle area for Set Direction Fixed in GMS2. In any case, this was the first thing I did (dropped in Set Direction Fixed) and selected nothing (thinking that would be the same as selecting the middle), but this does not stop the player instance from passing through the wall instance.
 
This was (originally) posted in the GameMaker Studio 2 forum area because it concerns DnD in GMS2, not GMS1. I have this working in GMS1 quite fine and was trying to duplicate this in GMS2, which is where I am having the failure.
 
Top