(i’m using a translator, sorry for the typos). I recently had the idea of making a game similar to TombOfTheMask for mobile devices, as I thought it would be a very easy game to do since in theory the mechanics of the game are basic, but right away I came across a problem of movement. I basically can’t do the basic movement of the player, which is to move in a certain direction according to the key pressed, and I can’t do another action until the player collides with a collision. I would like to know how to make this mechanism of firstly the player to move according to the key pressed, and to stop when colliding with a collider. I am grateful if any divine being can take my doubt.
If * key is pressed, add a permanent force of xx° to the player,
if player is in collision with wall, remove all forces (and maybe move player away from wall).