コード例 #1
0
        public PowerupManager(Texture2D spriteSheet, PlayerManager playerManager)
        {
            this.spriteSheet = spriteSheet;
            this.playerManager = playerManager;

            SpawnPowerup();
        }
コード例 #2
0
 public CollisionManager(AsteroidManager asteroidManager, PlayerManager playerManager, EnemyManager enemyManager, ExplosionManager explosionManager)
 {
     this.asteroidManager = asteroidManager;
     this.playerManager = playerManager;
     this.enemyManager = enemyManager;
     this.explosionManager = explosionManager;
 }
コード例 #3
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);
            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");


            Song song = Content.Load<Song>(@"Sounds\Requiem");  // Put the name of your song in instead of "song_title"
            MediaPlayer.Play(song);


            starField = new StarField(this.Window.ClientBounds.Width,this.Window.ClientBounds.Height,200,
                new Vector2(0, 30f),spriteSheet,new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(10,spriteSheet,new Rectangle(0, 0, 50, 50),20,
                this.Window.ClientBounds.Width,this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(spriteSheet,new Rectangle(0, 150, 50, 50),3,
                new Rectangle(0,0,this.Window.ClientBounds.Width,this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(spriteSheet,new Rectangle(0, 200, 50, 50),6,playerManager,
                new Rectangle(0,0,this.Window.ClientBounds.Width,this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(spriteSheet,new Rectangle(0, 100, 50, 50),3,new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(asteroidManager,playerManager,enemyManager,explosionManager);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");
            // TODO: use this.Content to load your game content here
            SoundManager.Initialize(Content);
        }
コード例 #4
0
        public PowerupManager(Texture2D laserpowerup, Texture2D blackhole, PlayerManager playerManager)
        {
            this.laserpowerup = laserpowerup;
            this.Blackhole = blackhole;
            this.playerManager = playerManager;

            SpawnPowerup();
            SpawnBlackhole();
        }
コード例 #5
0
 public EnemyManager(Texture2D texture,Rectangle initialFrame,int frameCount,
     PlayerManager playerManager,Rectangle screenBounds)
 {
     this.texture = texture;
     this.initialFrame = initialFrame;
     this.frameCount = frameCount;
     this.playerManager = playerManager;
     EnemyShotManager = new ShotManager(texture,new Rectangle(0, 300, 5, 5),4,2,150f,screenBounds);
     setUpWaypoints();
 }
コード例 #6
0
ファイル: Game1.cs プロジェクト: Devrajsinh/SupermanAssault
        /// <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);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
            SuperSprite = Content.Load<Texture2D>(@"Textures\SuperSprite");
            krypton = Content.Load<Texture2D>(@"Textures\krypton");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 8, 8));

            starField1 = new StarField(
               this.Window.ClientBounds.Width,
               this.Window.ClientBounds.Height,
               200,
               new Vector2(0, 30f),
               spriteSheet,
               new Rectangle(0, 450, 4, 4));

            starField2 = new StarField(
               this.Window.ClientBounds.Width,
               this.Window.ClientBounds.Height,
               200,
               new Vector2(0, 30f),
               spriteSheet,
               new Rectangle(0, 450, 8, 8));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                SuperSprite,    
                new Rectangle(0, 0, 51, 64),    
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
コード例 #7
0
ファイル: Game1.cs プロジェクト: vheronicha/games
        /// <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);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 150, 50, 50),
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            // TODO: use this.Content to load your game content here
        }
コード例 #8
0
ファイル: Game1.cs プロジェクト: marlynhenry/AsteroidBeltSalt
        /// <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);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
            bbb = Content.Load<Texture2D>(@"Textures\bbb");
            song = Content.Load<Song>(@"Sounds\song");
            MediaPlayer.Play(song);

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(579, 95, 20, 20));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(354, 68, 62, 54),
                1,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(471, 97, 98, 46),    
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(158, 143, 82, 53),
                1,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(158, 143, 82, 53),
                1,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
コード例 #9
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);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
            planetsmash = Content.Load<Texture2D>(@"Textures\planetsmash");

            starField = new List<StarField>();
            background = new Sprite(new Vector2(0, 0), planetsmash, new Rectangle(0, 0, 800, 600), Vector2.Zero);

            starField.Add(new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                50,
                new Vector2(0, 5f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2)));

            starField.Add(new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 10f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2)));

            starField.Add(new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 20f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2)));

            starField.Add(new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                100,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2)));

            starField.Add(new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                25,
                new Vector2(0, 60f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2)));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 150, 50, 50),
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");

            // TODO: use this.Content to load your game content here
        }
