function init_movement() camera_pos = {0, 0} end function handle_input() new_pos = camera_pos if (btnp(0)) new_pos[1] -= 1 -- move left if (btnp(1)) new_pos[1] += 1 -- move right if (btnp(2)) new_pos[2] -= 1 -- move up if (btnp(3)) new_pos[2] += 1 -- move down if legal_move(new_pos) then camera_pos = new_pos end -- todo: determine whether we need to regen map and what that means end function draw_player() end function legal_move(pos) return true end