public override void ProcessCollisions(InteractiveGameObject CollidingObject, GameTime gameTime) { if (CollidingObject is Brick) { this.IsActive = false; } }
public override void ProcessCollisions(InteractiveGameObject CollidingObject, GameTime gameTime) { if (CollidingObject is Bullet) { BrickLevel--; CollisionLogic(); return; } if (CollidingObject is Ball ball) { //multi break should destroy the brick regardless of level if (ball.MultiBrickBreak) { for (int i = BrickLevel; i > 0; i--) { CurrentGame.Score += 10; } BrickLevel = 0; } else { CurrentGame.Score += 10; BrickLevel--; } CollisionLogic(); } }
public override void ProcessCollisions(InteractiveGameObject CollidingObject, GameTime gameTime) { //this got annoying really fast //if(CollidingObject is Ball) //{ // Console.Beep(); //} }
public override void ProcessCollisions(InteractiveGameObject CollidingObject, GameTime gameTime) { if (CollidingObject is Slider slider) { var sliderPartLength = slider.Sprite.Width / 3; var ballLeft = this.Sprite.Left.Point.X; var ballRight = this.Sprite.Right.Point.X; var sliderLeft = slider.Sprite.Left.Point.X; var sliderRight = slider.Sprite.Right.Point.X; if (ballRight >= sliderLeft && ballLeft < sliderLeft + sliderPartLength) { this.CurrentDirection = Direction.UpLeft; } else if (ballLeft <= sliderRight && ballRight > sliderRight - sliderPartLength) { this.CurrentDirection = Direction.UpRight; } else { this.CurrentDirection = Direction.Up; } } if (CollidingObject is Brick && !MultiBrickBreak) { switch (this.CurrentDirection) { case Direction.Up: this.CurrentDirection = Direction.Down; break; case Direction.UpLeft: this.CurrentDirection = Direction.DownLeft; break; case Direction.UpRight: this.CurrentDirection = Direction.DownRight; break; case Direction.Down: this.CurrentDirection = Direction.Up; break; case Direction.DownRight: this.CurrentDirection = Direction.UpRight; break; case Direction.DownLeft: this.CurrentDirection = Direction.UpLeft; break; } } }
public override void ProcessCollisions(InteractiveGameObject CollidingObject, GameTime gameTime) { if (CollidingObject is Slider) { //Handover whatever power up effect we have to the objects impacted by it. var effectedObjects = GameObjectCollection.GetActive <T>(); foreach (var obj in effectedObjects) { foreach (var effect in this.PowerUpEffects) { if (obj.PowerUpEffects.All(x => x.PowerUpEffectAction != effect.PowerUpEffectAction)) { obj.PowerUpEffects.Add(effect); CurrentGame.Score += 25; } } } this.IsActive = false; } }
public abstract void ProcessCollisions(InteractiveGameObject CollidingObject, GameTime gameTime);