Java Game Development #10 – Shooting Bullets!

Complete Java Game Development Course now available at my website

In this video we learn how to add bullets into our game that the player can shoot. If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

Link to the beginning video-

Have you ever wanted to create games? Have you ever gotten fed up with it being to difficult? Well now is the time to thank me and possibly subscribe because you have just found the channel for you! Game Maker Tutorials, Java Game Programming, Unity3D Tutorials, Batch, C++ and much much more! This is the channel for you, the one stop shop for an exploration of your hidden talent as a game developer. Unleash your potential and go wild with imagination when you finally figure out how to make any game you want!

Visit CodingMadeSimple for more exclusive tutorials and get the help you need to succeed as your very own indie game developer!

Follow me on twitter for exclusive content and interaction with me!

Game Maker Studio: Programming
Game Maker Studio: Tutorial
Java Programming
Game Programming
Game Tutorial
Programming Tutorial






24 responses to “Java Game Development #10 – Shooting Bullets!”

  1. Shikhar Mainalee Avatar

    So you say you are going to reply to the comments?


  2. fawad jamil Avatar

    plzzzz…… up the sprite sheet on your website, mine doest show the space ship…pllllllzllllzllzlzlzlzlzlzlz

  3. Starlin Urena Avatar

    is shooting nut not from the plane but from another part of my applet, I ave an Sprite class and an Animation class do i need sets and gets for my sprite class if i do how would i do that so i can called in my main game where in keypresses i have this: if(xPressed)
    bullet b = new bullet(getX(), getY(), this);

  4. Starlin Urena Avatar

    does your sprite sheet class has a grab image method ?

  5. RichyK1 Avatar

    Awesome series, gj

  6. Gameriffy Avatar

    can i have the source code cuz it dosen't want to work for me

  7. ContainsCaffeine Avatar

    is there a way to control the number of bullets on the screen??

  8. LegendOfZeldaOOT Avatar

    can I shoot more than 1 bullet?

  9. LegendOfZeldaOOT Avatar

    Is there a way to shoot multiple bullets out at one time?

  10. hemang vyas Avatar

    getting error in controller section b.get(i)
    here is code: and error:

  11. BetaTraps Avatar

    Thanks man this helped a lot. Teacher making me do this in VB which sucks i prefer java but this video helped me solve my problems. Thanks so much.

  12. space1188 Avatar

    Where is the addBullet coming from. im confused

  13. Nevin Rhymer Avatar

    Great Job man! I learn so much in 1 day watching these tutorials. with some editing you can create bullets and missiles

  14. longboardcreator Avatar

    does anyone have the code for this project they can post?

  15. plusBlindfold Avatar

    "Programming stallions galloping through the lines of code." – I lost it there 😀

  16. Aleksey Alekseev Avatar

    Thank you, PAL, I`m learning Java with you tutorials, along with Stanford online course and Java A Beginner's Guide Herbert Schildt! Can you recommend some free online courses, or to read something? What about real 3D games? Can you learn us to create one?

  17. Game Job Avatar

    Thanks that help my game alot

  18. ablougabla Avatar

    Nice tutorial homie. If anyone's having trouble getting the bullets to load/they're traveling too fast to see, the reason's likely because our computers are too slow to keep up with the frame rate too see the bullet. I decided to help realtuts out and develop a patch:
    In the tick method in the class Bullet, set y -= -velY;
    Then create a new method in Bullet:

    public void setVelY(double velY){
    this.velY = velY; 

    Next, go to the keyPressed method in the Game class. Change the else if{..} for the space bar:

    else if (key == KeyEvent.VK_SPACE){
    Bullet k = new Bullet(p.getX(), p.getY(), this);

    Setting it to 8 might be alittle slow but that's just a preference, change it at will. Happy coding fam.

  19. Fedegas Avatar

    I liked it and I learned something! lol 🙂

  20. Ivar Eriksson Avatar

    Jesus Christ, thank you, this helped

  21. Hunter Jackson Avatar

    Okay so I noticed something, and I don't know if it was stated in the comments. If you shoot two bullets out at once, since TempBullet = b.get(i); it doesn't remove the FIRST bullet you fire. TempBullet is the latest bullet fired, and so it scans only that one. The other bullets you may shoot continue to fly offscreen and do not delete themselves. I believe its because the for loop runs.. lets say you fired two bullets. It runs once for the first one, reads that the if statements are false, goes on to the next and focuses on that one instead. Any ideas on how to fix this?

  22. RestLess PvP Avatar

    On Line 17? It says tick is undefined for the type bullet? Help anyone

  23. Chatura Lashanka Avatar

    i can not get the bullets to shoot, the code does not have errors..

  24. Eddie Symons Avatar

    How do you memorize built in java classes?
    And how do you know what to add when?
    I understand the basic concepts of java, just kinda struggling to learn those things.

Leave a Reply

Your email address will not be published. Required fields are marked *