public bool CheckCollision(Meteor otherMeteor)
 {
     var spriteRect = new Rectangle((int)Position.X, (int)Position.Y, CurrentFrame.Width, CurrentFrame.Height);
     return otherMeteor.CheckCollision(spriteRect);
 }
Exemplo n.º 2
0
        public void Bounce(Meteor meteor)
        {
            XSpeed = XSpeed*-1;
            YSpeed = YSpeed*-1;

            if (position.X < meteor.position.X)
            {
                // Left
                position.X = meteor.position.X - currentFrame.Width;
            }
            else
            {
                // Right
                position.X = meteor.position.X + meteor.currentFrame.Width;
            }
        }
        public void Bounce(Meteor meteor)
        {
            XSpeed = XSpeed * -1;
            YSpeed = YSpeed * -1;

            if (Position.X < meteor.Position.X)
            {
                // Left
                Position = new Vector2(meteor.Position.X - CurrentFrame.Width, Position.Y);
            }
            else
            {
                // Right
                Position = new Vector2(meteor.Position.X + meteor.CurrentFrame.Width, Position.Y);
            }
        }
 private void AddNewMeteor()
 {
     Meteor newMeteor = new Meteor(Game, ref meteorTexture);
     meteors.Add(newMeteor);
     newMeteor.Index = meteors.Count - 1;
 }