Hot answers tagged movement
You need to set to NPC a new target once in a while (e.g. each 5sec) and move it towards the target each tick little by little. Then it will be smooth. To avoid sharp turns upon setting a new target, you can mix target positions between old and new target for a second or two. Additionally, you might want to Google for "Steering behavior"
I was going to type up an answer, but then I found this article, which seems to be exactly what you need: http://www.iforce2d.net/b2dtut/constant-speed I'll copy a few of the relevant bits. This assumes C++, but it's certainly applicable to any language. [...] in other situations you might want it to start and stop instantaneously. It is very tempting ...
Skew happens. This is a clock synchronization problem. Two nodes on a network can't know for sure what each other's clocks are. You can send the current time, but the receiver can't know for sure how old that value is. A good guess, though, is that it's stale by half the ping time. See http://en.wikipedia.org/wiki/Round-trip_delay_time. One approach then, ...
You don't constrain the vertical or lateral movement. The path line is only for controlling the depth and direction of the player character. You can see from the video the little white line that's attached to the green path. That white line shows where the character is "attached". The white line is just the closest point on the line to the player. Imagine ...
Movement should never be dependent on framerate. Bob Nystrom wrote an excellent summary of how to write a game loop that is independent of framerate. Check it out here. He starts with the most basic game loop then makes incremental improvements, discussing the motivation behind each iteration. I've added his code here but you should really check the article ...
You need to separate your games logic from display logic. Game logic should run at some fixed rate (e.g. 100 ms). Display should query the state of the game and display it at unconnected rate (e.g. 10-20 ms). That way your display performance never affects the game.
In addition to the other answers here you can use dithering to some extent. Dithering is where the edge of an object's pixels are lighter/darker in color to match the background making for a softer edge. For example, say you had a 4 pixel square I'll aproximate with: OO OO If you were to move this 1/2 a pixel to the right, nothing would really move. But ...
Change your red square collision box to a circle collision (or a sphere in 3D, the same issue can happen in 3D).
Only top voted, non community-wiki answers of a minimum length are eligible