Пример #1
0
Файл: Game1.cs Проект: Xe3d/Main
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List <Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();


            base.Initialize();
        }
Пример #2
0
        protected override void Initialize()
        {
            //Set player's score to zero
            score = 0;

            explosions = new List <Animation>();

            projectiles = new List <Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);
            // Initialize the enemies list
            enemies = new List <Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            player = new Player();
            base.Initialize();
        }
Пример #3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player = new Player();
            //sets player move speed
            playerMoveSpeed = 8.0f;
            //background
            bgLayer1       = new ParallaxingBackground();
            bgLayer2       = new ParallaxingBackground();
            mainBackground = Content.Load <Texture2D>("mainbackground");
            //Enemies
            enemies = new List <Enemy>();

            //Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            //used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            //initialize the random generator
            random = new Random();


            base.Initialize();
        }
Пример #4
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     player = new Player();
     currentKeyboardState = new KeyboardState();
     prevKeyboardState    = new KeyboardState();
     playerMoveSpeed      = 8.0f;
     bgLayer1             = new ParallaxingBackground();
     bgLayer2             = new ParallaxingBackground();
     enemies             = new List <Enemy>();
     Projectiles         = new List <projectile>();
     explosions          = new List <Animation>();
     prevSpawnTime       = TimeSpan.Zero;
     enemySpawnTime      = TimeSpan.FromSeconds(1.0f);
     stageChangeTime     = TimeSpan.FromSeconds(20.0f);
     prevStageChange     = TimeSpan.Zero;
     projectileSpawnTime = TimeSpan.FromSeconds(0.15f);
     prevProjectileTime  = TimeSpan.Zero;
     random   = new Random();
     score    = 0;
     gameOver = false;
     stage    = 1;
     powerUp  = new PowerUp();
     base.Initialize();
 }
Пример #5
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // You add your initialization logic here
     // Player
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     this.Services.AddService(typeof(SpriteBatch), spriteBatch);
     // Background
     bgLayer1 = new ParallaxingBackground(this, -1, "bgLayer1");
     bgLayer2 = new ParallaxingBackground(this, -2, "bgLayer2");
     Components.Add(bgLayer1);
     Components.Add(bgLayer2);
     // Add player
     player = new Player(this, new Vector2(0, GraphicsDevice.Viewport.Height / 2));
     Components.Add(player);
     // Enemies
     enemies           = new List <Enemy>();
     previousSpawnTime = TimeSpan.Zero;
     enemySpawnTime    = TimeSpan.FromSeconds(1.0f);
     random            = new Random();
     // Explosions
     explosions = new List <Animation>();
     // Game Text
     score     = 0;
     scoreText = new GameText(this, SCORE + score, new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X,
                                                               GraphicsDevice.Viewport.TitleSafeArea.Y));
     playerHealthText = new GameText(this, HEALTH + player.Health, new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X,
                                                                               GraphicsDevice.Viewport.TitleSafeArea.Y + 30));
     Components.Add(scoreText);
     Components.Add(playerHealthText);
     // Enable drag gesture
     TouchPanel.EnabledGestures = GestureType.FreeDrag;
     base.Initialize();
 }
Пример #6
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            player = new Player();                             //intializes player to be a Player object// Set a constant player move speed

            playerMoveSpeed            = 8.0f;                 //the 'f' just distinguises the value as a float value (w/out f it would be a double value).
            TouchPanel.EnabledGestures = GestureType.FreeDrag; //Enable the FreeDrag gesture.

            //Initialize background objects
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            //ENEMEY
            enemies           = new List <Enemy>();         // Initialize the enemies list
            previousSpawnTime = TimeSpan.Zero;              // Set the time keepers to zero
            enemySpawnTime    = TimeSpan.FromSeconds(1.0f); // Used to determine how fast enemy respawns
            random            = new Random();               // Initialize our random number generator

            projectiles = new List <Projectile>();
            fireTime    = TimeSpan.FromMilliseconds(500);

            explosions = new List <Animation>();

            currentText = new List <CombatText>();

            score = 0;  //Set player's score to zero

            base.Initialize();
        }
Пример #7
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            player = new Player();
            // Set a constant player move speed
            playerMoveSpeed = 4.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List <Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List <Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            explosions = new List <Animation>();

            //Set player's score to zero
            score = 0;

