Hello, can anyone help me, please?
I’m making an old school platform game with a movement in 2 dimensions. Everything works quite well except one thing. Every time my character jumps into the wall it’s stuck in there until a key for horizontal movement is released. Is there a way how to fix this?
Thanks in advance.
a typical approach is, just add a line of code that stops all input, for say, a second after you bash in to something. in other words once you hit something, allow the physics engine to fling you around for a little bit, before there is any more input. Hope it helps!
(Answer to your comment on Fattie’s answer) Just create a variable and say that they can only use the input if that variable is true. Make it turn false whenever it hits something:
var canMove : boolean;
function Update(){
if(canMove){
//input code
}
if(hit){
canMove = false;
}else
canMove = true;
Btw be careful with the “else” statements and remember that they’re there.