(local util (require :lib.util)) (local dim (require :game.dim)) (local map (require :game.tilemap)) (local pacman (util.hot-table ...)) ; Pacman movement and collision rules ; * Pacman moves in the direction he was told until stopped by a wall ; * If the player tells Pacman to change direction but there is a wall there, ; Pacman's direction does not change ; * Turning a corner is funky: ; https://www.gamasutra.com/view/feature/132330/the_pacman_dossier.php?page=4 ; "Whenever Pac-Man makes a pre-turn or post-turn, his orientation changes, and he starts to ; move one pixel in his new direction for every pixel traveled in his old direction, effectively ; doubling his speed as he moves at a 45 degree angle. Once he reaches the centerline of the new ; direction's path, he starts moving purely in that direction and his speed returns to normal." ; The simplest way to implement this appears to be to treat turns as having a "fudge factor" - ; Pacman enters a state where he changes direction _and_ is being pulled towards the center of ; the track. (The "post-turn" correction means we can't simply treat this as the corners having ; their edges filed off!) ; I think Bomberman actually does this too pacman.hot