#if WINDOWS_PHONE
            Accelerometer accelSensor = new Accelerometer();
            // Start the accelerometer
            try
            {
                accelSensor.Start();
                accelActive = true;
                accelSensor.ReadingChanged += new EventHandler <AccelerometerReadingEventArgs>(accel_ReadingChanged);
            }
            catch (AccelerometerFailedException e)
            {
                // the accelerometer couldn't be started.  No fun!
                accelActive = false;
            }
            catch (UnauthorizedAccessException e)
            {
                // This exception is thrown in the emulator-which doesn't support an accelerometer.
                accelActive = false;
            }
#endif

            // TODO: Add your initialization logic here
            base.Initialize();
        }
Пример #8
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            this.Window.Title = "Wacky's Space Trouble by Wacky Bros. Entertainment";

            // Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List <Enemy>();



            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;



            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);



            // Initialize our random number generator
            random = new Random();

            projectiles = new List <Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            explosions = new List <Animation>();

            //Set player's score to zero
            score = 0;

            base.Initialize();
        }
Пример #9
0
        protected override void Initialize()
        {
            player          = new Player();
            playerMoveSpeed = 8.0f;

            bgLayer1       = new ParallaxingBackground();
            bgLayer2       = new ParallaxingBackground();
            rectBackground = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

            enemies                = new List <Enemy>();
            shootingEnemy          = new Enemy();
            enemyMoveSpeed         = 3.8f;
            shootingEnemyMoveSpeed = 4.2f;
            random = new Random();

            laserBeams          = new List <Laser>();
            laserMoveSpeed      = 10f;
            enemyLaserBeams     = new List <Laser>();
            enemyLaserMoveSpeed = 7f;

            const float SECONDS_IN_MINUTE = 60f;

            laserSpawnTime          = TimeSpan.FromSeconds(SECONDS_IN_MINUTE / 200f);
            previousLaserSpawnTime  = TimeSpan.Zero;
            enemyLaserSpawnTime     = TimeSpan.FromSeconds(SECONDS_IN_MINUTE / 100f);
            prevEnemyLaserSpawnTime = TimeSpan.Zero;

            healer = new Healer(18f, 13f);

            bomb = new Bomb(15f, 5f);

            asteroids          = new Asteroids[3];
            asteroidsAnimation = new Animation[3];

            explosions = new List <Explosion>();

            TouchPanel.EnabledGestures = GestureType.FreeDrag;
            IsMouseVisible             = true;
            Window.Title = "Space Shooter";

            gameState   = GameState.StartMenu;
            isGameEnded = false;

            base.Initialize();
        }
Пример #10
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            InitGraphicsMode(720, 480, false);

            // Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;
            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies           = new List <Enemy>();
            backgroundEnemies = new List <BackgroundEnemy>();

            // Set the time keepers to zero
            previousSpawnTimeEnemy           = TimeSpan.Zero;
            previousSpawnTimeBackgroundEnemy = TimeSpan.Zero;
            difficultyRampUp         = TimeSpan.FromSeconds(10);
            timeSinceDiffcultyRampUp = TimeSpan.FromSeconds(0);

            // Used to determine how fast enemy respawns
            enemySpawnTime           = TimeSpan.FromSeconds(1.0f);
            backgroundEnemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List <Projectile>();

            explosions = new List <Animation>();

            //Set player's score to zero
            score = 0;

            base.Initialize();
        }
Пример #11
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     player                     = new Player();
     playerMoveSpeed            = 8.0f;
     TouchPanel.EnabledGestures = GestureType.FreeDrag;
     bgLayer1                   = new ParallaxingBackground();
     bgLayer2                   = new ParallaxingBackground();
     enemies                    = new List <Enemy>();
     previousSpawnTime          = TimeSpan.Zero;
     enemySpawnTime             = TimeSpan.FromSeconds(1.0f);
     random                     = new Random();
     projectiles                = new List <Projectile>();
     fireTime                   = TimeSpan.FromSeconds(.15f);
     explosions                 = new List <Animation>();
     score = 0;
     base.Initialize();
 }
Пример #12
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player   = new Player();
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();
            enemies  = new List <Enemy>();
            ui       = new UI();

            previousSpawnTime = TimeSpan.Zero;

            enemySpawnTime = TimeSpan.FromSeconds(1.0f);
            explosions     = new List <Animation>();
            random         = new Random();
            projectiles    = new List <Projectile>();
            fireTime       = TimeSpan.FromSeconds(.15f);

            base.Initialize();
        }
