![game maker studio 2 networking game maker studio 2 networking](https://tech-blog-assets.yoyogames.com/Customising_GMS2/Path_Prefs.png)
If you never use solid, place_free() never returns true.Īnyways, the way to get around this small roadblock is by using place_meeting(), as I did in the code above. This is a small price to pay, as I will demonstrate, but I want to get it out there now that place_free()/the above action only returns true when there’s a collision with a solid object. Note, if you use actions, place_free() is equivalent to this one: You can’t use the function place_free() when you aren’t using solid objects. One last thing that I feel I should mention. Notice we didn’t even have to use a collision event, at all.
![game maker studio 2 networking game maker studio 2 networking](https://techcrunch.com/wp-content/uploads/2016/01/screen-shot-2016-01-14-at-7-25-07-pm.png)
If ( place_meeting( x, y+ vspeed, objBlock1)) vspeed=0 If ( place_meeting( x+ hspeed, y, objBlock1)) hspeed=0 For a top-down maze game, you might use this code in the step event: in your collisions, without the omnipresent don’t-touch-the-wall-ever-mwahaha stuff. Take the more difficult path and collect the treasure at the end. If you turn solid off, all you have to do to keep a functional game is to program the collisions yourself. What if at one point you want the object to go through walls? No good with solid as long as there’s a collision event, the solid object will be un-passable. And it’s not really your fault (aside from using solid) because you didn’t tell GM to do this you just told GM to make the wall solid.Īctually, that is the very reason why you should get rid of it. However, if the object starts there or gets placed overlapping the solid object, suddenly, you can’t move at all. Well, if your object is moving and touches a solid object, it will be moved out of it. Now you may be wondering why I said, “hopefully” above. Same thing with the block if it happened to be moving and the player was stationary, the block still could not enter the player. So if you have non- solid objPlayer ,and solid objBlock, and you add a collision event in objPlayer for objBlock, then whenever objPlayer bumps into objBlock it will be kicked back to the last hopefully non-colliding position. When actions or code is placed in a collision event for a solid object, the two objects cannot overlap. So you want to know how solid really works? Well, it’s pretty simple actually. Why should you do this? Because of wizardry. Solid, in case you don’t already know, is controlled by the little checkbox in the object properties next to visible (you can, however, control it through code by using the variable solid) Go to one of your objects which is solid, double click it, find the solid checkbox, and uncheck it now. However, though many developers use it, they generally don’t know how it actually works and therefore may run into problems with it that they can’t solve. It’s common among many developers’ early games, and the reason is generally because it handles collision events for you decently well. I’ve decided to write an article about why you shouldn’t use the built-in Game Maker solid variable. I no longer answer questions about the Game Maker tutorials on this blog I suggest you take any questions to the Game Maker Community.