Manage collisions without having a goalPoint?

Hi, trying to make a Pong clone here!
I'm new to Lua dev and a noob in general, I wanted to make the ball bounce when it's colliding with the player bar, but I don't really know how to do that since all the functions to manage collisions seem to need a goalPoint and the ball doesn't have one, it has only a direction and a speed. Can someone help me pls :heart:

Hi @solomon.squek
I've been slowly hacking on a Pong clone too :wink: as a means to learn Playdate development.
You might like my thread here: Pongdate - two-player Pong built with the SDK
I talk about how I used the collision system.

But maybe to answer your question directly, if you have a current position, direction, and speed, then that gives you the next "goal" for the ball... or where it's going, which maybe maps into the collision examples you're looking at?

In my Pong, I used moveWithCollisions which seemed to work and match my expectations.

Happy to answer more specific questions too! Good luck!

2 Likes