Exemple #1
0
        private void BtnStartGame_Click(object sender, EventArgs e)
        {
            FrmGame startGame = new FrmGame(this);

            this.Hide();
            startGame.Show();
        }
Exemple #2
0
 public RoadBox(FrmGame gameFrom, GameEngine gameEngine)
 {
     LeftLines     = gameFrom.pnlLeftLines;
     RightLines    = gameFrom.pnlRightLines;
     Line          = gameFrom.pcbLine1;
     Road          = gameFrom.pnlRoad;
     Auto          = gameFrom.pcbCar;
     EnemyCars     = new PictureBox[3];
     EnemyCars[0]  = gameFrom.pcbEnemyCar;
     EnemyCars[1]  = gameFrom.pcbEnemyCar2;
     EnemyCars[2]  = gameFrom.pcbEnemyCar3;
     CoinControl   = gameFrom.pcbCoin;
     ClockElement  = gameFrom.pcbClock;
     FinishLine    = gameFrom.pcbFinishLine;
     Points        = gameFrom.lblPoints;
     Distance      = gameFrom.lblDistance;
     Time          = gameFrom.lblTime;
     Pause         = gameFrom.lblPause;
     Ticks         = 30;
     PointQuantity = 0;
     RouteDistance = 60;
     Points.Text   = "Points: " + PointQuantity.ToString();
     Time.Text     = "Time: " + Ticks.ToString();
     Distance.Text = string.Format("{0:F1}", RouteDistance + " km");
     CarBox        = new CarBox(gameFrom, gameEngine, this);
     EnemyCarBox   = new EnemyCarBox(gameFrom, gameEngine, this, EnemyCars);
     CoinBox       = new CoinBox(gameEngine, this);
     Clock         = new ClockBox(gameEngine, this);
     MiniCarBox    = new MiniCarBox(gameFrom, this);
 }
        private void BtnPlayAgain_Click(object sender, EventArgs e)
        {
            this.Close();
            ActualGame.Close();
            FrmGame newGame = new FrmGame(MenuUI);

            newGame.Show();
        }
Exemple #4
0
        public GreenBox(FrmGame gameForm, Random random)
        {
            GameForm      = gameForm;
            Grass         = gameForm.pnlGrass;
            SceneElements = new PictureBox[Grass.Controls.Count];

            for (int i = 0; i < Grass.Controls.Count; i++)
            {
                SceneElements[i] = (PictureBox)Grass.Controls[i];
            }
        }
 public FrmEndGame(FrmGame game, FrmMenu menuUI, string description, int score, int crash)
 {
     InitializeComponent();
     FormSettings.SetSetting(this);
     ActualGame          = game;
     MenuUI              = menuUI;
     GameScore           = score;
     GameCrash           = crash;
     lblDescription.Text = description;
     lblScore.Text       = "SCORE: " + score.ToString();
 }
Exemple #6
0
 public EnemyCarBox(FrmGame gameForm, GameEngine gameEngine, RoadBox road, PictureBox[] enemies)
 {
     GameForm   = gameForm;
     GameEngine = gameEngine;
     Road       = road;
     Enemies    = enemies;
     movement   = new int[Enemies.Length];
     for (int i = 0; i < road.EnemyCars.Length; i++)
     {
         Enemies[i].Location = road.RandomLocation(Road.random.Next((int)StaticValues.enemyMinLocationY, (int)StaticValues.enemyMaxLocationY));
         movement[i]         = Road.random.Next((int)StaticValues.movementLeft, (int)StaticValues.movementRight);
     }
 }
 public FrmEndGame(FrmGame game, FrmMenu menuUI, string description, int score, int crash, string message)
 {
     InitializeComponent();
     FormSettings.SetSetting(this);
     ActualGame          = game;
     MenuUI              = menuUI;
     GameScore           = score;
     GameCrash           = crash;
     lblDescription.Text = description;
     lblScore.Text       = message;
     btnConfirm.Enabled  = false;
     txbYourName.Enabled = false;
 }
 public GameEngine(FrmGame gameForm, FrmMenu menuForm)
 {
     FormGame   = gameForm;
     MenuForm   = menuForm;
     Road       = new RoadBox(FormGame, this);
     Grass      = new GreenBox(FormGame, Road.random);
     SceneTimer = gameForm.tmrSceneTimer;
     GameTimer  = gameForm.tmrGameTimer;
     FinishGame = gameForm.tmrFinishGame;
     SpeedGame  = 5;
     SpeedMax   = 10;
     SpeedMin   = 1;
     Crash      = 0;
 }
Exemple #9
0
 public CarBox(FrmGame game, GameEngine gameEngine, RoadBox road)
 {
     Car        = game.pcbCar;
     GameEngine = gameEngine;
     Road       = road;
 }
 public MiniCarBox(FrmGame gameForm, RoadBox road)
 {
     MiniCarAuto    = gameForm.pcbMiniCar;
     MiniFinishLine = gameForm.pcbMiniFinishLine;
     Road           = road;
 }