GML [SOLVED] How to make an object not stop after a collision.

ForesterPL

Member
Hi.
I have got two objects. Both are solid. Object 1 has got collision event. In collision event object 1 checks object's 2 speed. Object 2 stops after a collision. I want to make object 2 to not stop after collision with object 1.
How to do that?
 
Last edited:

MishMash

Member
You wouldn't believe how many years I went without understanding what solid did. The rather poor inconsistency is that solid actually moves a colliding instance back to the position it was in before the collision happened (when colliding via collision event). However, this often conflicts with what people WANT to use solid for which is functions like place_free(x, y), which arbitrarily check for collisions, but only against solid objects.

As a general note, the best practice you can use with any collisions in your game is to change it up so that you check if a location is free, say using place_meeting against a specific instance, and only move the character if that location is free, rather than trying to undo collisions. (This will also allow you to add smooth collisions by testing locations at slight off angles). In my opinion, the collision event should not be used for anything that objectively stops collision (like solid walls or floors), it should only be used for the sort of collisions that you want to detect, but dont stop motion, e.g. pickups, walking over spikes, interactions with things like pushable objects, collisions with enemies, etc;
 
Top