Class question
Feb 14, 2015 at 8:37pm UTC
I'm attempting code a game where I will be using two-dimensional arrays in addition to a coordinate system to determine players position. When the player reaches certain ends of the map, he will be in theory transported to the next map segment ( which are 10x10 arrays ). Is this practical, and am I on the right track in attempting to accomplish this? Are my classes necessary?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#ifndef MAP_TILE_H
#define MAP_TILE_H
#include <iostream>
using std::string;
class Map_Tile
{
public :
Map_Tile();
bool can_north();
bool can_east();
bool can_south();
bool can_west();
void set_exits(bool N, bool E, bool S, bool W);
void set_exit_descriptions(string N, string E, string S, string W);
void set_area_description(string setDescription);
private :
bool northExit, eastExit, southExit, westExit;
string entryDescription, northDescription, eastDescription, southDescription, westDescription;
};
#endif
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef MAP_SEGMENT_H
#define MAP_SEGMENT_H
#include "Map_Tile.h"
#include <iostream>
using std::string;
class Map_Segment
{
public :
const static int MAP_SIZE = 10;
Map_Segment();
private :
Map_Tile game_board[MAP_SIZE][MAP_SIZE];
};
#endif
in main, it will look something like this...
1 2 3
Map_Segment forest;
Map_segment castle;
//etc...
Last edited on Feb 14, 2015 at 8:39pm UTC
Feb 14, 2015 at 9:38pm UTC
Thoughts?
Feb 14, 2015 at 10:28pm UTC
Bump!
Feb 14, 2015 at 11:27pm UTC
Bump
Topic archived. No new replies allowed.