Esempio n. 1
0
 public GamePanel()
 {
     canon = new Canon(this);
     shield = new Shield(this);
     scoreboard = new Scoreboard(this);
     this.SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.UserPaint |
                     ControlStyles.AllPaintingInWmPaint,
                     true);
     this.UpdateStyles();
 }
Esempio n. 2
0
        //
        // Metode for å starte spillet.
        // 
        public void startGame(String n)
        {
            for (int i = 0; i < numberOfHouses; i++)
            {
                house.Add(new House(i, numberOfHouses));
            }
            /*
            * Drawer thred 
            */
            activeDrawing = true;
            shieldActive = true;
            activeShots = true;
            activeSpawner = true;

            canon = new Canon(this);
            shield = new Shield(this);
            scoreboard = new Scoreboard(this);

            scoreboard.score = 0;

            playerName = n;

            /*
             *  tråd for tegning av spillet                
             */
            Thread drawingGame = new Thread(new ThreadStart(drawing));
            drawingGame.Start();

            /*
             *   tråd for bevegelse av skudd
             */
            Thread movingShots = new Thread(new ThreadStart(moveShots));
            movingShots.Start();

            /*
             * Spawner thred
             */
            Thread spawner = new Thread(new ThreadStart(addEnemy));
            spawner.Start();
        }