Game guidance

Heyeveryone,
I am about to remake a poorly coded 2d game i made earlier this year. I would like som guidance in regards of the classes i will need. I want the to be proper OOP.
I am using c++, SDL and opengl.

There is a 2d square, who just complete levels by moving along yellow lines without touching red lines. He can jump, but for only a certain amount of air-time. There map is also read from a text file, because i am using glQuads to draw the lines, i just need 4 coordinates, which loop through a txt that i make.

Basically there is:
- a character
- a level :containing good and bad platforms
- the platforms are stored in a document - the .txt could look like this:
23 10 10 12 // first platform
12 100 13 109 //second platform
et.c
So it loops through in 4's, drawing them.

- a jumping mechanism.

Thankyou very much, I have all these ideas but can never make them, and this is something i am really eager to do. I wuold be sooooo grateful to recieve a response.

THankyou very much :)
So why not design your program exactly like you already wrote it:

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
26
27
28
29
30
31
32
33
34
35
class CCharacter
{
  Position m_Pos;
  int  m_AirTimeLeft;
};

class CPlatform
{
  void Read(std::istream &is);

  Position m_Pos;
  int m_Size;
};

class CLevel
{
  void Read(std::istream &is);

  CCharacter m_Character;
  std::vector<CPlatform> m_GoodPlatformVector;
  std::vector<CPlatform> m_BadPlatformVector;
};

class CGame
{
  void Prepare()
  {
    // Open file -> Level.Read()
  }
  void Play()
  {
    // User input -> jump
  }
  CLevel m_Level;
};
Last edited on
Topic archived. No new replies allowed.