public OverHeatWeapon(Hero hero)
     : base(hero)
 {
     overheated = false;
     currentHeatLevel = 0;
     tempTracker = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 4, GameWorld.topEdge - 4), 4, 4);
 }
        public GameWorld()
        {
            hero = new Hero();
            player = new Player(hero);
            infoPanel = new InfoPanel(hero);
            eManager = new EnemyManager(hero);
            laser = new Laser(hero);

            stop = false;
            accelerationTimer = new Timer(15);
            SpeedReference = StartSpeed;
            Speed = SpeedReference;

            onscreen = new Queue<GameWorldRegion>();
            upcoming = new Queue<GameWorldRegion>();

            // set the enemy manager for the weapon
            hero.setEnemies(eManager.getEnemies());

            // first element on screen
            onscreen.Enqueue(new Space(hero, eManager.getEnemies(), leftEdge));

            // fill the rest of the exisiting screen
            while (onscreen.Last().rightEdge() <= rightEdge)
            {
                onscreen.Enqueue(nextElement(onscreen));
            }

            // prep upcoming elements
            upcoming.Enqueue(nextElement(onscreen));
        }
 public Obstacle(Hero hero, List<Enemy> enemies, Vector2 center, float width, float height)
 {
     this.hero = hero;
     this.enemies = enemies;
     this.box = new XNACS1Rectangle(center, width, height);
     this.box.Color = Color.SlateGray;
 }
Ejemplo n.º 4
0
        public Debris(Hero hero, List<Enemy> enemies, float minX, float maxX)
        {
            float padding = size;

            float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding);
            float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding);
            texture = new XNACS1Rectangle(new Vector2(randomX, randomY), size, size);

            switch (XNACS1Base.RandomInt(3)) {
                case 0:
                    texture.Texture = "Beak";
                    break;

                case 1:
                    texture.Texture = "Window";
                    break;

                case 2:
                    texture.Texture = "Wing2";
                    texture.Width = texture.Height * 1.8f;
                    break;
            }

            obstacle = new Obstacle(hero, enemies, texture.Center, texture.Width * .9f, texture.Height * .9f);
        }
        public Platform(int offset, Hero hero, List<Enemy> enemies, float leftEdge, bool continuous = false)
        {
            this.hero = hero;
            this.enemies = enemies;
            this.obstacles = new List<Obstacle>();

            fillPlatform(offset, leftEdge, continuous);
        }
        public SpreadFireWeapon(Hero hero)
            : base(hero)
        {
            angledBullets = new Queue<XNACS1Circle>();

            info = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 12, GameWorld.topEdge - 4), 4, 4);
            info.Color = Color.Blue;
        }
Ejemplo n.º 7
0
 public Enemy(Vector2 center, float width, float height, Hero hero)
     : base(center, width, height)
 {
     this.hero = hero;
     setColor(Game.randomColor());
     enemyState = EnemyState.BEGIN;
     timer = new Timer(behaviorChangeTime);
 }
Ejemplo n.º 8
0
 public Laser(Hero hero)
 {
     this.hero = hero;
     float height = GameWorld.topEdge - GameWorld.bottomEdge;
     float width  = 1.5f;
     float padding = 1f;
     laserbeam = new XNACS1Rectangle(new Vector2(width / 2 + padding, height / 2), width, height);
     laserbeam.Color = new Color(Color.LightSkyBlue, 100);
 }
        public Explosion(Hero h, Enemy e)
        {
            splash = new XNACS1Circle(e.getPosition().Center, splashRadius);
            timer = new Timer(duration);
            splash.Color = h.getColor();
            splash.Visible = false;
            splash.RemoveFromAutoDrawSet();

            emitter = new ExplosionEmitter(e.getPosition().Center, duration, 0.6f, h.getColor());
            emitter.DrawHalo(20);
            emitter.AutoRemoveDeadParticles = true;
        }
Ejemplo n.º 10
0
        public Bullet(Vector2 genaratePosition, Vector2 currentSpeed, float radius, Hero currentHero, List<Enemy> currentEnemy)
        {
            this.position = new XNACS1Circle(genaratePosition, radius);
            this.position.Color = Game.randomColor();
            explosions = new List<Explosion>();
            // set object into motion;

            this.alive = true;
            this.hero = currentHero;
            this.enemies = currentEnemy;
            this.speed = currentSpeed;
        }