Пример #13
0
 public void UpdateVariables(List<Enemy> enemies, List<HeavyEnemy> heavyEnemies, List<Diagonal> diagonals, List<HealthPowerUp> healthPowerUps, List<MissilePowerUp> missilePowerUps, 
     List<RapidFirePowerUp> rapidFirePowerUps, List<Laser> projectiles, List<Animation> explosions, SpriteBatch spriteBatch, Player player, Texture2D mainBackground, 
     ParallaxingBackground bgLayer1, ParallaxingBackground bgLayer2, List<Missile> missiles)
 {
     this.enemies = enemies;
     this.heavyEnemies = heavyEnemies;
     this.diagonals = diagonals;
     this.healthPowerUps = healthPowerUps;
     this.missilePowerUps = missilePowerUps;
     this.rapidFirePowerUps = rapidFirePowerUps;
     this.spriteBatch = spriteBatch;
     this.projectiles = projectiles;
     this.explosions = explosions;
     this.player = player;
     this.mainBackground = mainBackground;
     this.bgLayer1 = bgLayer1;
     this.bgLayer2 = bgLayer2;
     this.missiles = missiles;
 }
Пример #14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            // Initialize the player class
            player = new Player();
            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List <Enemy>();
            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;
            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);
            // Initialize our random number generator
            random = new Random();


            base.Initialize();
        }
Пример #15
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();
            //initialize the projectile objects
            projectiles = new List<Projectile>();
            //set the laser ot fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);
            //initialize explosion graphics
            explosions = new List<Animation>();
            //set players score to 0
            score = 0;

            base.Initialize();
        }
Пример #16
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            InitGraphicsMode(720, 480, false);

            // Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;
            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();
            backgroundEnemies = new List<BackgroundEnemy>();

            // Set the time keepers to zero
            previousSpawnTimeEnemy = TimeSpan.Zero;
            previousSpawnTimeBackgroundEnemy = TimeSpan.Zero;
            difficultyRampUp = TimeSpan.FromSeconds(10);
            timeSinceDiffcultyRampUp = TimeSpan.FromSeconds(0);

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);
            backgroundEnemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List<Projectile>();

            explosions = new List<Animation>();

            //Set player's score to zero
            score = 0;

            base.Initialize();
        }
Пример #17
0
        // ����������� ����� �����������
        protected override void Initialize()
        {
            Window.Title = "� 31-� 2012 ����� �.�.";
            // ����������� ����� ������
            player = new Player();
            // ������� �������� ������
            playerMoveSpeed = 8.0f;
            // ����������� ���� ���������
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();
            // ����������� ������ ������
            enemies = new List<Enemy>();
            // ��������� ������������ ���������� ������
            previousSpawnTime = TimeSpan.Zero;
            // ���, ����� ���� ������������ ������
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);
            // ����������� ���������� ���������� �����
            random = new Random();
            // ����������� ������ ������
            projectiles = new List<Projectile>();
            // ������� �������, ����� ���� ����� �������
            fireTime = TimeSpan.FromSeconds(.15f);
            // ����������� ������ �������
            explosions = new List<Animation>();
            // ��������� ����
            score = 0;
            // ����� ������
            menu = new MainMenu();
            menuTime = TimeSpan.FromSeconds(.3f);
            options = new Options();

            base.Initialize();
        }
Пример #18
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            // Initialize the player class
            player = new Player();

            startScreenIsOn = true;
            endScreenIsOn = false;
            //gameState = false;
            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            //TouchPanel.EnabledGestures = GestureType.FreeDrag;

            backgroundSpeed = -2;

            bgLayer1 = new ParallaxingBackground();
            //bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(2f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List<Projectile>();

            upgradeObjects = new List<UpgradeObject>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            previousDropTime = TimeSpan.Zero;

            dropTime = TimeSpan.FromSeconds(4f);

            //dropTime = TimeSpan.FromSeconds(random.Next(0, 1));

            explosions = new List<Animation>();

            upgrades = new List<Animation>();

            //Set player's score to zero
            score = 0;

            metScore = 200;

            level = 1;

            base.Initialize();
        }
Пример #19
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // El juego empieza pausado y muestra el fondo.
            pause = true;

            //Initialize the player class
            player = new Personaje();

            //Enable the FreeDrag gesture. -->> Esto parece que sirve si jugás en un Windows Phone o algo con touch.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            fondoCapa1 = new ParallaxingBackground();
            fondoCapa2 = new ParallaxingBackground();
            tierraFirme = new ParallaxingBackground();

            Enemigos = new List<Enemigo>();
            EnemigosTerrestres = new List<Enemigo>();

            EnemigoTiempoDeUltimaAparicion = TimeSpan.Zero;
            EnemigoFrecuenciaSpawn = TimeSpan.FromSeconds(1.0f);

            random = new Random();

            Explosiones = new List<Animacion>();
            score = 0;
            pause = false;
            gameOver = false;
            timer = new TimeSpan(0);
            totalTime = "";
            base.Initialize();
        }
