-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBall.h
83 lines (69 loc) · 1.51 KB
/
Ball.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#pragma once
#include "GameObject.h"
#include "Player.h"
class Player;
class Ball;
class Pointer
{
public:
Pointer();
~Pointer();
virtual void LoadPointer(Ball* b, sf::View* camera, std::string location);
virtual void UpdatePointer();
virtual void DrawPointer(sf::RenderWindow& window);
private:
Ball* _ball;
sf::View* _camera;
sf::Texture _texture;
sf::Sprite _sprite;
float _scale;
};
class Trail
{
public:
Trail();
~Trail();
// Main Functions
virtual void LoadTrail(Ball* b);
virtual void UpdateTrail();
virtual void UpdateTrailColor();
virtual void DrawTrail(sf::RenderWindow& window);
private:
sf::VertexArray _trail;
sf::Color _trailColor;
float _trailWidth;
int _colAmount;
int _colMin;
int _colMax;
Ball* _b;
};
class Ball : public GameObject, public Trail, public Pointer {
public:
Ball();
~Ball();
bool slowMode;
sf::SoundBuffer _reflectBuffer;
sf::Sound _reflectSound;
// Main Functions
void LoadAudio();
bool LoadSecondary(std::map<std::string, Player*> _playerList, sf::View* camera);
void Update(float timeDelta);
void DrawSecondary(sf::RenderWindow& window);
// Ball Control
void SearchPlayer(Player* sender);
void ReflectionCheck();
void Reflect(float _a, Player* p);
// Gets
float GetDistance(sf::Vector2f a, sf::Vector2f b);
float GetScale();
float GetAngle();
int GetQuadrant();
Player* gTarget();
private:
std::map<std::string, Player*> _players;
sf::Vector2f _currentPos;
sf::Vector2f _futurePos;
Player* _currentTarget;
Player* _sender;
float _reflectionPower;
};