Ejemplo n.º 11
0
        public DyePack(Hero hero, float minX, float maxX, Color color)
        {
            this.hero = hero;

            float padding = hero.getPosition().Width * 2;

            float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding);
            float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding);
            box = new XNACS1Rectangle(new Vector2(randomX, randomY), 0.865f * height, height);
            box.Color = color;
            box.Texture = getTexture(color);
        }
        public ScoreTracker(Hero hero)
        {
            this.hero = hero;
            startPoint = hero.getPosition().Center;
            factor = hero.getPosition().Width;
            accumulatedDistance = 0.0f;

            float height = GameWorld.panelSize - 1;
            float width = 20f;
            Vector2 position = new Vector2((GameWorld.rightEdge / 2) + width, GameWorld.topEdge + (GameWorld.panelSize / 2));
            scoreBox = new XNACS1Rectangle(position, width, height);
            scoreBox.Color = Color.Transparent;
            scoreBox.LabelColor = Color.White;
        }
Ejemplo n.º 13
0
        public Space(Hero hero, List<Enemy> enemies, float leftEdge)
            : base()
        {
            this.hero = hero;

            powerups = new List<PowerUp>();
            dyepacks = new List<DyePack>();
            debris = new List<Debris>();
            trail = new Trail(hero);

            float height = GameWorld.topEdge;
            float position = (width * 0.5f) + leftEdge;

            space = new XNACS1Rectangle(new Vector2(position, height/2), width, height);
            space.Visible = false;

            // add dyepacks to space region
            List<Color> colors = Game.randomColorSet(Game.colorCount);
            float rightEdge = space.CenterX + space.Width / 2;
            float region = (rightEdge - leftEdge) / dyepackCount;
            for (int i = 0; i < dyepackCount; i++)
            {
                float regionLeft = leftEdge + (i * region);
                float regionRight = regionLeft + region;
                dyepacks.Add(new DyePack(hero, regionLeft, regionRight, colors[i % Game.colorCount]));
            }

            region = (rightEdge - leftEdge) / powerupCount;
            for (int i = 0; i < powerupCount; i++)
            {
                float regionLeft = leftEdge + (i * region);
                float regionRight = regionLeft + region;
                powerups.Add(PowerUp.randomPowerUp(hero, regionLeft, regionRight));
            }

            // offset the region to pad the space before the next element
            // this makes the region slightly smaller than it actually should be otherwise
            int offset = 1;
            region = (rightEdge - leftEdge) / (debrisCount + offset);
            for (int i = 0; i < debrisCount; i++) {
                float regionLeft = leftEdge + (i * region);
                float regionRight = regionLeft + region;
                debris.Add(new Debris(hero, enemies, regionLeft, regionRight));
            }
        }
        public Stargate(Hero hero, List<Enemy> enemies, float leftEdge)
            : base()
        {
            List<Color> colors = Game.randomColorSet(GATE_COUNT);
            this.gates = new Gate[GATE_COUNT];
            for (int i = 0; i < this.gates.Length; i++)
            {
                this.gates[i] = new Gate(i, hero, enemies, leftEdge, colors[i]);
            }

            this.platforms = new Platform[GATE_COUNT + 1];
            for (int i = 0; i < this.platforms.Length; i++) {
                bool boundary = (i == 0) || (i == this.platforms.Length - 1);
                this.platforms[i] = new Platform(i, hero, enemies, leftEdge, boundary);
            }

            float height = GameWorld.topEdge;
            float Xposition = (width * 0.5f) + leftEdge;
            this.backdrop = new XNACS1Rectangle(new Vector2(Xposition, height/2), width, height);
            this.backdrop.Color = new Color(Color.Black, 130);
        }
        public InfoPanel(Hero hero)
        {
            float centerY = GameWorld.topEdge + (GameWorld.panelSize / 2);
            float centerX = GameWorld.rightEdge / 2;
            Vector2 center = new Vector2(centerX, centerY);
            background = new XNACS1Rectangle(center, GameWorld.rightEdge, GameWorld.panelSize);
            background.Color = new Color(20, 20, 20, 20);

            scoreTracker = new ScoreTracker(hero);

            meters = new List<PowerUpMeter>();

            meters.Add(SpeedUp.meter);
            meters.Add(Ghost.meter);
            meters.Add(Invincibility.meter);
            meters.Add(Overload.meter);

            foreach (PowerUpMeter p in meters)
            {
                p.reset(0, null);
            }
        }
Ejemplo n.º 16
0
        public Gate(int offset, Hero hero, List<Enemy> enemies, float leftEdge, Color color)
        {
            this.hero = hero;
            this.enemies = enemies;
            this.color = color;

            // set up pipe
            float position = (Stargate.width * 0.5f) + leftEdge;

            float drawHeight = GameWorld.topEdge / Stargate.GATE_COUNT;
            float drawOffset = drawHeight * (offset + 0.5f);

            this.path = new XNACS1Rectangle(new Vector2(position, drawOffset), Stargate.width, drawHeight - (Platform.height * 2));
            this.path.Color = new Color(color, 100);

            // gate is slightly set back from left edge to avoid killing when adjacent but not overlapping
            this.deathGate = new XNACS1Rectangle(new Vector2(leftEdge + 0.3f, path.CenterY), 0.5f, path.Height);
            this.deathGate.Color = Color.Maroon;
            deathGate.Visible = false;

            this.preview = new XNACS1Rectangle(new Vector2(GameWorld.rightEdge, drawOffset), 4f, 0f);
            this.preview.Color = this.path.Color;
            this.preview.Visible = false;
        }
