Hey everyone, I currently have a simple top-down RPG with a jump command, I've made it so when you jump, it negates the collide command, and with my depth working, I'm able to jump over enemies. However, once this happens I can potentially land on the enemy, getting stuck in them, as my code requires (zsp = 0) in order for the collision to happen.
I'm trying to figure out how I can automatically push my Player object off of the collision object, whether this is a rock, or an enemy etc. Thanks in advance!
Edit: I've almost figured it out with this code:
if (place_meeting(x,y,oCollision)) && (zsp = 0)
{
hsp = sign(oCollision);
vsp = sign(oCollision);
}
However, it only pushes me off the collision to the right, if I use "sign(-oCollision)" then it only pushes me to the left. Can anyone guide me make it so it pushes me left or right depending the position of my collision. I tried SIGN for this but cant seem to figure it out.
Also, another simple thing is increase the speed in which I'm pushed off of the collision. Thanks again.
I'm trying to figure out how I can automatically push my Player object off of the collision object, whether this is a rock, or an enemy etc. Thanks in advance!
Edit: I've almost figured it out with this code:
if (place_meeting(x,y,oCollision)) && (zsp = 0)
{
hsp = sign(oCollision);
vsp = sign(oCollision);
}
However, it only pushes me off the collision to the right, if I use "sign(-oCollision)" then it only pushes me to the left. Can anyone guide me make it so it pushes me left or right depending the position of my collision. I tried SIGN for this but cant seem to figure it out.
Also, another simple thing is increase the speed in which I'm pushed off of the collision. Thanks again.
Last edited: