B
bigbrainguy
Guest
In my game, I'm trying to get my horizontal collisions to work. When my player collides with the obj_platform horizontally, he can go through the platforms. When in the platforms, the player can't jump but can move left or right through the blocks. However, I used about the same code for my vertical collisions and they work fine. It is probably also good to note that I use these exact same codes in another project I was working on and it worked perfectly fine. The player couldn't go in the platforms at all. I'm pretty loss on why my game is acting this way and was hoping somebody would help.
obj_platform is the platform I'm colliding with that I am going through.
Here is the code:
If more information is needed I will provide it ASAP.
Thanks for trying to help!
obj_platform is the platform I'm colliding with that I am going through.
Here is the code:
Code:
//Horizontal Collisions
if(place_meeting(x+hspd,y,obj_platform)){
while(!place_meeting(x+sign(hspd),y,obj_platform)){
x += sign(hspd)
}
hspd = 0
}
x += hspd
//End Horizontal Collisions
if(place_meeting(x,y+vspd,obj_platform)){
while(!place_meeting(x,y+sign(vspd),obj_platform)){
y += sign(vspd)
}
vspd = 0
}
y += vspd
Thanks for trying to help!
Attachments
-
11 KB Views: 6