This is homework. Please do not write my code for me. I did look for this but only found things related to buttons or making a background, none of which had the answers I needed.
I have been working on a game. The game has some images floating around and you have to shoot them and then collide with them to eat them. I am trying to make the image change when you shoot them so that the player knows they can eat them. I tried using a variable that would contain the string which would be the location of the image and then setting that variable as a different string when the object is shot but that didn't work so well. I think my issues are somewhere in declaring my targets image and the fact that they are in a for loop when I try to change the image. I would post that failed attempt but it was seriously just an image name String variable and in my processCollision method I changed the String to the other image. The entire code is in my last thread but I can post it again if needed. Also let me know of anything else that you may need from me. Any and all help is appreciated! Thanks in advance!

Recommended Answers

All 2 Replies

I tried using a variable that would contain the string which would be the location of the image and then setting that variable as a different string when the object is shot but that didn't work so well

Why use a String instead of a class containing ints to hold the object's location.

Can you explain what your problem is?

agreed with @NormR1...

don't forget for that that Image and ImageIcon are too heavy for GPU, RAM and CPU

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.