-
Notifications
You must be signed in to change notification settings - Fork 0
/
Level.h
125 lines (110 loc) · 3.49 KB
/
Level.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
Group #: 3
Members: Chris Prosser, Jacob Gearhart, Kory Kappel, Andrew Miller
Course: COMP 322, Advanced Programming
Date: 28 October 2013
Description: This file is inherited from the skeleton
provided by Charles Kelly. We have modified names, includes,
and added specific functionality to the level class.
*/
// Programming 2D Games
// Copyright (c) 2011 by:
// Charles Kelly
// Chapter 6 level.h v1.0
//currently when the nimkip tries to go to lifting mode everything dies
#ifndef _LEVEL_H // Prevent multiple definitions if this
#define _LEVEL_H // file is included in more than one place
#define WIN32_LEAN_AND_MEAN
#include "game.h"
#include "textureManager.h"
#include "image.h"
#include "textDX.h"
#include "hud.h"
#include "object.h"
#include "random.h"
#include "broblub.h"
#include "nimkip.h"
#include "carriable.h"
#include "grid.h"
#include "base.h"
#include "statue.h"
#include <sstream>
#include <vector>
#include <fstream>
using std::ofstream;
using std::vector;
//=============================================================================
// This class is the core of the game
//=============================================================================
class level : public Game
{
public:
// Constructor
level();
level(int numEnemies, int numKips, int maxKips, int sizeX, int sizeY);
// Destructor
virtual ~level();
// Initialize the game
void initialize(HWND hwnd);
void update(); // must override pure virtual from Game
void ai(); // "
void collisions(); // "
void render(); // "
void releaseAll();
void resetAll();
void restart();
void gameOver();
void runTimeStep();
static bool transferObject(Lifeform* receiver, GridLoc item);
static bool runAttack(Lifeform* attacker, GridLoc target); //returns true if target is completely destroyed
static vector<GridLoc> getSurroundings(GridLoc currentLocation, int sightRadius);
static Space getTileType(GridLoc tile);
static void collectCoin(GridLoc coinLocation);
static Surroundings getSurroundings(GridLoc currentLocation);
static void getUserInput();
static int getGridHeight();
static int getGridWidth();
static NimkipInfo getNimkipInfo(GridLoc nimkip);
bool isRunning(){return !paused;}
void pause(){paused = true; hud.setCurrentFrame(0); grid.clearInput();}
void unpause(){paused = false;}
TextDX* getFont() {return gameFont;}
private:
// game items
TextureManager gridTexture; // grid texture
TextureManager backgroundTexture; // orion texture;
TextureManager gameTextures; // game texture
TextureManager hudTexture;
TextureManager winScreenTexture, gameOverScreenTexture;
ofstream debug;
static Grid<Tile> grid;
Image background, winScreen, gameOverScreen;
HUD hud;
TextDX* gameFont;
std::stringstream ss;
Random rgen;
bool paused;
int frameCount;
int turns;
int score;
int numKips, maxKips, mapSizeX, mapSizeY;
int foodCollected;
static int numEnemies;
//end game stuff
bool win;
bool lose;
bool endGame;
//vector of carriable items
static vector<Carriable*> carriableItems;
//vector of noncarriables ie obstacles and such
static vector<Object*> unCarriables;
//vector that contains both so that it can control both at once
static vector<Lifeform*> lifeForms;
//void createEmptyLevel();
void fillLevel();
//finds the lifeform pointer associated with a position
static Lifeform* identifyLifeForm(GridLoc pos);
//same thing but for an object
static Carriable* identifyObject(GridLoc pos);
};
#endif