public void PaddleHitsPowerupBubble(PongObject param1, PongObject param2) { PowerupBubble p = (PowerupBubble)param1; p.powerup.Activate(); p.IsActive = false; particles.CreateBubblePopEffect(new Vector2(p.Position.X + p.Radius, p.Position.Y + p.Radius)); }
public void CreatePowerupFastball() { PowerupBubble b = CreateBubble(); b.Texture = greenBubbleTexture; Powerup p = new Powerup(); b.P_Position = new Vector2(250, 410); b.P_Velocity = new Vector2(0, 0); b.P_Texture = fastPupTexture; b.P_Rotation = 0f; b.P_Spin = 1.0f; p.OnActivate += ActivatePowerupFastball; p.OnDeactivate += DectivatePowerupFastball; b.powerup = p; bubbles.Add(b); }
/// <summary> /// Creates a PowerupBubble, preferring to reuse a dead one in the bubbles list /// before creating a new one. /// </summary> /// <returns> /// The new bubble /// </returns> PowerupBubble CreateBubble() { PowerupBubble b = null; foreach (PowerupBubble bubble in bubbles) { if (!bubble.IsActive) { b = bubble; break; } } if (b == null) { b = new PowerupBubble(); bubbles.Add(b); } b.Position = CreateBubblePosition(); return(b); }
/// <summary> /// Collision callback for PowerupBubble and Wall /// </summary> /// <param name="param1"></param> /// <param name="param2"></param> public void BouncePowerupBubbleOffWall(PongObject param1, PongObject param2) { PowerupBubble p = (PowerupBubble)param1; p.Velocity.X *= -1.0f; }
/// <summary> /// Creates a PowerupBubble, preferring to reuse a dead one in the bubbles list /// before creating a new one. /// </summary> /// <returns> /// The new bubble /// </returns> PowerupBubble CreateBubble() { PowerupBubble b = null; foreach (PowerupBubble bubble in bubbles) { if (!bubble.IsActive) { b = bubble; break; } } if (b == null) { b = new PowerupBubble(); bubbles.Add(b); } b.Position = CreateBubblePosition(); return b; }