Let's proceed to drawing the race track in the drawField() method.
To set the color of a specific cell, use the setCellColor(int, int, Color) method. The passed arguments are the x and y coordinates and the color.
Keep in mind that the playing field consists of three zones that must be painted usin
Racer (Part 3/28)
- 3
Locked
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Mike S
4 January, 00:55
I felt like I had all of the steps worked out and the code made sense to me. But when I ran and verified... it blew up in my face. A lot of exceptions and red font on the console, not a single green check, and not even a coherent-looking grid. Any hints to help me advance on this one?
0
Justin Smith
26 November 2021, 15:50
This part is very cranky about how it validates how you draw the colors. There are several ways to approach it but if you aren't doing it exactly like the solution it will tell you that the road surface must be a single color (which isn't even really true because the line in the middle is part of the road surface). You must nest the if statements inside the double for loop. If you instead nest for loops inside if statements, it will work but won't validate. If you have it working right and you are sure but it still won't validate, just look at the solution and reorganize your conditionals the way it wants it. It would be nice if the validation could check by evaluating the colors when it's run.
0