M
MrAmsel
Guest
So I've been working on a simple 2-player fighting game and I ran into an interesting bug when trying to detect the players hitting each other. Currently I have each player create a hitbox object when they press the attack button and then I have each player object check to see if they collide with that hitbox object in the step event, if they do collide they lose heath.
The problem is my player 2 object is able to detect the collision, and therefore lose heath, but my player 1 object is not able to detect the collision even though the code is identical for each player.
I ran some test to see what might be causing the issue and I found something really weird. I am able to detect the collision of the hitbox generated by either player object on a third object, and so I started to think maybe the issue was with how the objects were being loaded into the room. So I moved my player 2 object above my player 1 object in my object library and the problem was revered. So I am guessing there is something I don't quite understand with how objects are loaded into a room and how that effects possible collision checks. Can somebody help point me in the direction on how to make sure the objects can collide properly?
Also I tired checking for collision using place_meeting and position_meeting with the same result in both instances.
The problem is my player 2 object is able to detect the collision, and therefore lose heath, but my player 1 object is not able to detect the collision even though the code is identical for each player.
I ran some test to see what might be causing the issue and I found something really weird. I am able to detect the collision of the hitbox generated by either player object on a third object, and so I started to think maybe the issue was with how the objects were being loaded into the room. So I moved my player 2 object above my player 1 object in my object library and the problem was revered. So I am guessing there is something I don't quite understand with how objects are loaded into a room and how that effects possible collision checks. Can somebody help point me in the direction on how to make sure the objects can collide properly?
Also I tired checking for collision using place_meeting and position_meeting with the same result in both instances.