Example #1
0
 // Initialize an Enemy
 public Enemy(FlyingWizardGame root, Vector2 position, float projectileCoolDownTime = 1.0f, float spriteWidth = 64.0f) : base(position, 2, 0.5f)
 {
     // Initialize values
     this.root               = root;
     this.SpriteWidth        = spriteWidth;
     this.projectileCoolDown = new Timer(projectileCoolDownTime);
 }
Example #2
0
        // Initialize a player
        public Player(FlyingWizardGame root, Vector2 position) : base(position)
        {
            this.root               = root;
            this.SpriteWidth        = 64.0f;
            this.NumberOfFrames     = 2;
            this.projectileCoolDown = new Timer();

            LoadContent();
        }
Example #3
0
        // Initialize a column
        public EnemyColumn(FlyingWizardGame root, int numberOfEnemies, float spaceBetween, float topBound, float xSpeed, float ySpeed, float enemyWidth, Texture2D spriteImage)
        {
            // Set game root
            this.root = root;

            // Create an example sprite for calculations
            Enemy example = new Enemy(root, new Vector2(0, 0), 3.0f, enemyWidth);

            example.SpriteImage = spriteImage;

            // Calculate initial values
            this.xSpeed       = -xSpeed;
            this.ySpeed       = ySpeed;
            this.columnTop    = topBound;
            this.columnBottom = topBound + numberOfEnemies * (example.SpriteHeight + spaceBetween);

            // Create the list of Enemy objects
            enemies = new List <Enemy>();
            for (int i = 0; i < numberOfEnemies; i++)
            {
                // Calculate Enemy Coordinates
                float xPosition = root.ScreenWidth;
                float yPosition = topBound + i * (example.SpriteHeight + spaceBetween);

                // Create the new Enemy and set some values
                Enemy nextEnemy = new Enemy(root, new Vector2(xPosition, yPosition), 3.0f, enemyWidth);
                nextEnemy.VelocityX = this.xSpeed;
                nextEnemy.VelocityY = this.ySpeed;

                // Add the Enemy to the list
                enemies.Add(nextEnemy);
            }

            // Set the sprite image for all Enemy objects
            this.SpriteImage = spriteImage;
        }
Example #4
0
 static void Main()
 {
     using (var game = new FlyingWizardGame())
         game.Run();
 }