Re: 3x3 dungeon representation






On Wed, Apr 24, 2013 at 11:36 PM, marco ferrari <pacomako gmail com> wrote:
Hello everybody,
first of all I apologize in advance for any grammatical errors, but english is not my first language.
I'm trying to develop a small videogame in c++ as a university project.

Sounds fun ;-)
 
In this project the main character tries to escape from a dungeon made of 9 rooms disposed in a 3x3 grid. Between each room there is a door that can be opened with keys scattered throughout the map. The core of the project is already made and the game is playable via terminal.
I'm thinking about the best way to represent this graphically with GTK libraries (rooms, charachter, doors, keys and eventually other object disposed random through the map), with a minimal interface and a top view of the dungeon like this (but not so minimal):
 ______ ______ ______
|           |           |          |
|                **    |          |
|__    __|______|______|
|           |           |          |
|    **                           |
|______|______|______|
|          |           |           |
|          |                **    |
|______|______|______|

(** = key, blank space = door opened, | or __ = door closed)

My idea was to create a window with multiple containers/boxes (a grid of about 7x7 boxes, not sure already), then:
- In the rooms boxes place an image with the room and the oblect in it (and eventually reload the image with the character move in or without the objects when the player picks themp up).
- In the doors boxes place an image with the opened or closed door and reload it when the pre-existing condition changes.
- In the rooms's divider boxes place an image to represent the wall between the rooms.

I think you're complicating things a bit, I recommend that you ditch the idea of
a "room" being a box, and the "wall" being a sort of separator... everything
occupies space.

Instead, it's probably better to think in terms of "tiles" everywhere... some tiles
can be empty space, some of them might be a vertical or horizontal piece of
a wall, some of them might be an intersection of walls, some of them could
be doors or other object.

On top of that, you could render a background image before painting anything
else, which could be the floor... the character which moves around in space
could derive from the same 'tile' object which paints things layed around in
space, but have the added attributes such as, collision detection (avoid
walking through walls, unless the 'ghost' power up was eaten ;-)), interaction
with other objects such as doors and keys.

Finally, you probably want to just do this all inside a single drawing area
widget instead of actually using GtkGrid to lay things out... use cairo
for drawing and queue redraws on the areas which might need to be
redrawn because of some input (like the character moved).

Have fun !

Cheers,
     -Tristan
 

Any suggestions or better ideas?
Thanks for your help!
Marco F.

_______________________________________________
gtk-list mailing list
gtk-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]