Java Programming: Let's Build a Game #6

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

In this video today we look at creating a spawning system into our game along with creating a new enemy and adding a score/level system. 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 the health changing color part, I used
"greenValue = 255 * health / 100;"
So that the green is reduced as a percentage of the health, and I have found that setting the red to 150 instead of 75 creates some nicer colors.

flamme
Автор

Dude you're videos are so amazing, not only do you teach us how to make amazing things, but you explain how everything works. Unlike a lot of Youtubers who just tell you what to type, you give us options. Props to you man. 2 Thumbs up!

alnoiseplaysmc
Автор

Does anyone else spend 5min playing there unfinished game between episodes? :D

swiftninjapro
Автор

Yes!!! Thanks for be back dude, was afraid of you don't keep the series, this is helping me a lot, thank you!

GPlayerHD
Автор

You should have an abstract class named Enemy, that extends GameObject end all types of enemies extends her, it will make the code a lot shorter

iradnuriel
Автор

Finally you are back, way you are taken so long between your videos. I'm so happy you are back to help me to improve my knowledge.thanks

anpapala
Автор

For the code handling the level progression, can't you just put this int the tick method for hud:
if(score % 1000 == 0) level++;

andrewhayworth
Автор

Good vid! If I might make one suggestion... When creating the second enemy, it would be a great idea to explore Object Inheritance. From the look of it, there shouldn't be too much code to add and it explores an extremely important concept in both Java and game programming. Keep up the great work!

englishcrusade
Автор

yes real tuts is back i've been waiting so long and it was my birthday on friday so its a birthday gift keep up the amazing work

jakemoody
Автор

Finally, glad you're back man. :)

StefanBanu
Автор

Another great tutorial.. loving it.. 
Two thing for other users to make it better:
1. set redColor variable=0 &
in tick method do redColor=255-greenColor;
&obviously paint it. It'll give a smotth green>yellow>red bar transition
2. Extends Fast enemy to basic enemy so needn't to copy code & just change the color and speed in constructor..
remember DRY CODE!

monugupta
Автор

The Levelup would be much easier with % (modulo)!
In my HUD class, in the tick() method I just wrote "if(score%1000 == 0) level++;"
It means that everytime the Score reaches 1000 the Level goes one up.
Because 1000/1000 is divideable and the divisionrest is equals to 0.
For 328/1000 the divisionrest is equals to 328. For 3547 the divisionrest is equals to 547. For 10000/1000 the divisionrest is 0 => its true... and so on

ancientalienmusic
Автор

Thanks for the tutorial. Next up for me would be sound effects, background music etc. Other than that, a game over screen and perhaps a leader-board with all your high scores.

Phenylalanin
Автор

9:42 i recommend doing the score for a long variable because if u want high scores, but it needs more memory
20:07 when the enemy spawns it spawns in tons of amounts and made by FPS super low, so i disabled him

spongewent
Автор

Anyone getting the null point exception at level 2 make sure you have this line EXACTLY in your Spawn Class
private Random r = new Random();

louisedbrooke
Автор

DUDE! You could just do (to add the level)

score++;
if (score % 1000 == 0) {
level++;
}

basically, % gives you the remainder of a division.
So, if the remainder of score / 1000 is 0, then it has to be a multiple of 1000!

yw

spiritwolf
Автор

Yay! I have been waiting forever! glad you got you PC back up and working and I hope you can keep making these videos! Could we get images in the game next tutorial? I really want to learn that.

snowyleopard
Автор

YAY it works (: good job with the video realtutsgml

henryredder
Автор

If you want to make the Score going slower like I did:

private double Score = 0; instead of int Score

Score = Score + 0.?; instead of score++; while the ? has to be replaced as you wish, I prefer 0.1 (or higher if u use 60 ticks)

g.drawString("Score: " + (int) Score, 550, 20); to cast the double to int before showing it to get rid of the after comma numbers again

jplay
Автор

There is an easier way to increase the level value every time the score hits 1000. In the tick method in the HUD class, type...

if(score % 1000 == 0) {
level++;
}

This is using the modulo operator ( % ) to check the remainder of a quotient. If the score divided by 1000 has a remainder of 0, increase the level.

timbsswag