Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            backTexture = Content.Load<Texture2D>("ui_background");
            background = new Background(backTexture, new Vector2(0, 0), secondsToComplete);
            playerTexture = Content.Load<Texture2D>("player_blue");
            player = new Player(playerTexture, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2));
            EnemyTexture = Content.Load<Texture2D> ("Enemy");
        }
        public void ResetGameValues()
        {
            //basics
            TimerBegin = 0;
            highSpeed = false;

            //background
            background = new Background(backTexture, backEndTexture, new Vector2(0, 0), secondsToComplete, scrollSpeed);

            //player
            player = new Player(playerTexture, new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2), WifiNeeded);

            LostFromWifi = false;

            //collectables, enemies, obstacles
            enemies = new List<Enemy>();
            obstacles = new List<Obstacle>();
            collectables = new List<Collectable>();
            collectableSpawns = new List<CollectableSpawnDetail>();
            enemyspawntime = 5.0f;
            enemyspawncooldown = 0.0f;
            obstaclespawntime = 12.0f;
            obstaclespawncooldown = 0.0f;
            AddSpawnCollectables(Collectable.CollectType.WIFI, collectWifiSpawnCount);
            AddSpawnCollectables(Collectable.CollectType.POINTS, collectPointsSpawnCount);
            AddSpawnCollectables(Collectable.CollectType.HPSML, collectHPSmlSpawnCount);
            AddSpawnCollectables(Collectable.CollectType.HPLGE, collectHPLgeSpawnCount);
            AddSpawnCollectables(Collectable.CollectType.BIKE, collectBikeSpawnCount);

            //=============================================================
            //Timer
            speedTimer = new Timer(0, 0); //create a speed timer but don't leave it active
            speedTimer.TimerEnd = true;
            //=============================================================
        }