-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGame.h
72 lines (58 loc) · 1.38 KB
/
Game.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
#pragma once
#include"tileMap.h"
#include"Entity.h"
#include"Mario.h"
#include"Turtle.h"
#include"GameInfo.h"
#include "Menu.h"
#include"Bonus.h"
#include"Spikey.h"
#include"flyTur.h"
#include"Plant1.h"
#include "Abyss.h"
#include"Plant2.h"
#include<Windows.h>
#include<iostream>
#include<fstream>
#include<SFML/Graphics.hpp>
#include<SFML/Window.hpp>
#define WINDOW_WIDTH 1024
#define WINDOW_HEIGHT 512
#define TOP 0
#define BOTTOM 1
#define LEFT 2
#define RIGHT 3
#define END_GAME 9
#define MUSHROOM_SOUND "assets/sound/mushroom.wav"
#define STOMP_SOUND "assets/sound/stomp.wav"
class Game
{
Mario mario;
std::vector<Entity> mobs;
TileMap map;
GameInfo gameInfo;
Menu menu;
sf::Event sfEvent;
DWORD currentTickCount;
DWORD lastDrawTickCount;
SoundBuffer mushroomBuffer, stompBuffer;
Sound mushroomSound, stompSound;
bool won = false;
public:
sf::RenderWindow* window;
sf::View view;
friend class Mario;
Game();
virtual ~Game();
void intersection(Mario& mario, Entity& entity); //handle collision of mario and mobs
void updateSFMLEvents(); //handles pause and exit
void update(); //combines function to update gameplay
void render(); //draws maps, mobs and handles view
void Menu(int center); //handles controls in menu
void run(); //starts game
void cameraMovement(); //sets view on mario
void repairSFMLTextures();
void drawMobs();
void Bonuses();
void addMobs();
};