File tree 3 files changed +14
-20
lines changed
3 files changed +14
-20
lines changed Original file line number Diff line number Diff line change @@ -35,13 +35,14 @@ function moveEnemies(playercar) {
35
35
othercarb = item . getBoundingClientRect ( ) ;
36
36
if ( ! ( ( playercarb . bottom < othercarb . top ) || ( playercarb . top > othercarb . bottom ) || ( playercarb . left > othercarb . right ) || ( playercarb . right < othercarb . left ) ) ) {
37
37
// alert("Press OK to play again");
38
- alert ( "The Score is " + ( score ) + "\n Press OK to play again" ) ;
38
+ alert ( "The Final Score is " + ( score ) + "\n Press OK to play again" ) ;
39
39
location . reload ( )
40
40
player . start = false ;
41
41
}
42
42
if ( item . y >= 815 ) {
43
43
// Player will earn score when the car will pass enemy car
44
44
score = score + 1 ;
45
+ startBtn . innerHTML = "Score: " + score ;
45
46
item . y = - 300 ;
46
47
item . style . left = Math . floor ( Math . random ( ) * 350 ) + 'px' ;
47
48
}
@@ -129,9 +130,10 @@ function init() {
129
130
}
130
131
131
132
function startgame ( ) {
132
- startBtn . innerHTML = "Use Arrow keys to Navigate " ;
133
- startBtn . style . opacity = 0.65 ;
133
+ document . querySelector ( ".push" ) . style . border = "5px solid rgb(86,50,57) " ;
134
+ startBtn . style . backgroundColor = "rgb(86,50,57)" ;
134
135
startBtn . style . cursor = "not-allowed" ;
136
+ startBtn . innerHTML = "Use Arrow keys to Navigate" ;
135
137
init ( ) ;
136
138
}
137
139
Original file line number Diff line number Diff line change 5
5
< meta charset ="UTF-8 " />
6
6
< meta http-equiv ="X-UA-Compatible " content ="IE=edge " />
7
7
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
8
- < title > Document </ title >
8
+ < title > Car Game </ title >
9
9
< link rel ="stylesheet " href ="style.css " />
10
10
</ head >
11
11
12
12
< body >
13
13
< div class ="container ">
14
14
< div class ="road ">
15
- < div class =" push " >
16
- < button class ="btn " onclick =" startgame() " > Start Game </ button >
17
- </ div >
15
+ </ div >
16
+ < div class ="push " >
17
+ < button class =" btn " onclick =" startgame() " > Start Game </ button >
18
18
</ div >
19
19
</ div >
20
20
Original file line number Diff line number Diff line change 10
10
} */
11
11
body {
12
12
overflow : hidden;
13
+
13
14
}
14
15
15
16
.container {
16
17
background-color : rgb (118 , 189 , 159 );
17
18
background-size : cover;
18
19
min-height : 99% ;
19
-
20
- /* Equal to height of footer */
21
- /* But also accounting for potential margin-bottom of last child */
22
- margin-bottom : -50px ;
23
- /* visibility: hidden; */
24
-
25
20
}
26
21
27
22
.road {
28
23
background-color : black;
29
- height : 100 vh ;
24
+ height : 93 vh ;
30
25
width : 400px ;
31
26
margin : auto;
32
27
position : relative;
33
28
border-left : 5px white dashed;
34
29
border-right : 5px white dashed;
35
30
z-index : 1 ;
36
- /* display: flex; */
37
- /* border-collapse: collapse;
38
- display: table; */
39
31
}
40
32
41
33
.lines {
73
65
}
74
66
75
67
.btn {
76
-
77
68
background-color : crimson;
78
69
color : # fff ;
79
70
border : 1px solid;
86
77
87
78
.push {
88
79
height : 50px ;
89
- top : 100% ;
90
- transform : translateY (1515% );
80
+ width : 401px ;
81
+ transform : translateX (107% );
82
+ border : 5px solid crimson;
91
83
}
You can’t perform that action at this time.
0 commit comments