RyanC
Member
Hi everyone, I've been having trouble with a collision code for weeks and was wondering if I could get some help with it?
The problem is that the player dies too easily.
I only want the player to die if it hits a block in front but it dies even when getting shot into the floor or ceiling.
The problem is that the player dies too easily.
I only want the player to die if it hits a block in front but it dies even when getting shot into the floor or ceiling.
Code:
if place_meeting(x,y+sign(gravity),other)
{
var v_direction = point_direction(x,yprevious,x,y);
y = yprevious
move_contact_all(v_direction,-1)
vspeed = 0
landed = true
if place_meeting(x,y+(-gravity*8),other)
{
x = xprevious
if Hspeed2 >= 0
{
if ! instance_exists(obj_die)
{
instance_create(x,y,obj_die)
}
}
else
{
Hspeed2 = game_speed*0.5
}
}
}