N
nlolotte
Guest
Hi guys,
I've recently built push able solids into my platformer engine. They work some what well but my only problem is if the solids are stacked on top of each other and you push left, it will move the below push solid as well dragging the character and not letting the top solid fall down. This doesn't happen when you do the same thing pushing right though?
Here is my code:
obj_player step event
Some images for reference
Pushing from left (bottom block moves too):
Pushing from right (works fine)
I've recently built push able solids into my platformer engine. They work some what well but my only problem is if the solids are stacked on top of each other and you push left, it will move the below push solid as well dragging the character and not letting the top solid fall down. This doesn't happen when you do the same thing pushing right though?
Here is my code:
obj_player step event
Code:
//Push
if (place_meeting(x-2,y,obj_solid_push)) && (lkey) && place_meeting(x,y+1,obj_solid)
{
anim = "push";
i = instance_nearest(x-2,y,obj_solid_push);
with i
{
if !place_meeting(x-1,y,obj_solid)
{
x -= 1;
}
}
}
if (place_meeting(x+2,y,obj_solid_push)) && (rkey) && place_meeting(x,y+1,obj_solid)
{
anim = "push";
i = instance_nearest(x+2,y,obj_solid_push);
with i
{
if !place_meeting(x+1,y,obj_solid)
{
x += 1;
}
}
}
Pushing from left (bottom block moves too):
Pushing from right (works fine)