-
Notifications
You must be signed in to change notification settings - Fork 0
/
Character.h
68 lines (53 loc) · 1.69 KB
/
Character.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
61
62
63
64
65
66
67
68
//#pragma once
#ifndef CHARACTER_H
#define CHARACTER_H
#include <SFML/Graphics.hpp>
#include "Map.h"
class Character{
public:
//default constructor
Character();
//constructor
Character(float velocity, float acceleration, sf::Texture & textureR, sf::Texture & textureL, sf::Texture & textureR2, sf::Texture & textureL2, Map * theMap, sf::SoundBuffer fallDeathBuffer, sf::SoundBuffer jumpBuffer, sf::SoundBuffer incBreakBuffer, sf::RenderWindow * theWindow);
//moves character (theWep used to check sides for animation)
void move(Weapon * theWep);
//detect collision between character and ground blocks
void detectCollisionCG();
//draw charSprite
void draw();
sf::RectangleShape getShape(); //used for detectCollisionFC in Map.h
sf::Sprite getSprite(); //used for setPos in Weapon.h
private:
//set color and delete ground block at appropriate times
void onBlock(int i);
//walking animation for player
void animation(Weapon * theWep);
float vel;
float accl;
float goX = 0.0f;
float goY = 0.0f;
bool jumping = false;
bool cgIntersect = false; //character+ground block intersect
bool botL = false;
bool botR = false;
bool animMode = false; // false is right/left and true is right2/left2
bool onBlockB = false;
float windowYmGBH;
sf::Clock clock; //used for animation
sf::Sprite charSprite;
sf::Sprite charSpriteR;
sf::Sprite charSpriteL;
sf::Sprite charSpriteR2;
sf::Sprite charSpriteL2;
Map * charMap;
sf::RectangleShape charShape; //used for hitbox
sf::SoundBuffer fdBuffer;
sf::SoundBuffer jBuffer;
sf::SoundBuffer ibBuffer;
sf::Sound sound;
sf::Sound sound2;
sf::Clock clock2; //used for destroying ground block
sf::Sprite * gbSprite;
sf::RenderWindow * window;
};
#endif