collision between two objects always stop both from moving, while there are no Actions to do so

So in my game, a bullet object should pass through enemy objects. it should flash (the bullet) when it passes thru an enemy. however, if i add a collision event between the bullet and an enemy object for either one, they both freeze in their place (stop moving). the collision event can contain anything: a sound plays, the enemy hp drops by 1, anything; it always produces the same result: both objects stop in place upon collision.

if i remove the collision event, it works and the bullet continues flying through, otherwise never, even if the collision event doesn't have an action to stop the objects, or anything related to speed for that matter.

bullet obj is not solid but enemy objects are solid.

enemy movement code looked clean to me:
GML:
near=instance_nearest(x,y,playerpar)
image_angle=point_direction(x,y,near.x,near.y)
mp_potential_step(near.x,near.y,spd,0)
theres nothing else relevant in the enemy movement code, only that it only moves after the player if a playerpar object exists, and if the playerpar is a certain distance from the enemy.
Does the code look ok? I even checked in the Scripts all the events in the game where these related two objects are named, and found nothing out of the ordinary.

are there any conditions where smth like this can happen?

Can it be a bug? I've noticed the game messing stuff up sometimes if I dont periodically clear the compile cache.

Anyhoo, I found a sort of workaround to this problem, but it bugs me, so i'll keep on scouring through all possible events, maybe there's smth that I missed.
 
A

AndreFS

Guest
The problem is "solid".
If the object is solid, it collides with any object that has an event collision with it.
To solve the problem, uncheck the option "solid" in obj


Hope this helps <3
 
The problem is "solid".
If the object is solid, it collides with any object that has an event collision with it.
To solve the problem, uncheck the option "solid" in obj


Hope this helps <3
right... I only figured it would collide if it had a collision event, like speed = 0, not if the collision did something irrelevant to stopping them...
However, I can't make the enemy object not solid, it has to stay like that, but theres always workarounds, gladly!
thanks a ton!
 
Btw, using the solid attribute is NOT generally recommended. This is precisely because of a situation like this, but also you completely lose control over how your instances are going to move when they come into collision. You can no longer position instances accurately when colliding, you can no longer move your instances to a different position after a collision has occurred, etc. It is much better to design the system so that you do not need to use solid.
 

Yal

šŸ§ *penguin noises*
GMC Elder
Since nobody pointed it out with the full details: if either instance in a collision is solid, any movement resulting in them colliding is undone. I'm pretty sure this happens before the collision event is handled, but after the step event (+automatic speed/hspeed/vspeed position updates) is run. This helps making platforms and stuff a bit easier, since it removes the need to move things out of overlap, but in return, it usually gets in your way if you're trying to do anything advanced (like, say, objects that can move through platforms in a particular direction), and it messes with basically all movement code.
 
Since nobody pointed it out with the full details: if either instance in a collision is solid, any movement resulting in them colliding is undone. I'm pretty sure this happens before the collision event is handled, but after the step event (+automatic speed/hspeed/vspeed position updates) is run. This helps making platforms and stuff a bit easier, since it removes the need to move things out of overlap, but in return, it usually gets in your way if you're trying to do anything advanced (like, say, objects that can move through platforms in a particular direction), and it messes with basically all movement code.
weird how I never realized this before, since I always have so many collision events and objects marked as solid in my games... in this case, I had absolutely nothing in the collision event and it startled me, like whats going on now. But ok, it all makes sense now. I found a workaround by using place_meeting().
 
Top