Esempio n. 1
0
        private SpriteFont font;                        //NOT BEING USED!!!

        public SpaceGame()
        {
            graphics = new GraphicsDeviceManager(this);
            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>();

            Content.RootDirectory = "Content";
        }
        public override void Initialize()
        {
            screenWidth = ScreenManager.GraphicsDevice.Viewport.Width;
            screenHeight = ScreenManager.GraphicsDevice.Viewport.Height;

            colorDataList = new List<byte[]>();
            player = new Player();
            generator = new ItemsGenerator();
            current = generator.GenerateMore();
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();
            bgLayer3 = new ParallaxingBackground();
            bar = new Bar(100, 20, 15, 270, 30);
            score = new Score(870, 10, Color.Peru);
            currentSprite = new List<Sprite>();
            items = new List<Texture2D>();
            songs = new Song[2];
            soundEffects = new SoundEffect[10];

            updateImmunityCounter = 0;
            alertTimer = 0;
            playQueue = 1;
            displayAlert = false;
            enablePause = true;

            Constants.ResetFlags();
            player.Initialize();
            base.Initialize();
        }
Esempio n. 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()
        {
            player = new Player();

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

            explosions = new List <Animation>();

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

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

            projectiles = new List <Projectile>();

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

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

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

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

            base.Initialize();
        }
Esempio n. 4
0
 public Xbox()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     bgLayer1 = new ParallaxingBackground();
     bgLayer2 = new ParallaxingBackground();
 }
Esempio n. 5
0
        public override void Initialize()
        {
            screenWidth  = ScreenManager.GraphicsDevice.Viewport.Width;
            screenHeight = ScreenManager.GraphicsDevice.Viewport.Height;

            colorDataList = new List <byte[]>();
            player        = new Player();
            generator     = new ItemsGenerator();
            current       = generator.GenerateMore();
            bgLayer1      = new ParallaxingBackground();
            bgLayer2      = new ParallaxingBackground();
            bgLayer3      = new ParallaxingBackground();
            bar           = new Bar(100, 20, 15, 270, 30);
            score         = new Score(870, 10, Color.Peru);
            currentSprite = new List <Sprite>();
            items         = new List <Texture2D>();
            songs         = new Song[2];
            soundEffects  = new SoundEffect[10];

            updateImmunityCounter = 0;
            alertTimer            = 0;
            playQueue             = 1;
            displayAlert          = false;
            enablePause           = true;



            Constants.ResetFlags();
            player.Initialize();
            base.Initialize();
        }
Esempio n. 6
0
        public void Initialize()
        {
            background_main_rect = new Rectangle(0, 0, graphicDevice.Viewport.Width, graphicDevice.Viewport.Height);

            // Parallaxes
            background_parallax_1 = new ParallaxingBackground();
            background_parallax_2 = new ParallaxingBackground();

            testAnimation = new Animation();
        }
Esempio n. 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()
 {
     // TODO: Add your initialization logic here
     // Initialize the player class
     player = new Player();
     base.Initialize();
     // Set a constant player move speed
     playerMoveSpeed = 8.0f;
     bgLayer1        = new ParallaxingBackground();
     bgLayer2        = new ParallaxingBackground();
 }
Esempio n. 8
0
        protected override void Initialize()
        {
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            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

            // 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();

            player = new Player();

            playerMoveSpeed = 8.0f;

            //initalizes the projectile ArrayList
            scatterShot = new List <Projectile>();

            //initalizes the beam ArrayList;
            rapidFire = new List <RapidFire>();

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

            shotRate = TimeSpan.FromSeconds(.08f);

            //initializing explosions
            explosions = new List <Animation>();

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

            base.Initialize();
        }
Esempio n. 9
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>();

            ships = new List <BounusShip>();

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

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

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

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

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

            bullets = new List <Bullet>();

            bombs = new List <Bomb>();

            projectiles = new List <Projectile>();

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

            // Initialize the explosion list
            explosions = new List <Animation>();

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

            base.Initialize();
        }
