0

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!

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by mKorbel
0

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?

0

agreed with @NormR1...

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.