getx and gety mouseClick stuff
Hi, I'm new here so don't flame me for being a newb or something.
So I learned a little bit of Java and C++ in my computer science class and I decided to write make a game for computer club. It is a tower defense game.
I'm 99% finished with it, the one last thing that I have to do is find a way to get the x and y coordinates of where the user last clicked. That's it. I already have the functions set up to buy, place, upgrade, and sell towers determined on where the user clicked on the screen, all I need is an easy way to input the x and y.
I've been searching for an easy solution to this all afternoon, and what I have found is that it there needs to be an object like a rectangle to click on and it will be able to tell where the user clicked on that object. But I wrote my code in a very linear format, that is, I haven't learned how to use object oriented code yet, soo instead of having each individual thing on screen realize that you clicked on it, the program is supposed to search to see if the x and y coordinates of the last mouse click lie within any of the objects on screen.
I understand that to make this work I need to have a transparent rectangle drawn over everything so that the program can tell exactly where you clicked on that rectangle. but I don't know how to do that, and any transparent stuff that I have tried just ends up making the whole screen white.
do any of you know a quick fix for this? that is, something that won't have me rewriting my whole program just to make it work. Thanks in advance for your help. :)