I am writing a simple 2D game in Rust, having access to the following dependencies:
The genre is Metroidvania, the game features a single map Super Mario style, where the player can only move backwards and forwards and jump (and throw attacks). Modern games, such as Hollow Knight just to give an example, allow the player the same type of movements and they are very smooth.
I have never developed a game with these features, and from my first attempts now it looks like developing these smooth movements is harder than I thought it would be.
I have thought of several alternatives in order to move the player, but I am not sure which of these approaches is the best one or if there are others that are even better:
- Do not rely on the physics engine at all and implement the movements just by changing the position of the graphics (shapes/sprites...). I personally didn't try this one because it sounds like a lot of work that does not guarantee good results.
- Implement the movements by setting the velocity of the player through the physics engine.
- Implement the movements by applying a force to the player through the physics engine.
I guess the answer would also depend on how to handle the user inputs properly and link them to the player movements, since they are very strictly related to each other.