Java Game Development #11 – Background and Glitch Fix

[ad_1]
Complete Java Game Development Course now available at my website

In this video we learn how to add a background into our game and fixing some glitches. 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.

Outro Song:
Name: Spitfire (Kill the Noise Remix)
Artist: Porter Robinson
Youtube channel: /user/PorterRobinsonMusic
Website:
Facebook:

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


Posted

in

by

Tags:

Comments

36 responses to “Java Game Development #11 – Background and Glitch Fix”

  1. The Patchy Avatar

    that that that comments tho tho tho

  2. Lost Feelings Avatar

    I have found a way to fix the movement, its a bit longer, but it works:

    public void keyReleased(KeyEvent e){
    int key= e.getKeyCode();

    if(key ==KeyEvent.VK_RIGHT){
    if(p.getVelX()>0)
    p.setVelX(0);
    } else if(key ==KeyEvent.VK_LEFT){
    if(p.getVelX()<0)
    p.setVelX(0);
    } else if(key ==KeyEvent.VK_DOWN){
    if(p.getVelY()>0)
    p.setVelY(0);
    } else if(key ==KeyEvent.VK_UP){
    if(p.getVelY()<0)
    p.setVelY(0);
    }
    }

  3. Valter Zamuner Avatar

    I've tried to fix some glitches with the ship control but failed… Basically when i go to an opposite direction the player freeze completely or stop for some moments. Is there a way to make the program constantly check if the keys are pressed or not, rather then just get a value the moment is pressed or released?

  4. Agus Roth Avatar

    I used Nyan Cat background 😀

    Nice video

  5. mourad mamassi Avatar

    I think for variable is shooting we don't have to make because if we make the test for KeyEvent.VK_SPACE in KeyReleased the problem will be resole

  6. Nhaselton Avatar

    Why, why r u singing

  7. MultiDevan13 Avatar

    that beep scared the shit out me!1

  8. Yuankun Luo Avatar

    Haha. Begin with robot vpice. Hhhhhaaaaa

  9. Shariq Dharani Avatar

    after doing this i cant get my images to show up on top of the background

  10. shahwar Ahmed Avatar

    Insted of fixing it like that, u could have just not do anything for VK_SPACE in the keyPressed and and type if(key==e.getkeyCode.VK_SACE){
    c.addBullet(new Bullet(p.getX(),p.getY(),this));}

  11. Roey M Avatar

    Can my background image be a GIF?

  12. Guacamole6256 Avatar

    Alright, I want to ask you a question, as a person who just a week ago found this and got really interested in making a game.
    Everything is working great, thank you so much for the help. However there is one thing I want in the game that I in my unprofessional mind cannot find/understand.
    I wish for help to make it so that if you hold space, it shoots bullets constantly at a controlled pace, 10 some bullets a second was what I had in mind.
    Could you help me out with this!

    Again thank you for this awesome tutorial!

  13. Mohammed Abdulwahhab Avatar

    My fps drops after a minute or two of playing from around 1111 to 200
    Do you know why that might be occurrring?

  14. Nimz Hoax Avatar

    Lol I Made comment on wrong video xD … I made my star background but I want my stars to move and "twinkle", How will go about that?

  15. Marty McFly Avatar

    Love likes = 69 🙂

  16. Tokw. Avatar

    Did you find out? i think i know but not too sure

  17. hello19286 Avatar

    How come it fires one quick bullet and then the full auto kick in(2:43), also why does full auto not work when the ship is going from left to right?

  18. Richard Tester Avatar

    I really could use some help figuring this out ;(

  19. Richard Tester Avatar

    after adding the glitch fix, and a background and also an enemy ship to the spriteship I get these results I have all 3 images on the screen @ once and they all shoot @ once the images that they are.
    The image shooting.
    i41.tinypic (dot) com/2w38bnr.jpg

    my project file.
    mediafire (dot) com/?49ed789tl8mugtw

  20. astphaire Avatar

    I'm making a 2-d game seen from above, and I need to know how to make a sprite rotate when it is moved in a different direction.

  21. AndrewWayneV Avatar

    Ignore my question. I figured it out. It seems I added an extra line after the else if in the keyreleased KeyEvent. adding this at the end c.addBullet(new Bullet(p.getX(), p.getY(), this));
    It causes a bullet to fire when I release the space bar after firing.

  22. AndrewWayneV Avatar

    I seem to have made a mistake somewhere and I cannot identify it. When I press the space bar my ship fires but it also fires when I release the space bar. So in essence I am firing twice. Not a big issue but I would like to know what I did wrong. Any ideas?

  23. Jack Maci Avatar

    You can make a Background class to make it scroll, then in the tick() method you make it move up/down

  24. Jack Maci Avatar

    If you want random stars, then you can use this code:)
    for(int i = 0; i< 10000; i++){
    g.setColor(Color.WHITE);
    int posX = (int) (i * (Math.random()*100));
    int posY = (int) (i * (Math.random()*100));
    g.drawRect(posX,posY,1,1);
    }

  25. Rajat M Avatar

    How can i make this background scroll.

  26. Twurl Avatar

    Should really be isShooting under proper naming conventions. :/

  27. Anish Shenwai Avatar

    You are so amazing!

  28. Éric Langlais Avatar

    please people stop thinking others will do the job for you -_-

  29. Ksrma Avatar

    Entitys plz like Enemys but Entitys in general

  30. AnAmazingUsername1 Avatar

    Hey realtuts I've been trying to develop an 8-bit mmorpg but I've only started programming could you help

  31. TacticalGamingProject Avatar

    How many downloads does pixelbit have now ?

Leave a Reply

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