コード例 #1
0
ファイル: Game1.cs プロジェクト: kieranbreen66/LCCSTANKGAME
 private void AddExplosion(Vector2 position)
 {
     Animation explosion = new Animation();
     explosion.Initialize(explosionTexture, position, 134, 134, 12, 45, Color.White, 1f, false);
     explosions.Add(explosion);
     explosionSound.Play(0.2f, 0, 0);
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: kieranbreen66/KieranTesting
        /// <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);

            projectileTexture = Content.Load<Texture2D>("CannonBall");

            //Texture2D playerTexture = Content.Load<Texture2D>("Tank");

            // Load the player resources
            Animation playerAnimation = new Animation();
            playerAnimation.Active = false;

            Texture2D playerTexture = Content.Load<Texture2D>("TankSheetNoCannon");
            playerAnimation.Initialize(playerTexture,Vector2.Zero,75,60,3,100,Color.White,1f,true);

            // Load the player resources
            Vector2 playerPosition = new Vector2(ScreenWidth - playerAnimation.FrameWidth, ScreenHeight - playerAnimation.FrameHeight);
               //Vector2 playerPosition = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.X, GraphicsDevice.Viewport.TitleSafeArea.Y + GraphicsDevice.Viewport.TitleSafeArea.Height / 2);
            //player.Initialize(playerTexture, playerPosition);
            player.Initialize(playerAnimation, playerPosition);
            player.Cannon = Content.Load<Texture2D>("TankCannon");

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

            textures = new List<Texture2D>();
            textures.Add(Content.Load<Texture2D>("smokeTexture"));
            textures.Add(Content.Load<Texture2D>("smokeTexture2"));
            textures.Add(Content.Load<Texture2D>("smokeTexture3"));
            textures.Add(Content.Load<Texture2D>("smokeTexture4"));

            projectileTexture = Content.Load<Texture2D>("missile");

            explosionTexture = Content.Load<Texture2D>("Explosion");

            explosionSound = Content.Load<SoundEffect>("explosionSound");
            tankFire = Content.Load<SoundEffect>("tankFire");
            background = Content.Load<Texture2D>("background");
            wall = Content.Load<Texture2D>("wall");

            wallPosition = new Vector2((ScreenWidth / 2) - (wall.Width / 2), ScreenHeight - wall.Height);

            // Create a bounding box for the wall object
            wallBox = new BoundingBox();
            wallBox.Max.X = wallPosition.X + wall.Width;
            wallBox.Max.Y = ScreenHeight;
            wallBox.Min.X = wallPosition.X;
            wallBox.Min.Y = ScreenHeight - wall.Height;

            // Load the player resources
            Animation playerAnimation1 = new Animation();
            playerAnimation1.Active = false;

            Texture2D playerTexture1 = Content.Load<Texture2D>("TankSheetNoCannon");
            playerAnimation1.Initialize(playerTexture1,Vector2.Zero,75,60,3,100,Color.White,1f,true);

            // Load the player resources
            Vector2 playerPosition1 = new Vector2(ScreenWidth - playerAnimation1.FrameWidth, ScreenHeight - playerAnimation1.FrameHeight);
            player1.Initialize(playerAnimation1, playerPosition1,Player.Orientation.facesLeft);
            player1.Cannon = Content.Load<Texture2D>("TankCannon");

            // Load the player resources
            Animation playerAnimation2 = new Animation();
            playerAnimation2.Active = false;

            Texture2D playerTexture2 = Content.Load<Texture2D>("TankSheetNoCannon");
            playerAnimation2.Initialize(playerTexture2, Vector2.Zero, 75, 60, 3, 100, Color.White, 1f, true);

            // Load the player resources
            Vector2 playerPosition2 = new Vector2(0, ScreenHeight - playerAnimation2.FrameHeight);
            player2.Initialize(playerAnimation2, playerPosition2, Player.Orientation.facesRight);
            player2.Cannon = Content.Load<Texture2D>("TankCannon");

            //Projectile.LoadContent(Content);

            soundtrack = Content.Load<Song>("SlugAssault");
            MediaPlayer.IsRepeating = true;
        }