2D Java Game Programming - Let's Implement... Changing Level [P1]

preview_player
Показать описание
*** PLEASE READ DESCRIPTION :) ***

The actual game you can see was built on TheCherno's engine in his 2D Game Dev series, you can find his channel:

This short video demonstrates how to create a setLevel method in the Game class, and then go about calling it when a specific trigger tile is activated. Its written off-the-cuff, so may be a little hard to follow exactly, but watch it through a couple of times and you'll get it no problem.

Cheers :)

PS: I don't have the ability to zoom in with the editing software I use, but I do hope this larger font is easier for you guys to read. :)

(Even if i its much harder to code in!)
Рекомендации по теме
Комментарии
Автор

Thank's alot andy! You saved me SO much time! Did you create those sprites yourself? Must've taken forever they look awesome ;)

Mortifr
Автор

Hey can I made a mistake while making the spawn level and level class pretty sure and I get load of errors when I try to fix it I get loads of errors can you post your level and spawn level class on github?

quate
Автор

//Its not working for me for some reason I know that the second map does work.

//This are the methods I wrote in the Game class.

public static Game getGame() {
return game;
}

public void setLevel(Level level) {
this.level = level;


}

public Level getLevel(){
return level;
}

}

//Java says im getting a java.lung NullPointerException in the player class in:

if(Level.getTile((int) x >> 5, (int) y >> 5).exit()){    //Im running in 32*32 pixels 
level.checkExits(this);
}


//(I had to change get tile to static in the level class in order to cast an int in the if //statement working)
//Everytime I stand on the platform the  game stops.
//please what could be wrong Im just halfway there pls help

kobg
Автор

Recommendation. If you are not going to talk, at least put some light background music over the video :)

FaTalCubez
Автор

Did u just download the source code cause it looks like javascript

papakushi
Автор

Hello Andy, i have completed the tutorial and yet when the level is changed it looks like the first level and yet reacts like the second level. How would i fix this?

oaster
visit shbcf.ru