Esempio n. 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

            base.Initialize();
            bgLayer1   = new ParallaxingBackground();
            bgLayer2   = new ParallaxingBackground();
            player     = new Player();
            explosions = new List <Animation>();
            // Set a constant player move speed
            playerMoveSpeed = 8.0f;
            projectiles     = new List <Projectile>();

            // Set the laser to fire every quarter second
            fireTime = TimeSpan.FromSeconds(.15f);
        }
        /// <summary>
        /// Overridden from the base Game.Initialize. Once the GraphicsDevice is setup,
        /// we'll use the viewport to initialize some values.
        /// </summary>
        protected override void Initialize()
        {
            wallHeight       = Math.Min(GraphicsDevice.Viewport.Height, MaxWallheight);
            bottomGroundRect = new Rectangle
                               (
                0,
                (wallHeight + 1),
                GraphicsDevice.Viewport.Width,
                (GraphicsDevice.Viewport.Height - MaxWallheight)
                               );
            //player = new Player ();
            ground  = new ParallaxingBackground();
            clouds1 = new ParallaxingBackground();
            clouds2 = new ParallaxingBackground();

            base.Initialize();
        }
Esempio n. 12
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            player            = new Player();
            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();
        }
Esempio n. 13
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 move speed
            playerMoveSpeed = 8.0f;

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

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

            mainBackground = Content.Load <Texture2D>("Texture/mainbackground");

            // 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();
        }
Esempio n. 14
0
        protected override void Initialize()
        {
            player = new Player();
            float     xPos            = GraphicsDevice.Viewport.TitleSafeArea.X;
            float     yPos            = GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2;
            Vector2   playerPos       = new Vector2(xPos, yPos);
            Animation playerAnimation = new Animation();
            Texture2D playerTexture   = Content.Load <Texture2D>("Graphics\\shipAnimation");

            playerAnimation.Initialize(
                playerTexture,
                Vector2.Zero,
                115,
                69,
                8,
                60,
                Color.White,
                scale,
                true);
            Vector2 playerPosition = new Vector2(
                GraphicsDevice.Viewport.TitleSafeArea.X,
                GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);

            player.Initialize(playerAnimation, playerPosition);
            playerMoveSpeed = 8.0f;

            lasers = new LaserManager();
            Texture2D laserTexture = Content.Load <Texture2D>("Graphics\\laser");

            lasers.Initialise(laserTexture, GraphicsDevice.Viewport.TitleSafeArea.Width);

            ExplosionAnimations = new List <Animation>();
            ExplosionTexture    = Content.Load <Texture2D>("Graphics\\explosion");

            enemies        = new List <Enemy>();
            bgLayer1       = new ParallaxingBackground();
            bgLayer2       = new ParallaxingBackground();
            rectBackground = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            scoreFont      = Content.Load <SpriteFont>("Graphics\\Score");
            messageFont    = Content.Load <SpriteFont>("Graphics\\Message");
            state          = GameState.PAUSED;
            Reset();
            base.Initialize();
        }
Esempio n. 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()
        {
            // TODO: Add your initialization logic here
            // Initialize the player class
            player   = new Player();
            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(.6f);

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

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

            projectiles     = new List <Projectile>();
            upProjectiles   = new List <UpProjectile>();
            downProjectiles = new List <DownProjectile>();

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

            bigProjectiles = new List <BigProjectile>();

            // Set the laser to fire A LOT
            largeFireTime = TimeSpan.FromSeconds(.01f);

            explosions = new List <Animation>();

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

            base.Initialize();
        }
Esempio n. 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
            player          = new Player();
            playerMoveSpeed = 8.0f;
            bgLayer1        = new ParallaxingBackground();
            bgLayer2        = new ParallaxingBackground();
            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();
        }
Esempio n. 17
0
        protected override void Initialize()
        {
            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> ();

            base.Initialize();
        }
Esempio n. 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()
        {
            if (hasBooted)
            {
                drawPlayers = new List <Animation>();
                friends     = new List <Animation>();
                pops        = new List <Animation>();
                player      = new Player();
                enemies     = new List <Enemy>();
                megaLasers  = new List <MegaLaser>();
                // Set the time keepers to zero
                previousSpawnTime = TimeSpan.Zero;

                // Used to determine how fast enemy respawns
                enemySpawnTime = TimeSpan.FromSeconds(1f);
                // Initialize our random number generator
                random      = new Random();
                projectiles = new List <Projectile>();
                dankLasers  = new List <DankLaser>();
                // Set the laser to fire every quarter second
                fireTime         = TimeSpan.FromSeconds(.15f);
                dankTime         = TimeSpan.FromSeconds(.4f);
                previousDankTime = TimeSpan.Zero;
                explosions       = new List <Animation>();
                score            = 0;

                if (side == 0)
                {
                    bgLayer1 = new ParallaxingBackground();
                    bgLayer2 = new ParallaxingBackground();
                }
                else
                {
                    players = new ConcurrentBag <Player>();
                }


                base.Initialize();
            }
        }
