Legacy GM Pixel-perfect collision for platformer problem

B

BulletHell1

Guest
Hi, I'm having an issue with precise collision in my platform game when my player collides with a spike when falling from a jump. I have made it so the character is destroyed upon collision however the character currently collides way too early before actual contact (around here: https://imgur.com/a/ebFzu)

Other collisions (horizontal and collision with an object above) seem to work fine, but falling collision has this issue. I have attempted to edit the ''precise'' settings in the sprite editor but this did not fix the problem. Is there a way to make it so the collision is precise?

Here's my code:

Variables:

grav = 1;

spd = 8;

jspd = 12;

hspd = 0;

vspd = 0;

airjump = 1;

My platform physics can be found here: http://pastebin.com/h6RqwdE0

And my collision code, upon contact with the spike:

///Destroy object

instance_destroy();



I'm trying to create a game similar to IWBTG with really precise jumps, but having tried things like altering the masks for both the player and the spike objects (currently mask shapes are set to precise) I am still struggling to get the desired effect. Could anyone help me?
 
D

Diveyoc

Guest
Go into your player and spike sprites and check your collision masks. If I'm not mistaken, you could probably just shrink down the size of your spike sprite collision mask so that the player has to fall further to trigger the collision.

Edit: I see you were messing with precise collision mask. Maybe select manual and adjust it so the mask only covers the bottom half of the spike, if you haven't tried something like that already.
 
P

PlayTestedGames

Guest
Your code looks good. If the suggestion by Diveyoc doesn't work, may be just debug the collision by printing the vertical distance (height) of the player from the top of the spike whenever collision occurs. If it is <=10 pixels, it is as per your plan. Else, just post the details here and we'll c.
 
Top