Beispiel #1
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();
        }
Beispiel #2
0
 public override void update()
 {
     if (hero.getPosition().Collided(laserbeam))
     {
         hero.kill();
     }
 }
Beispiel #3
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);
                }
            }
        }