-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayStateVsAI.h
60 lines (41 loc) · 1.43 KB
/
PlayStateVsAI.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
#ifndef _PLAYSTATEVSAI_H_
#define _PLAYSTATEVSAI_H_
#include "GameState.h"
class PlayStateVsAI : public GameState
{
public:
PlayStateVsAI();
virtual ~PlayStateVsAI();
void Init( MainGame *Game );
void Cleanup();
void Pause();
void Resume();
void OnEvent( MainGame *Game, sf::Event Event );
void OnUpdate( MainGame *Game );
void Draw( MainGame *Game );
static PlayStateVsAI *Instance();
bool check_collision( sf::Sprite A, sf::Sprite B );
void showWinner( MainGame *Game , Winner win );
void moveAI();
private:
static PlayStateVsAI mPlayStateVsAI;
private:
sf::Clock mClock;
sf::Image mBgPlayerOneWins;
sf::Image mBgPlayerTwoWins;
sf::Sprite mPlayerOneSprite;
sf::Sprite mPlayerTwoSprite;
sf::Image mBgWhite;
sf::Image mBgGray;
sf::Sprite mPad1, mPad2, mBall, mSeparator;
// scores
float mPadSpeed, mBallSpeed;
int mBallDirectionX, mBallDirectionY, mBallAlive;
int mPad1Score, mPad2Score;
float mCPULevel;
float mSpeedUp, mSpeedDown;
float mCPULevelUp;
sf::SoundBuffer mSoundBuffer;
sf::Sound mSoundHit;
};
#endif