-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpeedSettings.cpp
80 lines (72 loc) · 1.54 KB
/
SpeedSettings.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
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
//Defines the functions layed out in the Speed Settings struct in the HeaderStuff.h
#include "headerstuff.h"
/*
THE IMPLEMENTATIONS FOR THE STRUCT SPEEDSETTINGS
*/
/*
Description: PieceSetting Constructor
Assumption : nada
Postcondition: Sets basic movement speed
values that correspond with
keys
*/
SpeedSettings::SpeedSettings()
{
forced_drop_pause_ = .50;
move_horizontal_speed_ = .1;
move_vertical_speed_ = .010;
flip_speed_ = .25;
}
/*
Description: passes a value and resets the
forced drop value time
Assumption : nada
Postcondition: value is set accordingly with
its internal switch statement
*/
void SpeedSettings::handleSpeedSettings(const int& speedLevel)
{
forced_drop_pause_ = .50;
move_horizontal_speed_ = .1;
move_vertical_speed_ = .010;
flip_speed_ = .25;
//The higher the number picked, the more speed up it calls to
//preset the speed
switch(speedLevel)
{
default:
speedUp();
case 8:
speedUp();
case 7:
speedUp();
case 6:
speedUp();
case 5:
speedUp();
case 4:
speedUp();
case 3:
speedUp();
case 2:
speedUp();
case 1:
speedUp();
case 0:
break;
}
//I dont want breaks
}
/*
Description: A method used to speed up the speed variables
Implementation: multiplying each member variable of speed settings
by a multiplier
Purpose: A robust way to edit the multiplier
*/
void SpeedSettings::speedUp()
{
forced_drop_pause_ *= .8;
move_horizontal_speed_ *= .9;
move_vertical_speed_ *= .85;
flip_speed_ *= .95;
}