Exemplo n.º 1
0
        void GameDraw()
        {
            background.Draw();

            PickupManager.Draw();
            EnemyManager.Draw();
            SmokeManager.Draw();

            player.Draw();

            UI.Draw(player);
        }
Exemplo n.º 2
0
        // Initialize all dependant variables
        public void Initialize()
        {
            // Start Objects
            playButton = new PlayButton(Program.Center - new Vector2(100, -100), 200, 100, Color.BLUE,
                                        new Vector2(10, 20), "PLAY", 70, Color.SKYBLUE, 20);
            LoadHighScore();

            // Game Objects
            PreLoadedTextures.Initialize();
            stopwatch.Start();
            lastTime = stopwatch.ElapsedMilliseconds;

            player = new Tank(@"Textures\tankBlue_outline.png", @"Textures\barrelBlue.png", -90 * (float)(MathF.PI / 180.0f), Program.Center, 20);

            UI.Initialize();
            PickupManager.Initialize(player);
            EnemyManager.Initialize(player);

            // End Objects
            HighScoreName = new InputField(Program.Center - new Vector2(150, -160), 300, 120, Color.BLUE,
                                           new Vector2(30, 30), "NAME", 70, Color.SKYBLUE, 25, 5);
        }
Exemplo n.º 3
0
        void GameUpdate()
        {
            currentTime = stopwatch.ElapsedMilliseconds;
            deltaTime   = (currentTime - lastTime) / 1000.0f;

            timer += deltaTime;
            if (timer >= 1)
            {
                fps    = frames;
                frames = 0;
                timer -= 1;
            }
            frames++;

            player.Update(deltaTime);

            background.Update(deltaTime);
            EnemyManager.Update(deltaTime);
            PickupManager.Update(deltaTime);
            SmokeManager.Update(deltaTime);

            CurCenter = Program.Center;
            lastTime  = currentTime;
        }