dimanche 12 avril 2015

How to get coordinates of an image/JLabel?

I have a game which contains a player which is a basket and fruit falling the main point is to catch the fruit. I tried getting coordinates and location of fruit but I can't get it to work. any help?


This is the code which I use to try and get coordinates but this isn't working since .getMinX will always be zero and .getMinY.. I need another way of getting coordinations or fruit image.



public static void checkCollision(BufferedImage player)
{
double fruitOneLocation = image.getMinX() & image.getMinY();
double playerLocation = player.getMinX() & player.getMinY();

Aucun commentaire:

Enregistrer un commentaire