Exemplo n.º 1
0
        public Projectile(Texture2D projectileTex, Vector2 pos, Vector2 speed, Vector2 direction, int maxDistance, int damage, MapManager map) : base(pos)
        {
            this.projectileTex = projectileTex;
            this.pos           = pos;
            this.speed         = speed;
            this.damage        = damage;
            this.direction     = direction;
            this.maxDistance   = maxDistance;
            this.map           = map;

            //explosionFrameTimer = 120;
            //explosionFrameInterval = 120;
            //explosionFrame = 0;
            //numberOfExplosionFrames = 3;
        }
Exemplo n.º 2
0
        public Player(Vector2 pos, Rectangle hitBox, Camera camera, Game1 game, MapManager map, GameWindow window, ProjectileManager projectileManager) : base(pos)
        {
            this.window            = window;
            this.pos               = pos;
            this.camera            = camera;
            this.projectileManager = projectileManager;
            this.game              = game;
            this.map               = map;

            standardPlayerSpeed = 120;
            invincibleTimer     = 8;
            speedBoostTimer     = 8;
            dashTimer           = 2f;
            dashCooldown        = 2f;
            reloadTimer         = 1.5f;
            reloadTime          = 1.5f;
            deathAnimationTimer = 3.8f;
            readyToDash         = true;
            reloading           = false;
            speedBoosted        = false;
            invincibleBoosted   = false;
            doDeathAnimation    = false;
            gameOver            = false;

            dashSpeed       = new Vector2(200, 200);
            projectileSpeed = new Vector2(500, 500);
            this.hitBox     = hitBox;
            activeWeapon    = weapon.pistol;

            frameTimer           = 60;
            frameInterval        = 60;
            frame                = 0;
            numberOfFrames       = 9;
            frameWidth           = 64;
            sourceRect           = new Rectangle(0, 0, 64, 64);
            healthbarSource      = new Rectangle(0, 45, healthbarWidth, healthbarHeight);
            healthbarEdgesSource = new Rectangle(0, 0, healthbarWidth, healthbarHeight);

            CheckActiveWeapon();
            if (activeWeapon == weapon.assaultRifle)
            {
                ammoCapacity = 30;
                reloadTime   = 2.0f;
                reloadTimer  = 2.0f;
                maxDistance  = 600;
            }
            else if (activeWeapon == weapon.sniperRifle)
            {
                damage          = 50;
                ammoCapacity    = 5;
                reloadTime      = 3.0f;
                reloadTimer     = 3.0f;
                projectileSpeed = new Vector2(1000, 1000);
                maxDistance     = 2000;
            }
            else if (activeWeapon == weapon.pistol)
            {
                CheckActiveWeapon();
                ammoCapacity = 8;
                reloadTime   = 0.1f;
                reloadTimer  = 1.5f;
                maxDistance  = 350;
            }
        }