2015-10-12 00:13:46

I already have a code thingy set up that I will paste the link to, here.
https://dl.dropboxusercontent.com/u/954 … 20test.zip
What I mainly need help with is making my class a we bit more portable.
What I mean by this is I don't always want to have to use all the members of my door class.
To illustrate this more, go into map creation.bgt and try commenting out one of the door creations.
Everything else works pretty much as good as I'd want it to. So for those of you who look what your mainly interested in is the door class, walking code, and map creation.
You are of course free to look elsewhere :d.
For the others, let's not hijack this thread like my last one did.
Thanks everyone!

2015-10-12 19:04:34

I would recommend a dictionary for your map system, as that is what is primarily used. And if you want to use an array, use reserve.
but here, have a nice little thing I'm coding as i type this post.
This is mainly useful for 2dp games, but it'll work, and the less map data you need the less memory it eats.

dictionary map;
void set_tiles(int minx, int maxx, int miny, int maxy, string type)
{
for(int x=minx; x<=maxx; x++)
{
for(int y=miny; y<=maxy; y++)
{
map.set(x+":"+y,type);
}
}
}
//now, say I wanted to get the tile. Let's have a nice little string function for that. If it's air, return blank so it's air, unless you have a tile for air... Laggy!
string get_tile_at(int x, int y)
{
if(map.exists(x+":"+y)==false) return '";
string temptile;
map.get(x+":"+y,temptile);
return temptile;
}
//and now, if you wanted to get the players tile, assuming playerx and playery are your vars, you could write a function like this.
string get_player_tile()
{
return get_tile_at(playerx,playery);
}

I would highly recommend a dictionary over an array for map tiles and such.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-10-12 19:09:58

okay, I actualy looked at the whole code and i see this is 1d. No problem. Just use a dictionary as I recommended, and say something like this.
instead of using an array for tiles, dictionary, and that's it. If it's 1d, you can strip out the y variable, and just stick with x. And, then for the tile's value, you could have it say door1 instead of 1, so the game could say hey, this is a door, let's treat it as such.

----------
An anomaly in the matrix. An error in existence. A being who cannot get inside the goddamn box! A.K.A. Me.

2015-10-13 01:18:30

BGT dictionaries are kinda cumbersome. I'd write get functions to simplify retrieving data from them, for example:

string gets(dictionary@ d, string key) {
    if(@d==null or d.exists(key)==false) return "";
   string ret="";
    d.get(key, ret);
    return ret;
}

You'd need to do the same for other types, though, unless there's a way to return an unspecified type in BGT, and I just haven't come across it.


I'm not sure I understand the original question well enough to know if the dictionary advice is the best solution. I think I get what you're asking--code can get clunky and unwieldy and hard to remove from its original context--but I'm not sure I understand what the example is trying to do well enough to offer improvements.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2015-10-13 02:09:39

Hi,
@CAE, You could try declaring that function like so:
? gets(dictionary@ d, string key)
Not sure if that works though.
As to the matter of arrays and dictionaries, I tend to use dictionaries in 2d stuff, and usually I don't use an array or a dictionary with 1.5d stuff. Btw, when I say 1.5d, I mean a 1d sidescroller where you can jump. Although, the only 1.5d thing I actually spent considerable time on was Streets of Chaos and that thing wasn't complex enough to have a different map for each level with walls and such.

2015-11-27 21:56:26

Hi!
Can you give me an example Side Scroller games, which of the following you can:
Click on the right's start.
To start off an intro, which can carry hereinafter press Enter.
The main menu is a hit, and when he comes in, a menu music tone, and when the music's over, start again.
The menu is a new game, a reload a saved game, a speaker test, and leaving menu items are.
The exit when you press enter, leave, and come in a test speaker sound in a left to right, which indicates that both speakers work.
By clicking on the saved game to reload immediately start the game right where I left off previously.
The new game when you click, you can start up a music that goes on during the game, and the menu will stop the music, instead of the game do you speak music.
Right, left able to go to the beginning of the track shall be left wall, the wall can be left at the end of the track, and that's no matter how long the track.
So you can go right to the left, to be run control to right and left arrow keys, and jump with the up arrow button, no matter how big jump, but it is also possible to press the up or right arrow, what causes it up and to right to jump all position number.
Shoot be a space or a singer can be used with a sword, two singer be able to use the knife, three coat rack is the bomb.
Pressing the key EF4 know to save my game, and the Escapee be the main menu again, but first ask if you want to make sure that this move?
Press Enter to quit the Escapee and rewind the game.
If you ask, the whole sound_poollal be solved. That's it.
Sorry, my English is still a bit flawed, since I am Hungarian.
Thanks in advance.

2015-11-27 22:26:29

I hate to sound rude, but I really can't understand what you need.
Furthermore, your better off writing in the room itself, not in a topic completely different from what is being discussed. This way, everyone who ventures through this particular room will see it, and should be able to shed more light on the issue at hand.
The best I could recommend is to look at the dynamic menu class tutorial, and look at game programming in practice part I.
Also one other note, please don't do what I did. Started off, right away, head first, with a gigantic project that erm, sort of no longer exists.
That said, I wish you the best of luck.

2015-11-27 23:38:36

Hi,
have you tried to use a service such as Google Translate to write your post, or have you put it together off the top of your head?
In any case, whatever you did, it might be good to try the other way round, so if you translated this post with a software, try to word it yourself, or if you did just that, try to have it translated for you instead.
Like this, your post unfortunately makes no sense at all.
Hope this helps,
Lukas

I won't be using this account any more or participating in the forum activity through other childish means like creating an alternate account. I've asked for the account to be removed but I'm not sure if that's actually technically possible here. Just writing this for people to know that I won't be replying, posting new topics or checking private messages until the account is potentially removed.

2015-11-29 19:24:00

Hi!
Can you assist me in finding some sample code?
At some point, I had a code that I found on the net, which he knew was that to right, to the left you could go to him, he had menus, you could shoot, and the game was over music, just like on the menu.
The menu was I think I start a game, and one exit.
And sound_pool solved the game sounds.
So my question would be, how can you help this NEEK exactly where to find this example code?
I think I here in the audio board games somewhere, but not sure that I recall.
Help me please!