コード例 #10
0
ファイル: Game1.cs プロジェクト: shookt/astroed
        /// <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);

            HomeScreen = Content.Load<Texture2D>(@"Textures\HomeScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");

            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                14,
                spriteSheet,
                new Rectangle(472, 208, 52, 49),
                1,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(0, 326, 50, 100),    
                1,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(316, 210, 46, 46),
                1,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");


            // TODO: use this.Content to load your game content here
        }
コード例 #11
0
ファイル: Game1.cs プロジェクト: WillC336/AssteroidAssault
        /// <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);

            deathStar = Content.Load<Sprite>(@"Textures\DeathStar");
            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");

            camera = new Camera(new Viewport(0, 0, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));
            camera.Origin = new Vector2(camera.ViewPort.Width / 2.0f, camera.ViewPort.Height);

            camera.Zoom = 1f;

            


            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,    
                new Rectangle(0, 150, 50, 50),    
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2),
                camera);

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");
            


            // TODO: use this.Content to load your game content here
        }
コード例 #12
0
ファイル: Game1.cs プロジェクト: rjr5838/AsteroidBeltAssault
        /// <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);

            titleScreen = Content.Load<Texture2D>(@"Textures/TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures/SpriteSheet");
            pericles14 = Content.Load<SpriteFont>(@"Fonts/Pericles14");
            starField = new StarField(this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                250,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0,450,2,2));
            asteroidManager = new AsteroidManager(10, spriteSheet, new Rectangle(0, 0, 50, 50), 20,
                                                  this.Window.ClientBounds.Width, this.Window.ClientBounds.Height);
            playerManager = new PlayerManager(spriteSheet, new Rectangle(0, 150, 50, 50), 3,
                                              new Rectangle(0, 0, this.Window.ClientBounds.Width,
                                                            this.Window.ClientBounds.Height));
            enemyManager = new EnemyManager(spriteSheet,
                new Rectangle(0,200,50,50),
                6,
                playerManager,
                new Rectangle(
                    0,0,this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(spriteSheet, new Rectangle(0, 100, 50, 50), 3,
                                                    new Rectangle(0, 450, 2, 2));

            collisionmanager = new CollisionManager(asteroidManager, playerManager, enemyManager, explosionManager);
            SoundManager.Initialize(Content);
        }
コード例 #13
0
ファイル: Game1.cs プロジェクト: jluce1996/Asteroidassault
        /// <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);

            titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
            laserpowerup = Content.Load<Texture2D>(@"Textures\laserpowerup");
            Blackhole = Content.Load<Texture2D>(@"Textures\Blackhole");

            starField = new List<StarField>();

            for (int i = 0; i < 5; i++)
            {
                starField.Add( new StarField(
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height,
                    200,
                    new Vector2(0, 30f * (float)i),
                    spriteSheet,
                    new Rectangle(0, 450, 2, 2)) );
            }

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 150, 50, 50),
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            powerupManager = new PowerupManager(laserpowerup, Blackhole, playerManager);

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager,
                powerupManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load<SpriteFont>(@"Fonts\Pericles14");

            // TODO: use this.Content to load your game content here
        }
コード例 #14
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);

            titleScreen = Content.Load <Texture2D>(@"Textures\TitleScreen");
            spriteSheet = Content.Load <Texture2D>(@"Textures\spriteSheet");

            Song song = Content.Load <Song>(@"Sounds\10 minutes of Nyan Cat!");

            MediaPlayer.Play(song);



            starField = new StarField(
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height,
                200,
                new Vector2(0, 30f),
                spriteSheet,
                new Rectangle(0, 450, 2, 2));

            asteroidManager = new AsteroidManager(
                10,
                spriteSheet,
                new Rectangle(0, 0, 50, 50),
                20,
                this.Window.ClientBounds.Width,
                this.Window.ClientBounds.Height);

            playerManager = new PlayerManager(
                spriteSheet,
                new Rectangle(0, 150, 50, 50),
                3,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            enemyManager = new EnemyManager(
                spriteSheet,
                new Rectangle(0, 200, 50, 50),
                6,
                playerManager,
                new Rectangle(
                    0,
                    0,
                    this.Window.ClientBounds.Width,
                    this.Window.ClientBounds.Height));

            explosionManager = new ExplosionManager(
                spriteSheet,
                new Rectangle(0, 100, 50, 50),
                3,
                new Rectangle(0, 450, 2, 2));

            collisionManager = new CollisionManager(
                asteroidManager,
                playerManager,
                enemyManager,
                explosionManager);

            SoundManager.Initialize(Content);

            pericles14 = Content.Load <SpriteFont>(@"Fonts\Pericles14");


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