struct Asteroid { public Vector3 position; public Vector3 direction; public float speed; public bool isActive; public void Update(float delta) { position += direction * speed * GameConstants.AsteroidSpeedAdjustment * delta; if (position.X > GameConstants.PlayfieldSizeX) position.X -= 2 * GameConstants.PlayfieldSizeX; if (position.X < -GameConstants.PlayfieldSizeX) position.X += 2 * GameConstants.PlayfieldSizeX; if (position.Y > GameConstants.PlayfieldSizeY) position.Y -= 2 * GameConstants.PlayfieldSizeY; if (position.Y < -GameConstants.PlayfieldSizeY) position.Y += 2 * GameConstants.PlayfieldSizeY; } }
You need to enable Javascript in your browser to edit pages.
help on how to format text
Code for asteroid.cs