2017-03-28 12:24:03

Hello.
I have 2 questions on BGT.
1. How can I make language packs in my game?
That is lung files, with the help of these files you can make the game in several languages. An example is in STW.
2. How can I make a map in the game?
That is, a room, or as in Redspot. Rises, different sounds of steps and stuff.
Thank you in advance!

2017-03-28 18:16:22 (edited by brian.kurosawa 2017-03-28 18:17:53)

Create a map class, make an universal array, and when adding players to it don't forget implementing a pointer into the player's class to handle events properly.
For different tiles some recomend using dictionaries but i preffer to use arrays, cause it dodge the fact that the player could get ot of the map limiths. But thats a personal choice. Take a look at the third game example in the documentation, maybe it'll explain correctly what i want mean.

2017-03-29 06:26:44

I thought about the dictionaries, but I think that is not effective.
If anyone was making maps, please share an example.
And what about language packs?

2017-03-29 13:27:06 (edited by brian.kurosawa 2017-03-29 13:27:22)

There goes a map example.
class Map {
uint8[][] tiles;//Using less memory.
uint size_x,size_y;
Map(uint size_x,uint size_y,uint8 base_tile) {
this.size_x=size_x;
this.size_y=size_y;
tile.resize(size_x);
for(uint x=0;x<size_x;x++) tile[x].resize(size_y);
//For now, familliar
set_tile(0,size_x,0,size_y,base_tile);
}
bool set_tile(uint min_x,uint max_x,uint min_y,uint max_y,uint8 type) {
for(uint x=min_x;x<=max_x;x++) {
for(uint y=min_y;y<=max_y;y++) tile[x][y]=type;
}
}
Map@[] maps;
void add_map(uint size_x,uint size_y,uint8 base_tile) {
Map m(size_x,size_y,base_tile);
maps.insert_last(m);
}
And for altering the players map change the pointer on it's class to the new map. Create some kind of exit that when you press enter on it you will be transported to a new map, changing the pointer of the player's current map to the new one. But don't forget to change sources on the sound pool if you re using it to handle your sounds.
For language packs, split a string by lines with splited=string_split(the_string,"\n",true); and make a for loop on it spliting each element by equal and replacing whats on the message string by the element's result after the equal sign, on that case the first element of the splited string.