예제 #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);
        }
예제 #2
0
파일: Enemy.cs 프로젝트: bojank/zombiezoid
        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");
        }