Java Programming: Let's Build a Game #10

preview_player
Показать описание

In this video we create a cool menu effect particle and a game over screen! 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

Рекомендации по теме
Комментарии
Автор

For those who do not wanna write all the extra code in the clearEnemys() function to check what state it is and if it should clear player:

In game class in update, instead of handler.clearEnemys(), instead type handler.object.clear().

KajiIkaraseru
Автор

FOR THOSE OF YOU WITH THIS ERROR OR SIMILAR
Exception in thread "Thread-2"
at Source)
at Source)
at
at
at
at java.lang.Thread.run(Unknown Source)
THE ISSUE IS THAT IT IS THE LINEKED
i found this issue in debug mode. So. How do you fix the issue? Change it to an array list! So in Handler.java, changed LinkedList to ArrayList and eclipse will to the rest. GOOD


I am so happy that I got this omg

arsenicsupersonic
Автор

I likes how he's still not spelling "Enemies" right

JordanW
Автор

I don't know if you handled this in episode 11, but I believe scoreKeep (in Spawn.java) needs to be set to 0 as well, otherwise the interval of leveling up won't be at 1000 score anymore.

MrGovaz
Автор

Could you do a C++ game development tutorial series?

doc
Автор

Hi, just recently stumbled upon your series and I think they are great! I really enjoy them and hope you'll continue soon. Anyway; subbed! :)

Sugarfant
Автор

FOR ANYONE THAT HAS A NULLPOINTER WHEN CALLING YOUR RENDER OR TICK METHOD JUST DO A SIMPLE NULL CHECK:
if(tempObject != null) {
// your code
} else return;

vincevd
Автор

Hi there, RealTutsGML :)

I'd love it if you would be able to put up a link for your entire java project, it would make things easier for beginner - intermediate programmers. It would allow us to pick out specific things that we don't know about, then refer back to your videos as we already understand some of the coding.

Thanks so much,  
Phil

loganc
Автор

hi
when i try to start the game, it says "Exception in thread "Thread-0" Cannot read field "next" because "x" is null" and it directs me to the Handler's tick/render method, for the silliest reason
is there a way to fix it?

spongewent
Автор

If anyone else is having a problem getting the setScore() and setLevel to work, the problem might be that you're initialising score and level in the display class to a value.

ie replace int score = 0, level = 1; with int score, level; IN THE DISPLAY (OR HUD) CLASS.

THEN, in your Menu class, set the score and level for when the user pushes the play button on the first menu. AND when the user presses to try again.

The problem with the way this tutorial has been set up is that the display is designed thinking that the user won't try again. So when we add that functionality it begins to have hissy fits. You're resetting a score that has already being set, then reset. Solution? Don't initially set the value, have the code reset the value each time.

ALSO, I got alot of errors regarding null exceptions, this was due to a problem with the way that the clear enemies had been set up. Basically, the compiler was adding and clearing objects at the same time - which is bound to bring up errors. So change your clear enemies method to:

public void clearEnemies(){
for(int i = 0; i < object.size(); i++){
GameObject tempObject = object.get(i);

if(Game.gameState != Game.STATE.Game){
object.clear();
}

if(tempObject.get_id() != ID.Player){
removeObject(tempObject);
i--;
}
}

}

I was debugging for a good half and hour, might save some of you guys some time.

reddeadbret
Автор

What up Zach? I know you're not very active on here anymore, but I have been watching your tutorials and building my own Java game recently. I am curious how you were able to make the debug changes to your game in real-time starting at 15:02 in this video. Does this have to do with hot-swapping? I am having trouble doing this in Eclipse. Do you have any suggestions on how to get this working? I would appreciate any help man. Thank you for the awesome tutorials btw!

eliasgarcia
Автор

Thank you so much for all of your help. You've helped progress so much as a game programmer.

marstechgp
Автор

I am watching this year 2020. I wonder if the people who comments from 5 years ago became a programmer in big companies.

PAUL-kydq
Автор

Exception in thread "Thread-2"
at Source)
at Source)
at
at
at
at java.lang.Thread.run(Unknown Source)

I have an error, any body help?

namma
Автор

There is another bug if you haven't caught it. When you press try again, your score doesn't correspond to when the next enemy would usually spawn anymore. For example:

1st game: Score = 250, Spawn BasicEnemy; Score = 750, Spawn BasicEnemy;
2nd game: Score = 263, Spawn BasicEnemy; Score = 763, Spawn BasicEnemy;

And by Score I mean the score that you can see in the HUD.

finalninja
Автор

Hey, sometimes when I press the play button or Try Again button, the game freezes, I look in the console and see this error:
Exception in thread "Thread-2"
at Source)
at Source)
at
at
at
at java.lang.Thread.run(Unknown Source)
Can Someone Please Help?

FlamingKnight
Автор

I haven't started this series, i hope i get it in the holidays

mattdathew
Автор

Hey Real,  

Great video series, I have been following from the start but I kinda branched my game out into my own thing (its alot like yours tho, but I have never done this before) So the question I had was how would you go about editing the smart enemy to track the nearest object that is not an enemy? I have added 2 player functionality, I wasn't able to figure out how to use the player class to create two players each with their own scoring and health. What I did was copy and paste the player class and added a new class "player2" Then I edited the menu states to have a 1 player version or a 2 player version. I was trying to mess around with the smart enemy to get him to track which ever player is closer. I know I would be able to clone the smart enemy class and have it just track player2 but I was not sure if there was a better way to do it with just one class. Maybe something that I could go back and reapply to the player class and have that be 1 class with 2 player objects and independent scoring and health. 

Also something I added to my game was a little health boost, just a little green ball that will spawn in and if the player hits it their health goes up. Pretty fun add on.

ShaneCodes
Автор

I got a null pointer trying to remove the MenuParticle with clearEnemys()
If someone else got the problem with that, I used that:
public void clearMenu() {
int length = object.size();
for(int i = 0; i < length; i++) {
this.object.remove(0);
}
}
and replaced handler.clearEnemys(); with
handler.clearMenu();
Just wrote the methode under the clearEnemys() in the Handler class

rex_robbin
Автор

hey, why not turn the gameState in class Game into a static variable? all classes will have the same game state anyway...

marvindelavega