Sign in to follow this  
MAGIgullorks

Ascii rogue rpgs

Recommended Posts

MAGIgullorks    100
So if I were to make a game like ADom, using C++, would I have to use bubblesort to move the character around like if I click up, it checks if there is a period and switches you with it, and if there is like an f, you dont switch but you fight it like a lion? Or would you have to use opengl to get the keys like that?

Share this post


Link to post
Share on other sites
tychon    652
I... can't see why you would use bubble sort for this. And OpenGL has nothing to do with roguelikes, unless you happen to be doing your rendering with it.

Checking by the symbol would be quite limiting. You'd be hard coding expectations about tiles that way, limiting what you could present with any given symbol.

It depends on your particular setup how exactly it would work, but a simple method would be to use a 2D array of tiles, where each tile has a type (TILE_WALL, TILE_FLOOR), can store an entity (player, monster, anything that moves about), and can contain a collection of items. All you'd need to do then is make sure it's not a wall (world[x][y].type != TYPE_WALL) and that there's nobody standing on it (world[x][y].entity == NULL). If both these pass, set that tile's entity to the player (and clear out the one you just left) and you're done.

Of course, that's not the most efficient way of doing it and it would only work if the game is designed around that from the start.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this