File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 6262 text-align : center;
6363 margin-top : 20px ;
6464 }
65+ # settings input [type = "number" ] {
66+ padding : 6px ;
67+ height : 16px ;
68+ font-size : 16px ;
69+ }
70+ # settings input [type = "color" ] {
71+ height : 32px ;
72+ width : 50px ;
73+ vertical-align : middle;
74+ }
6575 # countdown {
6676 font-size : 48px ;
6777 text-align : center;
@@ -115,6 +125,7 @@ <h1 style="text-align: center;">🎉🏁 Math Race Game 🏁🎉</h1>
115125ai_car = document [ "ai-car" ]
116126track_div = document [ "track" ]
117127countdown_div = document [ "countdown" ]
128+ color_input = document [ "car-color" ]
118129
119130# Utility Functions
120131def move_car ( car , steps ) :
@@ -187,7 +198,7 @@ <h1 style="text-align: center;">🎉🏁 Math Race Game 🏁🎉</h1>
187198
188199 NUM_QUESTIONS = int ( document [ "num-questions" ] . value )
189200 AI_INTERVAL_MS = int ( document [ "ai-speed" ] . value )
190- player_car . style . backgroundColor = document [ "car-color" ] . value
201+ player_car . style . backgroundColor = color_input . value
191202
192203 track_width = track_div . offsetWidth
193204 car_width = player_car . offsetWidth
@@ -217,6 +228,10 @@ <h1 style="text-align: center;">🎉🏁 Math Race Game 🏁🎉</h1>
217228 countdown_div . text = "3"
218229 start_countdown ( )
219230
231+ def update_car_color ( ev ) :
232+ player_car . style . backgroundColor = color_input . value
233+
234+ color_input . bind ( "input" , update_car_color )
220235document [ "start-btn" ] . bind ( "click" , on_start_click )
221236 </ script >
222237</ body >
You can’t perform that action at this time.
0 commit comments