• Post Reply Bookmark Topic Watch Topic
  • New Topic

Shooting bullets

 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I would like to have a bullet named (bullet.png) in which if you press space the graphic is painted in the initial player x. which is defined
 
Knute Snortum
Sheriff
Posts: 3257
83
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your specific question?
 
Alaric Mustoe
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would I do that what I know so far is to key bind space into a key listener which then triggers the animation so how would I do that.
 
Knute Snortum
Sheriff
Posts: 3257
83
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let's move this to the Swing forum. Maybe it will get a better response there.
 
Les Morgan
Rancher
Posts: 717
17
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alaric,
you make a class for your bullets and let them move themselves in the animation loop.

That includes the image you wish to use for the bullets--each bullet should paint itself onto the graphics context. You should have a movement method for the classs, and you should also have a shape for the bullet so you can use the Shape interface to check hit/miss.
Les
Alaric Mustoe wrote:How would I do that what I know so far is to key bind space into a key listener which then triggers the animation so how would I do that.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!