public static void AddObject(String Type, PongObject Obj) { if (!Objects.ContainsKey(Type)) { Objects.Add(Type, new LinkedList<PongObject>()); } Objects[Type].AddLast(Obj); }
public static bool RemoveObject(String Type, PongObject Obj) { return Objects[Type].Remove(Obj); }
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)); }
/// <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> /// Collision callback for Ball and Wall /// </summary> /// <param name="param1"></param> /// <param name="param2"></param> public void BounceBallOffWall(PongObject param1, PongObject param2) { Ball b = (Ball)param1; Wall w = (Wall)param2; b.Velocity.X = -b.Velocity.X; particles.CreateDefaultCollisionEffect(new Vector2(b.Position.X + b.Radius, b.Position.Y + b.Radius)); //pew }
/// <summary> /// Collision callback for Ball and Paddle /// </summary> /// <param name="param1"></param> /// <param name="param2"></param> public void BounceBallOffPaddle(PongObject param1, PongObject param2) { Ball b = (Ball)param1; Paddle p = (Paddle)param2; //TODO: incorporate spin and also whether or not we hit the rounded part b.Velocity.Y = -b.Velocity.Y; particles.CreateDefaultCollisionEffect(new Vector2(b.Position.X + b.Radius, b.Position.Y + b.Radius)); //Sound pong or ping here }