-
Notifications
You must be signed in to change notification settings - Fork 0
/
Difficulty.cs
68 lines (65 loc) · 2.05 KB
/
Difficulty.cs
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
using System.Windows.Forms;
namespace CarRacingGame
{
class Difficulty : Game
{
// Inehrit base class constructor parameters
public Difficulty(PictureBox ai1, PictureBox ai2, PictureBox ai3, PictureBox road1, PictureBox road2) : base(ai1, ai2, ai3, road1, road2)
{
}
// Increase road and AI speed based on score
public void IncreaseSpeed(double currentScore)
{
if (currentScore <= 30)
{
RoadSpeed = 5;
AISpeed = 5;
aiCar1.Top += AISpeed;
aiCar2.Top += AISpeed;
aiCar3.Top += AISpeed;
road1.Top += RoadSpeed;
road2.Top += RoadSpeed;
}
else if (currentScore <= 45)
{
RoadSpeed = 7;
AISpeed = 7;
aiCar1.Top += AISpeed;
aiCar2.Top += AISpeed;
aiCar3.Top += AISpeed;
road1.Top += RoadSpeed;
road2.Top += RoadSpeed;
}
else if (currentScore <= 60)
{
RoadSpeed = 10;
AISpeed = 10;
aiCar1.Top += AISpeed;
aiCar2.Top += AISpeed;
aiCar3.Top += AISpeed;
road1.Top += RoadSpeed;
road2.Top += RoadSpeed;
}
else if (currentScore <= 75)
{
RoadSpeed = 12;
AISpeed = 12;
aiCar1.Top += AISpeed;
aiCar2.Top += AISpeed;
aiCar3.Top += AISpeed;
road1.Top += RoadSpeed;
road2.Top += RoadSpeed;
}
else if (currentScore <= 90 || currentScore >= 90)
{
RoadSpeed = 15;
AISpeed = 15;
aiCar1.Top += AISpeed;
aiCar2.Top += AISpeed;
aiCar3.Top += AISpeed;
road1.Top += RoadSpeed;
road2.Top += RoadSpeed;
}
}
}
}