Shooting while moving algorithm#