Ejemplo n.º 17
0
 public Overload(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Red";
 }
Ejemplo n.º 18
0
 public Invincibility(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Pink";
 }
Ejemplo n.º 19
0
 public Ghost(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Blue";
 }
Ejemplo n.º 20
0
 public SpeedUp(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Green";
 }
Ejemplo n.º 21
0
 public Weapon2(Hero hero)
     : base(hero)
 {
     this.hero = hero;
     bullets2 = new Queue<Bullet>();
 }
Ejemplo n.º 22
0
 public SpeedUp(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Green";
 }
Ejemplo n.º 23
0
 public Overload(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Red";
 }
Ejemplo n.º 24
0
 public BrainEnemy(Vector2 center, float height, Hero currentHero)
     : base(center, height * widthToHeightRatio, height, currentHero)
 {
     this.setTexture("Brain Enemy");
 }
Ejemplo n.º 25
0
 public Ghost(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Blue";
 }
 public LimitedAmmoWeapon(Hero hero)
     : base(hero)
 {
     ammo = 10;
     ammoTracker = new XNACS1Rectangle(new Vector2(GameWorld.leftEdge + 8, GameWorld.topEdge - 4), 4, 4);
 }
 public EnemyManager(Hero hero)
 {
     this.hero = hero;
     enemies = new List<Enemy>();
     newEnemyTimer = new Timer(enemyFrequency);
 }
Ejemplo n.º 28
0
        // preload any game objects that have textures
        private static void preloadTexturedObjects()
        {
            // dont save references to any preloaded objects
            Hero preloadHero = new Hero();
            preloadHero.remove();

            Enemy preloadEnemy = new BrainEnemy(new Vector2(-100f, -100f), 0, preloadHero);
            preloadEnemy.remove();

            (new RedBeamEnemy(new Vector2(-100f, -100f), 0, preloadHero)).remove();
            (new SpiderEnemy(new Vector2(-100f, -100f), 0, preloadHero)).remove();

            (new DyePack(preloadHero, -200f, -100f, Blue)).remove();
            (new DyePack(preloadHero, -200f, -100f, Green)).remove();
            (new DyePack(preloadHero, -200f, -100f, Yellow)).remove();
            (new DyePack(preloadHero, -200f, -100f, Red)).remove();
            (new DyePack(preloadHero, -200f, -100f, Pink)).remove();
            (new DyePack(preloadHero, -200f, -100f, Teal)).remove();

            (new SpeedUp(preloadHero, -200f, -100f)).remove();
            (new Ghost(preloadHero, -200f, -100f)).remove();
            (new Overload(preloadHero, -200f, -100f)).remove();
            (new Invincibility(preloadHero, -200f, -100f)).remove();

            new Explosion(preloadHero, preloadEnemy);
        }
Ejemplo n.º 29
0
 public PowerUp(Hero hero, float minX, float maxX)
 {
     this.hero = hero;
     float padding = hero.getPosition().Width * 2;
     float randomX = XNACS1Base.RandomFloat(minX + padding, maxX - padding);
     float randomY = XNACS1Base.RandomFloat(GameWorld.bottomEdge + padding, GameWorld.topEdge - padding);
     box = new XNACS1Rectangle(new Vector2(randomX, randomY), width, width * 0.39f);
 }
Ejemplo n.º 30
0
 public static PowerUp randomPowerUp(Hero hero, float minX, float maxX)
 {
     switch (XNACS1Base.RandomInt(4))
     {
         case 0:
             return new SpeedUp(hero, minX, maxX);
         case 1:
             return new Ghost(hero, minX, maxX);
         case 2:
             return new Invincibility(hero, minX, maxX);
         default:
             return new Overload(hero, minX, maxX);
     }
 }
Ejemplo n.º 31
0
 public Weapon(Hero hero)
 {
     this.hero = hero;
     bullets = new Queue<XNACS1Circle>();
     explosions = new List<Explosion>();
 }
Ejemplo n.º 32
0
 public Player(Hero hero)
 {
     this.hero = hero;
 }
Ejemplo n.º 33
0
 public Invincibility(Hero hero, float minX, float maxX)
     : base(hero, minX, maxX)
 {
     box.Texture = "PowerUp_Pink";
 }