Exemplo n.º 1
0
        public void Reset()
        {
            int x = rand.Next(1, game.map.Width - 2);
            int y = rand.Next(1, game.map.Height - 2);

            position = RectangleExtensions.GetBottomCenter(game.map.GetBounds(x, y));
            //position = new Vector2(100, 100);
            health     = 200;
            shootWait  = 0.0f;
            isShooting = false;
            isRunning  = false;
            //Position = position;
            Velocity = Vector2.Zero;
            isAlive  = true;

            //mousePosition = position;
            Mouse.SetPosition((int)position.X, (int)position.Y);
            sprite.PlayAnimation(idleAnimation);
        }
Exemplo n.º 2
0
        public Enemy(Game game, Random rnd)
        {
            this.game = game;
            int x = rnd.Next(1, game.map.Width - 2);
            int y = rnd.Next(1, game.map.Height - 2);
            //LoadEnemyTile(x, y, "Zombie");
            Vector2 position = RectangleExtensions.GetBottomCenter(game.map.GetBounds(x, y));

            this.position = position;
            direction     = (float)rnd.NextDouble() * MathHelper.TwoPi;
            this.velocity = new Vector2((float)Math.Cos(direction), (float)Math.Sin(direction));
            velocity.Normalize();
            this.health  = 1000;
            this.isAlive = true;
            behaviors    = new Dictionary <EnemyType, Behaviors>();
            MoveSpeed    = 0.1f;
            //BuildBehaviors();
            //LoadContent("Default");
        }