-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFan.cpp
More file actions
76 lines (67 loc) · 1.45 KB
/
Fan.cpp
File metadata and controls
76 lines (67 loc) · 1.45 KB
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
#include "Fan.h"
void Fan::drawFan()
{
glPushMatrix();
glTranslatef(_xPos, _yPos, _zPos);
drawHead();
drawBody();
glPopMatrix();
}
void Fan::drawBody()
{
glPushMatrix();
if(_playerNumber == 1)
glColor3f(1, 0, 0);
if (_playerNumber == 2)
glColor3f(0, 0, 1);
glTranslatef(0, -100.0, 0);
glutSolidCube(90);
glPopMatrix();
}
void Fan::drawHead()
{
glPushMatrix();
glColor3f(255, 255, 0);
glColor3f(255, 255, 0);
glutSolidSphere(PlayerHeadSize, 50, 50);
glPopMatrix();
}
void Fan::FanJumpUpdate()
{
//skakanje fanova pri radovanju je identicno uradjeno kao skok igraca, samo sa drugim parametrima
if(_fanJumpState == playerJumpState::GROUND)
return;
if(_fanJumpState == playerJumpState::UP)
{
_yPos+=7;
}
if(_fanJumpState == playerJumpState::DOWN)
{
_yPos-=10;
}
if(_yPos >= (160.0 + _fanRow*110))
{
_fanJumpState = playerJumpState::DOWN;
}
if(_yPos < (70.0 + _fanRow*110))
{
_fanJumpState = playerJumpState::GROUND;
_yPos = 70.0 + _fanRow*110;
}
}
void Fan::Reset()
{
switch (_fanRow)
{
case 0:
_yPos = 70;
break;
case 1:
_yPos = 180;
break;
case 2:
_yPos = 290;
break;
}
_fanJumpState = playerJumpState::GROUND;
}