Esempio n. 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()
 {
     // 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();
 }
Esempio n. 20
0
        public override bool Initialize()
        {
            ShooterTutorialGame.MouseVisibility = false;

            _spriteFont = _content.Load <SpriteFont>("Graphics\\gameFont");

            // Load the player resources
            Rectangle titleSafeArea  = _device.Viewport.TitleSafeArea;
            Vector2   playerPosition = new Vector2(titleSafeArea.X,
                                                   titleSafeArea.Y + (titleSafeArea.Height / 2));

            Animation playerAnimation = new Animation();
            Texture2D playerTexture   = _content.Load <Texture2D>("Graphics\\shipAnimation");

            playerAnimation.Initialize(playerTexture, playerPosition,
                                       115, 69, 8, 30, Color.White, Scale, true);

            // Initialize the player class
            ShooterTutorialGame.GamePlayer = new Player();
            _player = ShooterTutorialGame.GamePlayer;
            _player.Initialize(playerAnimation, playerPosition);

            // Background
            _rectBackground = new Rectangle(0, 0, _device.Viewport.Width,
                                            _device.Viewport.Height);
            _bgLayer1 = new ParallaxingBackground();
            _bgLayer2 = new ParallaxingBackground();

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

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

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

            // Initialize the laser
            laserBeams = new List <Laser>();
            const float SECONDS_IN_MINUTE = 60f;
            const float RATE_OF_FIRE      = 200f;

            laserSpawnTime     = TimeSpan.FromSeconds(SECONDS_IN_MINUTE / RATE_OF_FIRE);
            prevLaserSpawnTime = TimeSpan.Zero;

            // Initialize the explosion sheet
            explosions = new List <Explosion>();

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

            // Load the parallaxing background
            _bgLayer1.Initialize(_content, "Graphics\\bgLayer1",
                                 _device.Viewport.Width, _device.Viewport.Height, -1);
            _bgLayer2.Initialize(_content, "Graphics\\bgLayer2",
                                 _device.Viewport.Width, _device.Viewport.Height, -2);

            _mainBackground = _content.Load <Texture2D>("Graphics\\mainBackground");

            // Load the laser texture
            laserTexture = _content.Load <Texture2D>("Graphics\\laser");

            // Enemy texture
            enemyTexture = _content.Load <Texture2D>("Graphics\\mineAnimation");

            // Explosion texture
            explosionTexture = _content.Load <Texture2D>("Graphics\\explosion");

            // Load laser sound effect and create the effect instance
            laserSound         = _content.Load <SoundEffect>("Sounds\\laserFire");
            laserSoundInstance = laserSound.CreateInstance();

            // Load explosion sound effect and create the effect instance
            explosionSound         = _content.Load <SoundEffect>("Sounds\\explosion");
            explosionSoundInstance = explosionSound.CreateInstance();

            // Load the BGM
            //gameMusic = _content.Load<Song>("Sounds\\gameMusic");
            //MediaPlayer.Play(gameMusic);

            return(base.Initialize());
        }
