예제 #1
0
 private void AddEnemy()
 {
     Enemy e = new Enemy();
     e.Initialize(new Vector2(random.Next(graphics.GraphicsDevice.Viewport.Width - enemyText.Width+ 1), 0), enemyText, new Vector2(0, 1), EnemySpeed, true, EnemyState.Falling);
     enemys.Add(e);
 }
예제 #2
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);

            enemy = new Enemy(new Sprite(Content.Load<Texture2D>("sprites/addexisting"), new Vector2(500, 0)), 10);
            enemy2 = new Enemy(new Sprite(Content.Load<Texture2D>("sprites/addexisting"), new Vector2(200.0f, 50)), 25);

            // Loading the background
            mBackgroundOne = new Sprite(Content.Load<Texture2D>("background/Background01"), new Vector2(0, 0), 1.05f);
            mBackgroundTwo = new Sprite(Content.Load<Texture2D>("background/Background02"), new Vector2(mBackgroundOne.Position.X + mBackgroundOne.Size.Width, 0), 1.05f);
            mBackgroundThree = new Sprite(Content.Load<Texture2D>("background/Background03"), new Vector2(mBackgroundTwo.Position.X + mBackgroundTwo.Size.Width, 0), 1.05f);
            mBackgroundFour = new Sprite(Content.Load<Texture2D>("background/Background04"), new Vector2(mBackgroundThree.Position.X + mBackgroundThree.Size.Width, 0), 1.05f);
            mBackgroundFive = new Sprite(Content.Load<Texture2D>("background/Background05"), new Vector2(mBackgroundFour.Position.X + mBackgroundFour.Size.Width, 0), 1.05f);

            // TODO: use this.Content to load your game content here
            fighter.LoadContent(this.Content);
        }