Java Programming: Let’s Build a Game #2

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

Support my Patreon –

In this video we finish up the back end work for our game and set up the GameObject class which will make the game a lot easier to work with later down the line. 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.

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!

Follow me on Google+ to keep updated with all of my tutorials

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


Posted

in

by

Tags:

Comments

46 responses to “Java Programming: Let’s Build a Game #2”

  1. Taras Karmalyk Avatar

    In JetBrains, use Alt + Insert to generate Constructor, or getter or setter etc.

  2. Scarlet Chiira Avatar

    Is there a GitHub repository for this?

  3. Why Not To Have Fun Avatar

    screw jedies, I'm a get(i)

  4. xclimatexcoldxx Avatar

    What software is he using? I cant find any other way to run java except through the command prompt, which is stupid.

  5. ThatDude 45 Avatar

    And here I am 3 years later…
    MY COMPUTER DISPLAYS A WHITE WINDOW AND NOTHING ELSE!
    TF US GOING ON!

  6. Zachary Young Avatar

    Do Ctrl+Shift+O to import packages that you need

  7. Space Been Avatar

    is the code on this video available mine isn't working and I can't figure out why

  8. spongebob 01 Avatar

    my squares wont move pls help

  9. ThePanable Avatar

    This is beautifully written code. You should be proud.

  10. Spudly Avatar

    Great video thanks, really made it easy to get everything going!
    the only thing I find pretty funny is you gloss over things like inheritance and abstract classes, but then at 12:45 you completely explain the workings of a for loop.

  11. Angel Supreme Avatar

    guys try to watch this in 1.50 speed lol

  12. erre4 Avatar

    why is lagging so much? i'm using linux. how can i solve?

  13. hayksmn Avatar

    I know it's really late but why not use foreach loops? Seems easier that way.
    for (GameObject object:objects) {
    object.tick();
    }
    for (GameObject object:objects) {
    object.render(g);
    }

  14. Matt Brown Avatar

    By any chance is source code on github?

  15. Nikoloz Avatar

    i don't get who you're targeting at. previously you assume we know what a bufferstrategy is, but here you console us about the complexity of the idea of class constructor? and btw the code in run() method is not really that bad. it just ticks 60 times per sec and renders as many times as the parent while loop runs. and it updates FPS at most once per second

  16. Alex Li Avatar

    I don't see the point in using an enum. I don't really know what they are, but for all the purposes that you use it for, it would be more readable and easier to just use the command instanceof.
    (format : say you have an object named animal, you could type:
    if(animal instanceof horse){
    do stuff;
    }

  17. Relic Zexide Avatar

    hey guys if the programe isn't working you have 100% messed some where in the spelling like you did forget an i or did make an 'O' in the place of an 'o' re-read the programme 10 time if it isn't working

  18. Breepable17 Avatar

    I copied the render class word for word but in the game class I keep getting an error that says "Cannot instantiate the type Handler" any idea where the cause of the issue might be?

  19. Tenji Lionel Avatar

    quick question about getters and setters in this instance, so are getters and setters basically like the universal config files for the different entites in the game? like having common variables between each entity like size and health?

  20. TeaMMatE11 - Another Music Guy Avatar

    So I created a new instance of handler, and Java doesn't seem to recognize the new instance, help anyone?

  21. 9000643 Avatar

    What if I wanted a delay in my tick? Instead of constant motion, move five pixels every time with a short delay in between?

  22. Shachar Har-Shuv Avatar

    the square was moving in a very low frame rate at the beginning, then I found out I can fix it if I make the "ns" argument in the game loop smaller than you did. Why is that? Does the speed of the game depend on the machine? This is not a wanted side effect… how do I specifically determine the frame rate of my game to be the same on each machine?

  23. Shachar Har-Shuv Avatar

    Correct me if I'm wrong = but get(i) in LinkedList takes O(i) time so you iteration through the list O(n^2) (when n is the size of the list). Isn't there a way to iterate through the list in linear time? like using iterators or pointers or something?
    (forgive me if I'm wrong I am a student of computer science and know more theory than practical programming)

  24. Jay Lickert Avatar

    my fps is like 200-300 is that okay

  25. SauceBoss Avatar

    when I put handler.tick(); in it makes it so there are other errors, don't know what is going wrong. Thanks

  26. Silas Eacret Avatar

    Anyone know why when I create an enum it says: Project 'Game!' is not a J2SE 5.0 compliant project.

  27. MESS WITH IT Avatar

    can't get the white box to show up pls halp!!!!!!!

  28. Ikechi Nwankwo Avatar

    I got the code working so the objects are moving but I dont understand how they are doing so. In the main method we create a new game which also creates a handler object. but can someone tell me where the tick and render methods are actually called?

  29. Luke Hensley Avatar

    when ever I add the line "x += velX" to the Player tick() method, the game wont show anything in the window, does anyone have a solution?

  30. primaltare Avatar

    By the way, you REALLY need to take this slower. You neglect explaining stuff despite that being your advertising hook, and then you constantly say, "easy". I have adequate understanding of Java and I /still/ could barely follow you at some points.

  31. primaltare Avatar

    When creating my ID enum, Player() was fine (despite not having a class created), but Enemy() gave me an error (This method requires a body instead of a semicolon). Any ideas on how to fix it?

  32. K Parks Avatar

    Dude you just reminded me why I don't like java!! All of that code just to get your screen/canvas up and running !!!

  33. John J1101 Avatar

    14:00 for(GameObject o:objects){o.tick();} (I used ArrayList, idk about LinkedList)

  34. Limitless Avatar

    I just love your enthusiasm!

  35. Adithya Ravindra Avatar

    Handler.addObject isnt working for me

  36. Stjerna er meg Avatar

    My squares are moving 45 degrees downards? Instead of moving straight to right?

  37. devin blevins Avatar

    I get nullpointerException each time I try to do velX = r.nextInt(5) + 1; but when I do just velX += 1; it has no problem running

  38. Karan Rana Avatar

    where u made this game ,which software I also want to make my own app plz tell from java language

  39. ⊆Roovy⊇ Avatar

    Why don't make the class Handler static?

  40. FredTheNerd Avatar

    When i instantiate a new instance of handler in the game class, the compiler asks me to implement all abstract methods, and when i do this, 3 methods are generated, which are called publish, flush, and close. I followed your tutorial though i have this error, someone please help me

  41. George W. Kush Avatar

    Post everything in github, please.

  42. Youssef Samwel Avatar

    Does anyone have the source code???

  43. Kap3z1 Avatar

    15:52 As soon as I add "handler.tick();" there's errors. Could it have something to do with the word tick in the gameloop? Because if I remove the line "tick();" from my game loop there's no errors, but fps is halved.

    Exception in thread "Thread-2" java.lang.NullPointerException
    at com.tutorial.main.Game.tick(Game.java:70)
    at com.tutorial.main.Game.run(Game.java:53)
    at java.lang.Thread.run(Unknown Source)

  44. John Bender Avatar

    to all who get the errors… check and make sure that you are importing properly. he is doing this without you guys noticing

  45. John Bender Avatar

    you do things naturally that as someone who teaching needs to realize that and make sure you are not confusing others. There are things your doing without thinking and not mentioning them and it makes it difficult for others to understand the full tutorial, however you are doing really awesome.

  46. haloanimates Avatar

    18:09 Help! My shapes aren't moving!

Leave a Reply

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