-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.cpp
More file actions
35 lines (25 loc) · 868 Bytes
/
Copy pathPlayer.cpp
File metadata and controls
35 lines (25 loc) · 868 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
30
31
32
33
34
35
#include "Player.h"
Player::Player(const char* path, SDL_Renderer* rend, Vector2D pos, std::string n, int srcW, int srcH, int scale) : GameObject(path, rend, pos, srcW, srcH, scale, n) {
std::cout << "Player created at x: " << std::to_string(pos.x) << " y: " << std::to_string(pos.y) << std::endl;
}
Player::Player(const char* path, SDL_Renderer* rend, int x, int y, std::string n, int srcW, int srcH, int scale) : GameObject(path, rend, x, y, srcW, srcH, scale, n) {
std::cout << "Player created at x: " << std::to_string(x) << " y: " << std::to_string(y) << std::endl;
}
Player::~Player() {
std::cout << "Player deleted\n";
}
void Player::move(Vector2D mov) {
setPos(getPos() + mov);
}
void Player::subLives() {
lives--;
}
void Player::addLives() {
if (lives < 20)
lives++;
}
int Player::getLives() {
return lives;
}
void Player::onCollision() {
}