Hi all. I’ve been looking into learning game development over the past week and decided to just jump right in. I already have a few threads on the forum such as:
Can games like Super Meat Boy or Binding of Isaac be recreated with Java?
Need advice mapping out a plan/roadmap to follow for building a 2D platform game
And after a few days of reading and coding, what I’ve got to show for it is this:
JHKRu7d9ep8
Now… what I’m asking for is maybe some of you can take a look at how I did what I did and suggest if I could implement it better. I’m asking because I don’t think it’s good programming practice to just develop haphazardly as long as your program works. I think that there’s still a right way to do things, is what I’m saying. Here’s my code:
main class - http://www.java-gaming.org/?action=pastebin&id=566
Barrier class - http://www.java-gaming.org/?action=pastebin&id=567
Ball class - http://www.java-gaming.org/?action=pastebin&id=568
Questions / Comments:
(1) I’ve seen some tutorials such as this that put the entire physics world into another class. Is that really recommendable? If so, how do I tweak my current code to turn it into that?
(2) Are button names for all gamepads standard? asking because I don’t know if it’s correct that I use “.equals(“X Axis”)”, “.equals(“Y Axis”)” and “.equals(“Button 0”)” to detect inputs from the left analog stick and A-button respectively.
(3) I’m pretty sure I’m not implementing collision detection quite right at all (see createCollisionListener()). Seems like a brute-force way to go about the logic - with the use of getUserData()/setUserData() - which I’ll have to revisit.
That’s all I can think of now. If anyone has the time and patience to take a look at the code, thanks in advance!