public AICar( Level mlevel,Vector2 startPosition, float startSpeed ) { level = mlevel; texture = level.Content.Load<Texture2D>("Sprites/ai_car_1"); boundingBox = new Rectangle(15, 3, 33, 57); position = startPosition; speed = startSpeed; movement = 0; count++; number = count; }
int width; // = textureOffset.Width #endregion Fields #region Constructors public Car(Level _level, Vector2 initialPosition, int initialSpeed, string textureName, Rectangle _textureOffset) { level = _level; position = initialPosition; speed = initialSpeed; velocity = new Vector2(0, initialSpeed); textureOffset = _textureOffset; width = textureOffset.Width; height = textureOffset.Height; LoadContent(textureName); }
public void LoadNextLevel() { if (currentLevel == totalLevels) { System.Windows.Forms.MessageBox.Show("Congratulations !\nYou have successfully completed the game."); Exit(); } else { // 'Level complete' screen, if != 1 currentLevel++; level = new Level(Services, this,currentLevel, windowWidth, windowHeight); // reset player position } }
int width; // = textureOffset.Width #endregion Fields #region Constructors public PlayerCar(Level level, Vector2 position) { this.level = level; this.position = position; fuelRemaining = level.StartFuel; LoadContent(); mass = 1000; // kg textureOffset = new Rectangle(15, 3, 33, 57); width = textureOffset.Width; height = textureOffset.Height; u.X = 0; u.Y = 1; Cdrag = 0.4257f; lastFuelUnitTime = 0; enginePower = 1000; isSpinning = false; isAlive = true; }