Esempio n. 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()
        {
            // Initalize _player
            _player          = new Player();
            _playerMoveSpeed = 8.0f;

            // Initalize Faries
            _faries = new List <Fairy>();

            // Initalize _enemies
            _enemies = new List <Enemy>();
            _previousEnemySpawnTime = TimeSpan.Zero;
            _enemySpawnTime         = TimeSpan.FromSeconds(1.0f);

            // Initalize _random number generator
            _random = new Random();

            // Initalize background
            _bgLayer1 = new ParallaxingBackground();

            // Initalize weapons
            _marshmallows = new List <MarshmallowLaser>();
            _fireTime     = TimeSpan.FromSeconds(.15f);

            // Initalize _explosions
            _explosions = new List <Animation>();

            // Initalize _score
            _score = 0;

            // GameTime Variables
            _gameUpdate         = TimeSpan.FromSeconds(10f);
            _previousGameUpdate = TimeSpan.Zero;
            _increaseSpawn      = TimeSpan.FromSeconds(0.001f);
            _increaseFire       = TimeSpan.FromSeconds(0.001f);

            /* Power ups/downs */

            // Initalize health power up
            _healthy = new List <HealthBoost>();
            _previousHealthSpawnTime = TimeSpan.Zero;
            _healthSpawnTime         = TimeSpan.FromMinutes(_random.Next(1, 5));

            // Initalize _speed Power
            _speed = new List <SpeedPower>();
            _previousSpeedSpawnTime = TimeSpan.Zero;
            _speedSpawnTime         = TimeSpan.FromMinutes(_random.Next(1, 3));
            _speedTimer             = new Timer();
            _speedTimer.Interval    = 1;
            _speedTimer.Elapsed    += OnSpeedTimedEvent;
            _speedTimer.Enabled     = false;
            _speedCountSeconds      = 10000;

            // Initalize invasion
            _isInvading = false;

            // Initalize slow motion
            _isSlowingDown = false;

            // Initalize hyper space
            _hyperSpace               = new List <HyperSpace>();
            _wasJumping               = TimeSpan.Zero;
            _hyperSpaceSpawnTime      = TimeSpan.FromMinutes(_random.Next(1, 1));
            _isJumping                = false;
            _hyperSpaceTimer          = new Timer();
            _hyperSpaceTimer.Interval = 1;
            _hyperSpaceTimer.Elapsed += OnHyperSpaceTimedEvent;
            _hyperSpaceTimer.Enabled  = false;
            _hyperSpaceCountSeconds   = 3000;

            // Savior
            _saveMe    = new List <Savior>();
            _wasSaving = TimeSpan.Zero;
            _isSaving  = TimeSpan.FromSeconds(20f);

            // Add Fairy
            _addFairies     = new List <AddFairy>();
            _isAddingFairy  = TimeSpan.FromSeconds(40f);
            _wasAddingFairy = TimeSpan.Zero;


            base.Initialize();
        }
Esempio n. 22
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

            //Fullscreen logic - f**k logic
            #if WINDOWS || LINUX
            Window.IsBorderless = true;
            Window.Position = new Point(0, 0);
            graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            graphics.ApplyChanges();
            #endif
            //Set the background parameters
            rectBackground = new Rectangle(
                0,
                0,
                GraphicsDevice.Viewport.Width,
                GraphicsDevice.Viewport.Height);
            bgLayer1 = new ParallaxingBackground();
            bgLayer2 = new ParallaxingBackground();

            //Load the menu textures
            Texture2D menuBackground = Content.Load<Texture2D>("Graphics\\mainMenu");
            mainMenu = new Menu(menuBackground);
            Texture2D gameOverBackground = Content.Load<Texture2D>("Graphics\\endMenu");
            gameOverMenu = new Menu(gameOverBackground);
            gameOverMenu.Active = false;

            //Assign buttons to the menus
            ButtonAction btnAction;
            btnAction = NewGame;
            mainMenu.AddButton("New Game", btnAction);
            gameOverMenu.AddButton("Try Again", btnAction);
            btnAction = HighScores;
            mainMenu.AddButton("High Scores", btnAction);
            #if WINDOWS || LINUX
            btnAction = QuitGame;
            mainMenu.AddButton("Quit", btnAction);
            gameOverMenu.AddButton("Quit", btnAction);
            #endif
            //Load the game over menu

            //Load the font
            spriteFont = Content.Load<SpriteFont>("Graphics\\gameFont");

            //Load the player resources
            Animation playerAnimation = new Animation();
            Texture2D playerTexture = Content.Load<Texture2D>("Graphics\\shipAnimation");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 115, 69, 8, 30, Color.White, 1f, true);
            playerPosition = new Vector2(
                GraphicsDevice.Viewport.TitleSafeArea.X + GraphicsDevice.Viewport.TitleSafeArea.Width / 2,
                GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2
                );
            player.Initialize(playerAnimation, playerPosition);

            //Load the parallaxing background
            bgLayer1.Initialize(
                Content, "Graphics\\bgLayer1",
                GraphicsDevice.Viewport.Width,
                GraphicsDevice.Viewport.Height,
                (int)-scale);
            bgLayer2.Initialize(
                Content, "Graphics\\bgLayer2",
                GraphicsDevice.Viewport.Width,
                GraphicsDevice.Viewport.Height,
                (int)-scale * 2);
            mainBackground = Content.Load<Texture2D>("Graphics\\mainbackground");

            //Load enemy graphics
            enemyTexture = Content.Load<Texture2D>("Graphics\\mineAnimation");

            //Load laser textures
            laserTexture = Content.Load<Texture2D>("Graphics\\laser");

            //Load explosions
            explosionTexture = Content.Load<Texture2D>("Graphics\\explosion");
        }