I’m trying to make a pong game, but ihave problems with collision detection.
i need to get two different signals when one of the moving rectangles hits the top or bottom of the screen.
but it’s not working, i tried checking the id of what it hit but i don’t konw how.
What collision code do you have so far?
nothing, i only have the on_message function.
What tutorials have you done so far?
A good start should be the Side scroller tutorial:
you are right , i haven’t done any of the tutorials yet.
i will look into those for now, thanks for pointing out
It is possible, of course, you can for example specify different group in collisionobject below game objects representing bottom and top edges, and add those as a mask for a collisionobject under game object repressing the ball. But I think there is no need to do that in pong like game, collisions with walls should be the same for all walls or maybe bottom is below player and top above enemies? And you want to check who loses a point? Then there are another ways to that, for example you can only check for position of the ball - if it’s above the center of the screen or below when hitting wall, or just when it’s below some y that is under player (e.g. -400) and above enemy pad. Check for even more solutions in web on how to create pong like game
and of course make some tutorials, they will help you a lot, and if you will be familiar with basic “blocks” of Defold you will come with even more ideas
When you have finished the tutorials and wish to get some additional inspiration you could take a look at my Pong implementation in Defold: GitHub - britzl/pong: Defold implementation of the classic game Pong