-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.h
61 lines (52 loc) · 1.6 KB
/
Player.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
//
// Player.hpp
// jscreens
//
// Created by Mihika Marathe on 3/1/19 and Felicia Dewanaga on 3/7/19.
// Copyright © 2019 Mihika Marathe and Felicia Dewanaga on 3/7/19. All rights reserved.
//
#ifndef Player_hpp
#define Player_hpp
#include <SFML/Graphics.hpp>
#include <iostream>
#include <stdio.h>
#include "Entity.h"
using namespace std;
class Player : public Entity
{
private:
int lives;
bool shield;
int score;
int hit;
// Textures
int currentTexture;
int currentAttackTexture;
sf::Texture texture;
sf::Texture shieldTexture;
sf::Texture flippedTexture;
sf::Texture flippedShieldTexture;
Direction dir;
Direction sideDir;
public:
Player(sf::Texture& inputTexture, sf::Texture& inputShieldTexture, sf::Texture& inputFlippedTexture, sf::Texture& inputFlippedShieldTexture, float h, float w);
void move(Direction d);
void applyShield();
void loseShield();
void loseLife();
int getLives();
void increaseLife();
int getScore();
bool getShield();
void setHit(int h) { hit = h; };
int getHit() const { return hit; };
bool attack(float monster_x, float monster_y, sf::Vector2f monster_size);
void attackAnimation();
void incrementCurrentAttackTexture() { currentAttackTexture++; }
double getDistance(float monster_x, float monster_y);
bool collectCoin(float coin_x, float coin_y, float coinSize_x, float coinSize_y);
bool hitByMonster(float monster_x, float monster_y, sf::Vector2f monster_size);
friend ostream& operator <<(ostream& op, Player &val);
~Player();
};
#endif /* Player_hpp */