Exemple #1
0
        public void Update(Survivor survivor)
        {
            float   distance = Vector2.Distance(Position, survivor.Position);
            Vector2 diff     = survivor.Position - Position;

            Rotation = (float)Math.Atan2(diff.Y, diff.X);
            diff.Normalize();

            if (distance > 100)
            {
                Position += diff * speed;
            }
        }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            ms          = Mouse.GetState();
            random      = new Random();
            survivor    = new Survivor(new Vector2(500, 500), Content.Load <Texture2D>("pistol"), Content.Load <Texture2D>("BulletMegaE433"), Color.White);
            AimReticle  = new Sprite(new Vector2(ms.X, ms.Y), Content.Load <Texture2D>("Aim"), Color.White, 0.5f);
            Background  = Content.Load <Texture2D>("Background");
            zombie      = new List <Zombie>();
            Font1       = Content.Load <SpriteFont>("Font");
            Heart       = Content.Load <Texture2D>("McHeart");

            for (int i = 0; i < 10; i++)
            {
                SpawnZombie();
            }



            // TODO: use this.Content to load your game content here
        }