-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCaveManager.h
58 lines (43 loc) · 1.33 KB
/
CaveManager.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* CaveManager.h
*
* Copyright 2009 Stephen Eisenhauer <mail@stepheneisenhauer.com>
*
* Class header for CaveManager objects.
*/
#include "Drawing.h"
#include "Column.h"
#ifndef CAVEMGR_H
#define CAVEMGR_H
#define CAVE_HEIGHT 64
#define NUM_COLUMNS 16
#define NUM_OBSTACLES 0
#define OBSTACLE_SPACING (int)((WIDTH + (2.0 * MARGIN)) / NUM_OBSTACLES)
#define CAVE_SPEED 3
#define MARGIN 16
#define COL_WIDTH (int)((WIDTH + (2.0 * MARGIN)) / NUM_COLUMNS)
#define INITIAL_CAVE_TOP 8
#define INITIAL_CAVE_SPACING 48
#define MIN_CAVE_SPACING 20
#define MAX_CAVE_TOP_CHANGE 2
class CaveManager {
private:
friend class Column; // TODO: Not sure this is needed
Column roof[NUM_COLUMNS]; // Roof columns
Column ground[NUM_COLUMNS]; // Ground columns
Column obstacles[NUM_OBSTACLES]; // Obstacle columns
float caveTop; // Holds the y-coordinate for the top of the cave
float caveSpacing; // Holds the current height of the cave
unsigned short first; // Index of the first column
public:
// Constructors and destructor
CaveManager(); // default constructor
~CaveManager(); // destructor
// Initializer
void resetAll(); // All columns to starting positions!
bool CollidesWithPlayer();
// Operations
void update(); // Recalculate positions
void Draw(); // Draw the columns to the screen
};
#endif