-
Notifications
You must be signed in to change notification settings - Fork 0
/
Playership.cpp
56 lines (33 loc) · 1.19 KB
/
Playership.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
#include "Playership.h"
#include <iostream>
#include <vector>
using namespace std;
Playership::Playership(int ScreenHeight, int ScreenWidth):_ScreenHeight{ScreenHeight},_ScreenWidth{ScreenWidth}
{
float StartAngle = 89.44;
PlayerCraft.setFillColor(sf::Color(137, 207, 240));
PlayerCraft.setRadius(50);
PlayerCraft.setOrigin(PlayerCraft.getRadius(), PlayerCraft.getRadius());
PlayerCraft.setPosition(404, 679);
}
void Playership::moveClockwise(){
Coordinate_x = PlayerRadius*cos(StartAngle);
Coordinate_y = PlayerRadius*sin(StartAngle);
StartAngle+=0.05;
PlayerCraft.setPosition(Coordinate_x + _ScreenWidth / 2.0f, Coordinate_y + _ScreenHeight / 2.0f);
}
void Playership::moveAntiClockwise(){
Coordinate_x = PlayerRadius*cos(StartAngle);
Coordinate_y = PlayerRadius*sin(StartAngle);
StartAngle-=0.05;
PlayerCraft.setPosition(Coordinate_x + _ScreenWidth / 2.0f, Coordinate_y + _ScreenHeight / 2.0f);
}
void Playership::DrawPlayer(sf::RenderWindow &window){
window.draw(PlayerCraft);
}
float Playership::GetLastPositionX(){
return PlayerCraft.getPosition().x;
}
float Playership::GetLastPositionY(){
return PlayerCraft.getPosition().y;
}