// defined in the class declaration (Spaceship.h) float speed = 5.f; ... void Spaceship::UpdatePosition() { Vector2f dir = inputManager.GetDirection(); if (dir != math::vectorZero) position += dir * speed; }