From where does the game engines add location of an object?


Posted by: Player on 08/21/2015 | Add Revision

I have started making my first game( a pong game )with ruby (Gosu). I'm trying to detect the collision of two images using their location by comparing the location of the object (a ball) to another one(a player).

For example:

if  (@player.x - @ball.x).abs <=184 && (@player.y - @ball.y).abs <= 40
            @ball.vx = -@ball.vx
            @ball.vy = -@ball.vy

But my problem is that with these numbers, the ball collides near the player sometimes, even though the dimensions of the player are correct.

So my question is from where does the x values start to count? Is it from the center of gravity of the image or from the beginning of the image? (i.e When you add the image on a specific x,y,z what are these values compared to the image?

Visit Website