예제 #1
0
        public override void move(Vector2 _point)
        {
            vector    = GameStaff.countUnitVector(_point, coordinates);
            vector.X *= (float)speed;
            vector.Y *= (float)speed;

            coordinates.X += vector.X;
            coordinates.Y += vector.Y;
        }
예제 #2
0
        public Bullet(Vector2 _vector, double _damage, Texture2D _texture, double _collisionRadius, float _speed)
            : base(_vector, _damage, _texture, _collisionRadius)
        {
            visibility = true;
            Random     random       = new Random();
            MouseState state        = Mouse.GetState();
            Vector2    recoilVector = new Vector2((float)random.Next(10) / 100, (float)random.Next(10) / 100);

            vector    = GameStaff.countUnitVector(new Vector2(state.X, state.Y), coordinates);
            vector   += recoilVector;
            vector.X *= _speed;
            vector.Y *= _speed;
        }
예제 #3
0
        public void move()
        {
            MouseState state         = Mouse.GetState();
            Vector2    mousePosition = new Vector2(state.X, state.Y);

            vector = GameStaff.countUnitVector(new Vector2(state.X, state.Y),
                                               new Vector2(coordinates.X, coordinates.Y));

            Vector2 direction = mousePosition - coordinates;

            rotationAngle = (float)Math.Atan2(direction.Y, direction.X);

            bullets.ForEach(delegate(Bullet bullet)
            {
                bullet.move();
            });
        }