Java Game Programming #6 – Player Gravity

Produce your own Java game from scratch with this very simple, yet very powerful course available right now

In this video we learn how to add gravity into our java game. The most important part of any platformer game. 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!

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






45 responses to “Java Game Programming #6 – Player Gravity”

  1. ecksdee Avatar

    if your gravity isn't working make sure your velX, velY are floats

  2. FlashFire Gaming Avatar

    When you don't know your shapes, "as you can see we have our blue SQUARE up top".

  3. Los Blogs de ManuM Avatar

    bro, ¿why you complicated the programming of any shit?
    With all the respect…

  4. Kisagi Seirei Avatar

    I like how you're going this with tutorial. Enjoying this one much more.

  5. Temps Avatar

    if (falling || jumping) {
    velY += gravity;
    x += 10;
    y -= 10;

    its lit

  6. Jafar Chembatty Avatar

    do u happen to know the guy. Bucky roberts (newboston guy). you sound the same.

  7. Ravi Khannawalia Avatar

    If anyone's rectangle is not falling, but just elongating, then do check that you have added a background or not.
    if not, then just add

    g.fillRect(0, 0, 800, 600);
    above in the render( ) in

    and hope u understood the reason for it

  8. Lorenzo Zuluaga Avatar

    hi, i understand almost all you explaned but, i use net beans and diferrent type of programming, do u think is possible for u to help me with some troubles i m having while doing my game? its my final project, i hope u could solve my dudes.

    thanks in advice

  9. Chris Gevorkyan Avatar

    So i added gravity to my player. I also have some solid objects below my character. When he spawns in he goes though the solid object, as in he does not collide with the object. Before adding the gravity it would collide and it would not let me through. Is there something I'm missing out in my code?


    Hi RealTutsGML,
    You are really great, and i'll like and subscribe.. But I think you should explain more. I programme in HTML, JavaScript, CSS a lot, and I think you need explain just those things which You add with Eclipse. Of course it's just mine opinion. But anyway I'll like and subscribe.

  11. In-N-Out Avatar

    If my fps is way higher than his, does it mean I have a faster processor?

  12. BlocKMine Central Avatar

    it won't fall plz help!

  13. Jason Paul Avatar

    i cant believe its actually working for me xD

  14. Jason Paul Avatar

    thats amazing crap

  15. bam24ful Avatar

    For some reason my player wont fall. There are no issues with it and its exactly like RealTuts but it isn't working

  16. techn0vids Avatar

    my player wont fall help!!

  17. Shiroi Tamashi Avatar

    We should add a protected boolean standing = true, and set falling to false, since we could add in the future a different animation for when we are falling and one for when we are standing still, you know :3

  18. Rahul P Avatar


  19. theone102 Avatar

    any one know how he got his Eclipse like that? or what version he is running? I can change the text areas but not the out side areas. any help?

  20. Ross Binden Avatar

    Using your ObjectId system, you could change the constructor in Player so it doesn't require the ObjectId parameter, and just pass ObjectId.PLAYER into the supertype's constructor, that way, if anyone constructs a player, they can't set it to be something it isn't, like a block.

  21. Matthew Thoburn Avatar

    How did you get your display in the dark layout? I like how you have it and I want to copy you

  22. Nathan Wickland Avatar

    Your not really explaining anything you do. 

  23. Paul Blue Avatar

    Java Game Programming # 6 in one day! Awesome!

  24. JDam Avatar


  25. Jerstah phucku Avatar

    for some reason my player wont fall, I have created the getters and setters using the eclipse source tab for falling and jumping.  I created everthing in player as well.  any ideas what I messed up on or why it isnt working? it draws the character but it wont fall

  26. Miguel Guerrero Avatar

    What does the f in 2:18 means? What is it for?

  27. Michael Zhou Avatar

    These tutorials are great! The only thing is that I wanted to add my own images to the program. Nevertheless, great video.

  28. RedXVIII Avatar

    Okay well yeah just use the command prompt, or a batch file. I forgot the commands though.

  29. Alex Avatar

    I know what an IDE is and how it works. I said you'd need a way of doing it or an IDE.

  30. RedXVIII Avatar

    Actually IDE's just help programmers. The Java Development Kit does all the compiling. But to do so if you have Windows you need to use the command prompt, or event a batch file will work.

  31. RedXVIII Avatar

    It would of been better to just of added a user selected width and height when the object was created. So in the abstract class you could just add width, and height and all the getters, and setters. Also add the values to the constructor.

  32. Alex Avatar

    It's actually Visual Basic Scripting Edition and yes you can, but it isn't really the best way to go about developing games.

  33. T h e Enigma Avatar

    well, you can always try it with visual basic script, you can use the power of .NET framework and you dont need anything but notepad..

  34. pj6444 Avatar

    Actually you can compile and run them in cmd.

  35. Alex Avatar

    Yep, but you can't compile or play them using just solely notepad, you'd need a way of doing it or some sort of IDE, unless you made your game in batch or some similar language, but it wouldn't be very powerful.

  36. RegenerationNetwork Avatar

    I was searching around your channel seeking another tutorial on this but instead I found your "Should I do a Q&A video?". I think you should do a Q&A video because there have been a lot of suggestions for your channel in the comments that I think you should consider to increase your subscriber count and ultimately increate your channel's worth. Thanks

  37. DemonicGaming15 Avatar

    Can you make games using notepad?

  38. RegenerationNetwork Avatar

    I agree with Joshua, could you generate more content on these java tutorials? I do not mean in any way that you have to make daily videos, I just would like to see some more lengthy videos like maybe 10-15 minutes. That would give your audience more information to grab and would satisfy them until the next tutorial. Love your tutorials and hope to see you make more!

  39. Joshua Homer Avatar

    Are you limited to a shorter video time? I would love to see either your videos become longer, or you upload more frequently! 🙂 So far I've watched and implemented your Game Maker tutorials and now your Java Tutorials!

  40. necromanderboy Avatar

    Hey, is it possible when your done creating the game, can you make it for Android and publishit it on Google Play, if so will you make a tutorial at the end?

  41. The guy Avatar

    Great tutorial, only easy to follow and complete(hopefully) tutorial on YouTube

  42. MrPcPr0 Avatar

    when's next episode?

  43. Tommas Witvrouwen Avatar

    I like the theme but would you show it how to do it cause i can't figure it out
    And another great video

Leave a Reply

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