-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCplayerBullet.cpp
More file actions
executable file
·29 lines (24 loc) · 932 Bytes
/
CplayerBullet.cpp
File metadata and controls
executable file
·29 lines (24 loc) · 932 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 "CplayerBullet.h"
CplayerBullet::CplayerBullet(float x, float y): x(x), y(y) {
//empty
}
bool CplayerBullet::step() {
y += PLAYER_BULLET::SPEED;
//ask to be destroyed if gone offscreen
if (y-Copengl::convert_pixel_height(IMAGES::PLAYER_BULLET::HEIGHT) > OPENGL::TOP_Y) {
return true;
}
return false;
}
OPENGL::vanillaPoint* CplayerBullet::draw(Copengl &opengl, OPENGL::vanillaPoint* freeSpace) {
return opengl.add_rectangle(x, y, PLAYER_BULLET::DEPTH,
opengl.convert_pixel_width(IMAGES::PLAYER_BULLET::WIDTH), opengl.convert_pixel_height(IMAGES::PLAYER_BULLET::HEIGHT),
IMAGES::PLAYER_BULLET::TEX_X, IMAGES::PLAYER_BULLET::TEX_Y,
IMAGES::PLAYER_BULLET::TEX_W, IMAGES::PLAYER_BULLET::TEX_H, freeSpace);
}
float CplayerBullet::get_x() {
return x;
}
float CplayerBullet::get_y() {
return y;
}