-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathplayer.cpp
72 lines (59 loc) · 1.19 KB
/
player.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//
// player.cpp
//
//
// Created by Munger Rufus on 2015-05-09.
//
//
#include "player.h"
class player
{
private:
sf::Sprite sprite;
sf::RectangleShape rect;
// Stats
int level = 1;
int hp = 10;
int str = 5;
int vit = 5;
int dex = 5;
// Animation
playerAnimationState = 0;
walkingAnimationLengthCounter = 0;
public:
player() // Default Constructor
{
// Rect
rect.setPosition(100, 100);
rect.setOrigin(50,50);
rect.setSize(sf::Vector2f(100, 100));
rect.setFillColor(sf::Color::Green);
// Sprite
sprite.setOrigin(100,100);
sprite.setPosition(100, 100);
}
void displayStats()
{
cout << "level: " << level << endl;
cout << "hp: " << hp << endl;
cout << "str: " << str << endl;
cout << "vit: " << vit << endl;
cout << "dex: " << dex << endl;
}
void update()
{
// Keep sprite at rect
spritePlayer.setPosition(rect.getPosition());
spritePlayer.setRotation(rect.getRotation());
}
void attack()
{
}
void usePotion()
{
hp = hp + 10;
}
void changeEquipment()
{
}
};