-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontrol.hpp
36 lines (33 loc) · 979 Bytes
/
control.hpp
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
#ifndef CONTROL_H_INCLUDED
#define CONTROL_H_INCLUDED
#include "../Header/tao.hpp"
#include "../Header/scenes.hpp"
int s = 10;
void user_interact(Tao &tao)
{
if(Keyboard::isKeyPressed(Keyboard::Left) && y >= ground && stuck != -1){
tao.RolnRun(-s);
}
else if(Keyboard::isKeyPressed(Keyboard::Right) && y >= ground && stuck != 1){
tao.RolnRun(s);
}
if(Keyboard::isKeyPressed(Keyboard::Up) && pressUpCount == 0){
++pressUpCount;
tao.kick();
if(pressUpCount==1) velocityY = -30;
}
if(Keyboard::isKeyPressed(Keyboard::Escape)) currentScene = gamePaused;
if(velocityX != 0){
tao.roll(velocityX);
}
/*
if(Keyboard::isKeyPressed(Keyboard::Escape)){
Clock clk;
while(!(clk.getElapsedTime().asSeconds() >= 100000)){
if(Keyboard::isKeyPressed(Keyboard::Backspace))
break;
}
}
*/
}
#endif // CONTROL_H_INCLUDED