Programming a Java Text Adventure: Make A Map

preview_player
Показать описание
Source Code available from:

In this video I explain how to create a map to store the locxations (Rooms) for your game.
For an in-depth explanation of programming text adventures in C# and other languages, get a copy of The Little Book Of Adventure Game Programming. Available from:
And worldwide.

For in-depth courses on Java programming, C# programming and adventure games go to the Bitwise Courses site:
Рекомендации по теме
Комментарии
Автор

For those who are studying for OCJP, it's a nice exercise ;-)

gleitonfranco
Автор

I wanted to thank you, I am from Argentina and your videos are very educational. Keep it up !

ggrttt
Автор

I have made the Room quite differently.
It has an array with a fixed size of an Exit enumeration ( private Room exits[] = new Room[Exit.values().length]; )
And then it has this method to connect it with another room:

public void connect(Exit direction, Room other) {
exits[direction.ordinal()] = other;
= this;
}

And this opposite method in Exit enumeration is like:
public Exit opposite() {
switch (this) {
case NORTH:
return SOUTH;
...
}
throw new RuntimeException("Exit enumeration needs to be updated with the new pairings");
}

I believe this is more object oriented and it helps me avoid giving the indexes in the constructor, the explicit NOEXIT and the constant and long number of arguments into the constructor (what happens if you want to add direction UPWARDS and DOWNWARDS after your initial design?)

kozas
Автор

Wow! It's actually an amazing format and the way you explaining is very nice

temari
visit shbcf.ru