Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Shooting animation with one image

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Shooting animation with one image

    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


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Shooting animation with one image

    Quote Originally Posted by poldz123 View Post
    How do I use one image use it many times as I like.
    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.

    ...like for shooting..
    This statement is confusing to me. Like for shooting? shooting what?

    can someone give me a sample code for it
    Sample code of what exactly? There are plenty of sample programs to peruse on this and other sites. What confuses you in particular?

    Please clarify your question.

  3. #3
    Junior Member
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Shooting animation with one image

    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.

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: Shooting animation with one image

    Quote Originally Posted by poldz123 View Post
    shooting ====>>> like space invaders it shoots laser with the same image and it moves
    OK. I'd use ImageIcons and pop them into whatever JLabel needs to display the image.

    sample code ==>>> sample code for using the image as a shooting material that create a new image when the other first one is released.
    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.

  5. #5
    Junior Member
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Shooting animation with one image

    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.

Similar Threads

  1. [SOLVED] shooting fire ball 2d
    By hwoarang69 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: October 22nd, 2012, 05:27 PM
  2. [SOLVED] Simple Spaceship Shooting Game
    By bj12marion in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 20th, 2012, 08:17 AM
  3. Animation in JApplet
    By Aurin in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 14th, 2012, 10:18 AM
  4. Blender file with animation, how to import OBJ(w/ animation) into Java?
    By cr80expert5 in forum Object Oriented Programming
    Replies: 0
    Last Post: May 12th, 2011, 03:11 AM
  5. Replies: 2
    Last Post: February 14th, 2011, 05:36 PM