-
Notifications
You must be signed in to change notification settings - Fork 2
/
game.cpp
46 lines (37 loc) · 959 Bytes
/
game.cpp
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
#include "game.h"
#include "view.h"
#include <QApplication>
#include <QDesktopWidget>
#include "slime.h"
#include "player.h"
#include "skeleton.h"
Game::Game(View *view)
{
this->view = view;
this->scene = view->scene();
QRect resolution = QApplication::desktop()->screenGeometry();
this->WIDTH = resolution.width();
this->HEIGHT = resolution.height();
}
void Game::load(){
resource = new Resource();
resource->load();
camera = new Camera(this);
world = new World(this);
world->loader->loadTilesheet();
world->loader->loadWorld();
scene->addItem(world);
loadEntities();
gui = new Gui(this);
scene->addItem(gui);
}
void Game::loadEntities(){
world->addEntity(new Slime(this, 300, 300));
world->addEntity(new Skeleton(this, 200, 200));
}
void Game::update(){
STEPS++;
player->update();
world->update();
player->pickup();
}