F
faser3m
Guest
Help!
I was trying to make a game (using tutorials online for the codes) where i could create an attack animation and, when hitting a wall for example, i wanted my character to bounce back, like he was being rejected (Like in hollow knight).
Actually, i made some progress with the cod and i got able to "sword-bounce" on the Y, changing my vertical speed:
if (!place_meeting(x,y,oEnemy))
{
with(oPlayer)
{
direction = other.direction;
vsp = -lengthdir_y(5,direction);
hsp = -lengthdir_x(5,direction);
}
}
This code works perfectly, but only with the Y. I can't bounce horizontally and i don't actually know why. i tried by just changing the X value of the player based on the bounce, and it works! Until i get too close to a wall and the bounce teleport me inside the wall, making my escape impossible.
If somebody can help, i can send whatever code you'll need...
Thanks.
I was trying to make a game (using tutorials online for the codes) where i could create an attack animation and, when hitting a wall for example, i wanted my character to bounce back, like he was being rejected (Like in hollow knight).
Actually, i made some progress with the cod and i got able to "sword-bounce" on the Y, changing my vertical speed:
if (!place_meeting(x,y,oEnemy))
{
with(oPlayer)
{
direction = other.direction;
vsp = -lengthdir_y(5,direction);
hsp = -lengthdir_x(5,direction);
}
}
This code works perfectly, but only with the Y. I can't bounce horizontally and i don't actually know why. i tried by just changing the X value of the player based on the bounce, and it works! Until i get too close to a wall and the bounce teleport me inside the wall, making my escape impossible.
If somebody can help, i can send whatever code you'll need...
Thanks.