Esempio n. 1
0
 private void AddTree()
 {
     Animations treeAnimation = new Animations();
     Vector2 position;
     int r = random.Next(0, 3);
     if (r == 0)
     {
         treeAnimation.Initialize(tree1Texture, Vector2.Zero, 160, 227, 1, 60, Color.White, 1f, true, 1);
         position = new Vector2(GraphicsDevice.Viewport.Width + tree1Texture.Width + random.Next(0, 150), (GraphicsDevice.Viewport.Height - ground) - tree1Texture.Height / 2);
     }
     else if(r == 1)
     {
         treeAnimation.Initialize(tree2Texture, Vector2.Zero, 124, 220, 1, 60, Color.White, 1f, true, 1);
         position = new Vector2(GraphicsDevice.Viewport.Width + tree2Texture.Width + random.Next(0,150), (GraphicsDevice.Viewport.Height - ground) - tree2Texture.Height / 2);
     }
     else {
         treeAnimation.Initialize(tree3Texture, Vector2.Zero, 128, 250, 1, 60, Color.White, 1f, true, 1);
         position = new Vector2(GraphicsDevice.Viewport.Width + tree3Texture.Width + random.Next(0, 150), (GraphicsDevice.Viewport.Height - ground) - tree3Texture.Height / 2);
     }
     tree Tre = new tree();
     Tre.Initialize(treeAnimation, position);
     tree.Add(Tre);
 }
Esempio n. 2
0
 private void AddExplosion(Vector2 position)
 {
     Animations explosion = new Animations();
     explosion.Initialize(explosionTexture, position, 134, 134, 12, 60, Color.White, 1f, false, 1);
     explosions.Add(explosion);
 }
Esempio n. 3
0
 private void AddEnemy()
 {
     Animations enemyAnimation = new Animations();
     enemyAnimation.Initialize(enemyTexture, Vector2.Zero, 178, 60, 1, 60, Color.White, 1f, true, 1);
     Vector2 position = new Vector2(GraphicsDevice.Viewport.Width + enemyTexture.Width, random.Next(50, GraphicsDevice.Viewport.Height - 350));
     Enemy enemy = new Enemy();
     enemy.Initialize(enemyAnimation, position);
     enemies.Add(enemy);
 }
Esempio n. 4
0
        protected override void LoadContent()
        {
            
            spriteBatch = new SpriteBatch(GraphicsDevice);


            Animations playerAnimation = new Animations();
            Texture2D playerTexture = Content.Load<Texture2D>("plane3");
            playerAnimation.Initialize(playerTexture, Vector2.Zero, 164, 55, 6, 20, Color.White, 1f, true, 1);
            playerPosition = new Vector2(170, 155);

            player.Initialize(playerAnimation, playerPosition);

            enemyTexture = Content.Load<Texture2D>("f16");

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

            tree1Texture = Content.Load<Texture2D>("treeA");
            tree2Texture = Content.Load<Texture2D>("treeB");
            tree3Texture = Content.Load<Texture2D>("treeC");

            lampaon = Content.Load<Texture2D>("lampaon");
            lampaoff = Content.Load<Texture2D>("lampaoff");
            recLamp = new Rectangle(30, 500, 70, 70);

            sky = Content.Load<Texture2D>("sky");

            BACKGROUNDS = new AllBackground(this.Content, player);
        }