Пример #20
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            player = new Player();
            // Set a constant player move speed
            playerMoveSpeed = 4.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List<Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            explosions = new List<Animation>();

            //Set player's score to zero
            score = 0;

            #if WINDOWS_PHONE

            Accelerometer accelSensor = new Accelerometer();
            // Start the accelerometer
            try
            {
                accelSensor.Start();
                accelActive = true;
                accelSensor.ReadingChanged += new EventHandler<AccelerometerReadingEventArgs>(accel_ReadingChanged);
            }
            catch (AccelerometerFailedException e)
            {
                // the accelerometer couldn't be started.  No fun!
                accelActive = false;
            }
            catch (UnauthorizedAccessException e)
            {
                // This exception is thrown in the emulator-which doesn't support an accelerometer.
                accelActive = false;
            }

            #endif

            // TODO: Add your initialization logic here
            base.Initialize();
        }
Пример #21
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            player = new Player(); //intializes player to be a Player object// Set a constant player move speed

            playerMoveSpeed = 8.0f; //the 'f' just distinguises the value as a float value (w/out f it would be a double value).
            TouchPanel.EnabledGestures = GestureType.FreeDrag;  //Enable the FreeDrag gesture.

            //Initialize background objects
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            //ENEMEY
            enemies = new List<Enemy>();  // Initialize the enemies list
            previousSpawnTime = TimeSpan.Zero; // Set the time keepers to zero
            enemySpawnTime = TimeSpan.FromSeconds(1.0f); // Used to determine how fast enemy respawns
            random = new Random(); // Initialize our random number generator

            projectiles = new List<Projectile>();
            fireTime = TimeSpan.FromMilliseconds(500);

            explosions = new List<Animation>();

            currentText = new List<CombatText>();

            score = 0;  //Set player's score to zero

            base.Initialize();
        }
Пример #22
0
        public override void LoadContent()
        {
            //////******************* INIT

            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            projectiles = new List<Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.25f);

            explosions = new List<Animation>();

            score = 0;

            //////////******************* LOAD
            if (Content == null)
                Content = new ContentManager(ScreenManager.Game.Services, "Content");

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = ScreenManager.SpriteBatch;

            //player.Initialize(Content.Load<Texture2D>("player"), playerPosition);
            // Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);

            Vector2 playerPosition = new Vector2(ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.X, ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Y + ScreenManager.GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            player.Initialize(playerAnimation, playerPosition);

            // Load the parallaxing background
            bgLayer1.Initialize(Content, "bgLayer1", ScreenManager.GraphicsDevice.Viewport.Width, -1);
            bgLayer2.Initialize(Content, "bgLayer2", ScreenManager.GraphicsDevice.Viewport.Width, -2);

            mainBackground = Content.Load<Texture2D>("mainbackground");
            enemyTexture = Content.Load<Texture2D>("mineAnimation");
            projectileTexture = Content.Load<Texture2D>("laser");
            explosionTexture = Content.Load<Texture2D>("explosion");
            // Load the score font
            font = Content.Load<SpriteFont>("gameFont");

            // Load the music
            gameplayMusic = Content.Load<Song>("sound/gameMusic");

            // Load the laser and explosion sound effect
            laserSound = Content.Load<SoundEffect>("sound/laserFire");
            explosionSound = Content.Load<SoundEffect>("sound/explosion");
            SoundEffect.MasterVolume = (float)Game1.VolumeSound / 100;

            // Start the music right away
            PlayMusic(gameplayMusic);
        }
Пример #23
0
Файл: Game1.cs Проект: Xe3d/Main
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 8.0f;

            //Enable the FreeDrag gesture.
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            base.Initialize();
        }
