Exemplo n.º 1
0
        public override void update()
        {
            // kill the hero at the death wall
            if (hero.getColor() != color && deathGate.Collided(hero.getPosition()))
            {
                hero.kill();
            }

            // kill any enemies at the death wall
            foreach (Enemy e in enemies)
            {
                if (e.getColor() != color && deathGate.Collided(e.getPosition()))
                {
                    e.kill();
                }
            }

            // dye the hero
            if (contains(hero.getPosition()))
            {
                hero.setColor(color);
            }

            // dye any enemies
            foreach (Enemy e in enemies)
            {
                if (contains(e.getPosition()))
                {
                    e.setColor(color);
                }
            }
        }
Exemplo n.º 2
0
        public override void update()
        {
            timer.update();
            if (timer.isDone())
            {
                enemyState = EnemyState.CHASEHERO;
            }

            switch (enemyState)
            {
            case EnemyState.BEGIN:
                moveLeft();
                break;

            case EnemyState.CHASEHERO:
                chaseHero();
                break;
            }


            if (this.getPosition().Collided(hero.getPosition()))
            {
                hero.kill();
            }

            base.update();
        }
        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;
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
 public override void update()
 {
     if (hero.getPosition().Collided(laserbeam))
     {
         hero.kill();
     }
 }
Exemplo n.º 6
0
        // fire the weapon
        public virtual void fire()
        {
            XNACS1Circle bullet = new XNACS1Circle(hero.getPosition().Center, bulletSize);

            bullet.Color = hero.getColor();
            bullets.Enqueue(bullet);
        }
Exemplo n.º 7
0
 public override void update()
 {
     if (box.Collided(hero.getPosition()) && box.Visible)
     {
         hero.collect(this);
     }
 }
Exemplo n.º 8
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);
        }
        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);
        }
Exemplo n.º 10
0
        public override void update()
        {
            foreach (DyePack p in dyepacks)
            {
                p.update();
            }

            foreach (PowerUp p in powerups)
            {
                p.update();
            }

            foreach (Debris d in debris)
            {
                d.update();
            }

            if (contains(hero.getPosition()))
            {
                trail.update();
            }
        }
Exemplo 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);
        }
Exemplo n.º 12
0
        public override void update()
        {
            // update distance
            accumulatedDistance += GameWorld.Speed;
            float heroOffset = hero.getPosition().CenterX - startPoint.X;

            float dyepackBonus = 50f * hero.dyepacksCollected();
            float powerupBonus = 50f * hero.powerupsCollected();

            float score = ((accumulatedDistance + heroOffset) / factor) + dyepackBonus + powerupBonus;

            // update textbox
            scoreBox.Label = (score).ToString("00000000.0");
        }
Exemplo n.º 13
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);
 }