Java Beginner Tutorial – Basic Collision

[ad_1]
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 create basic collision in our 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.

Last Tutorial –

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

13 responses to “Java Beginner Tutorial – Basic Collision”

  1. Kamal Ahmad Avatar

    how about public void update (Mainclass g)

    {
    if (x+xp==g.getheight())
    {
    xp=0;
    }
    }

  2. Kevin Peng Avatar

    Would this laziness slow the game?
    if(x>640-32){
    x=640-32;
    }
    if(y>480-32){
    x=480-32;
    }

  3. Taylor Kohls Avatar

    I think it looked weird on the lower left sides of the screen because the sprite is centered at the upper right corner.

  4. mang oac Avatar

    Hey dude the reason the collision was off was because the width and height take into account the bar at the top which is 22 pixels or something 🙂

  5. WoWAsteros Avatar

    i found a cool thing you can do if you change it to negative
    if(x > 613){
    x = -613;
    }
    if(y > 457){
    y = -457;
    }
    then that makes it go back to the other side so its not that it bounces off its that it swaps to the other side to you go through the right side and you come out of the left 🙂 its nice it works with the bottom aswell

  6. RealTutsGML Avatar

    ahh alright I am glad to hear that. Yeah I wasn't aware that you were using mac.

  7. MonDieu72 Avatar

    It was never my opinion that it was your fault, obviously the problem was at my end. Did some research about java development on a mac (especially gamedev) and from what I found some things are done quite differently, had somthing to with java security restrictions among other things. So I used bootcamp and installed windows 7 ult 64bit, started over and now everything works perfectly and I´m back on track 🙂

  8. RealTutsGML Avatar

    well this is not my fault. Sorry to say but you messed up your code BAD!! I use this same key input method in all of my games and they run smooth at 100 fps and those are big games. Maybe set your timer lower or calculate your fps.

  9. MonDieu72 Avatar

    Still having problems with the arrowkeys ( I have setFocusable(true) ) but if I set to "x += 5" and so on it works but with absolutely horrible performance.. imagine trying to play BattleField 3 on a pocketcalculator… 🙁 just spent the equivalent of 3000USD on this new iMac and it plays BF3 (using bootcamp) like a dream! and the same with diablo3 & guildwars 2.

  10. RealTutsGML Avatar

    yes I will in the future.

  11. RealTutsGML Avatar

    make sure you have setFocusable(true) in the constructor for Game class

  12. TheRoach42 Avatar

    Hey man glad your making these videos again, but same problem as last video. with having to press tab before the arrow keys working/being able to move, could you tell me whats wrong or address this in your next video? Thanks

Leave a Reply

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