Пример #24
0
        //============================================================================================================================
        protected override void Initialize()
        {
            explosions = new List<Animation>();
            diagonals = new List<Diagonal>();
            state = gameState.startScreen;
            drawer = new Drawer();
            collision = new Collision();
            waveTimer = new WaveTimer();

            //Initial values of variables
            score = 0;
            missileCount = 3;
            secondTimer = 60;
            difficultyFactor = 1.0f;
            transportShipHealth = 300;
            timePlayed = 0;

            projectiles = new List<Laser>();

            missiles = new List<Missile>();

            healthPowerUps = new List<HealthPowerUp>();

            missilePowerUps = new List<MissilePowerUp>();

            rapidFirePowerUps = new List<RapidFirePowerUp>();

            transportHealTime = TimeSpan.FromSeconds(1.1);

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Initialize the heavyEnemies list
            heavyEnemies = new List<HeavyEnemy>();

            // Set the time keepers to zero
            waveTimer.previousEnemySpawnTime = TimeSpan.Zero;

            // Set the time keepers to zero
            previousHealthPowerUpSpawnTime = TimeSpan.Zero;
            previousMissilePowerUpSpawnTime = TimeSpan.Zero;
            previousRapidFirePowerUpSpawnTime = TimeSpan.Zero;

            //Used to determine how fast health power ups respawn
            healthPowerUpSpawnTime = TimeSpan.FromSeconds(12.5f);

            //Used to determine how fast health power ups respawn
            missilePowerUpSpawnTime = TimeSpan.FromSeconds(20.0f);

            //Used to determine how fast rapid fire power ups respawn
            rapidFirePowerUpSpawnTime = TimeSpan.FromSeconds(17.0f);

            // Initialize our random number generator
            random = new Random();

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 12.0f;

            viewportHeight = GraphicsDevice.Viewport.Height;
            viewportWidth = GraphicsDevice.Viewport.Width;
            transportShip = new TransportShip();
            transportShip.Initialize(viewportWidth,viewportHeight);
            playerCutscene = new PlayerCutscene();
            playerCutscene.Initialize(viewportWidth, viewportHeight, GraphicsDevice.Viewport.TitleSafeArea.X, (GraphicsDevice.Viewport.TitleSafeArea.Y
            + GraphicsDevice.Viewport.TitleSafeArea.Height / 2) - 34);
            base.Initialize();
        }
Пример #25
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player = new Player();
            player2 = new Player();
            playerMoveSpeed = 8.0f;
            s = new Servidor();
            s.start();
            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            projectiles = new List<Projectile>();
            projectiles2 = new List<Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            explosions = new List<Animation>();

            score = 0;
            score2 = 0;

            base.Initialize();
        }
Пример #26
0
        //============================================================================================================================
        protected override void Initialize()
        {
            Playing = false;
            gameState state = gameState.start;
            explosions = new List<Animation>();

            //Set player's score to zero
            score = 0;

            projectiles = new List<Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            // Initialize the player class
            player = new Player();

            // Set a constant player move speed
            playerMoveSpeed = 16.0f;

            // TODO: Add your initialization logic here

            base.Initialize();
        }
Пример #27
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player = new Player();
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();
            enemies = new List<Enemy>();
            ui = new UI();

            previousSpawnTime = TimeSpan.Zero;

            enemySpawnTime = TimeSpan.FromSeconds(1.0f);
            explosions = new List<Animation>();
            random = new Random();
            projectiles = new List<Projectile>();
            fireTime = TimeSpan.FromSeconds(.15f);

            base.Initialize();
        }
Пример #28
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     player = new Player();
     playerMoveSpeed = 8.0f;
     TouchPanel.EnabledGestures = GestureType.FreeDrag;
     bgLayer1 = new ParallaxingBackground();
     bgLayer2 = new ParallaxingBackground();
     enemies = new List<Enemy>();
     previousSpawnTime = TimeSpan.Zero;
     enemySpawnTime = TimeSpan.FromSeconds(1.0f);
     random = new Random();
     projectiles = new List<Projectile>();
     fireTime = TimeSpan.FromSeconds(.15f);
     explosions = new List<Animation>();
     score = 0;
     base.Initialize();
 }
Пример #29
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player = new Player();

            playerMoveSpeed = 8.0f;
            TouchPanel.EnabledGestures = GestureType.FreeDrag;

            IsMouseVisible = true;

            // Background
            backgroundLayer1 = new ParallaxingBackground();
            backgroundLayer2 = new ParallaxingBackground();

            rectangleBackground = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

            // Initialize the enemies list
            enemies = new List<Enemy>();

            // Set the time keepers to zero
            previousSpawnTime = TimeSpan.Zero;

            // Used to determine how fast enemy respawns
            enemySpawnTime = TimeSpan.FromSeconds(1.0f);

            // Initialize our random number generator
            random = new Random();

            base.Initialize();
        }