How do I use one image use it many times as I like.
like for shooting..
can someone give me a sample code for it
Printable View
How do I use one image use it many times as I like.
like for shooting..
can someone give me a sample code for it
If this is Swing (you don't say), you can create an ImageIcon and use the ImageIcon in many locations. Or you can create a BufferedImage in many locations by drawing it in many locations.
This statement is confusing to me. Like for shooting? shooting what?Quote:
...like for shooting..
Sample code of what exactly? There are plenty of sample programs to peruse on this and other sites. What confuses you in particular?Quote:
can someone give me a sample code for it
Please clarify your question.
shooting ====>>> like space invaders it shoots laser with the same image and it moves
sample code ==>>> sample code for using the image as a shooting material that create a new image when the other first one is released.
OK. I'd use ImageIcons and pop them into whatever JLabel needs to display the image.
This is going to need to come from you I'm afraid. We'll help you work on it, but the code will need to be yours. Again, there are plenty of animation examples to be found here and in other forums, and I invite you to have a look for them, but I doubt any of the volunteers is going to want to create a new example when many good examples already exist. Also, most examples I've seen here have been generated in response to helping fix someone else's code, and I'm not sure you're at that stage yet as I'm guessing you haven't created a nearly working example yet.Quote:
sample code ==>>> sample code for using the image as a shooting material that create a new image when the other first one is released.
I already me a spacejet image that goies back and fourth using the KeyListener also it shoot one image at a time. thats the only thing I need to fixe for now. can you find me a link on a good example for it if you have time..
Thank you.