-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlevelobject.cpp
More file actions
29 lines (27 loc) · 765 Bytes
/
Copy pathlevelobject.cpp
File metadata and controls
29 lines (27 loc) · 765 Bytes
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
#include "levelobject.h"
#include "resources.h"
#include "collisionchecker.h"
LevelObject::LevelObject(PixelCoords pos, int var) {
position = pos;
variation = var;
switch (var) {
case 0:
w = CollisionChecker::BLOCK_WIDTH0;
h = CollisionChecker::BLOCK_HEIGHT0;
break;
case 1:
w = CollisionChecker::BLOCK_WIDTH1;
h = CollisionChecker::BLOCK_HEIGHT1;
break;
case 2:
w = CollisionChecker::BLOCK_WIDTH2;
h = CollisionChecker::BLOCK_HEIGHT2;
break;
}
}
void LevelObject::draw() {
Resources* resources = Resources::instance();
ALLEGRO_BITMAP* img = resources->imgLevelObject[variation];
PixelCoords imgPos = antiCenter(position, al_get_bitmap_width(img), al_get_bitmap_height(img));
al_draw_bitmap(img, imgPos.x, imgPos.y, 0);
}