Skip to content
← Back to Community
Colors don't work.
Profile icon
3498024

I'm currently following a "Guide to Asking Coding Questions" post because I'm bad at explaining things.

What I want the code to do:

Make a 3x3 grid, with each box having an id to change it's background color with. Set a "playerPosition" to somewhere around the center of the world. Create a "world" array and store 256 things, which are 1s and 0s. These represent two different tiles I'm using in this project. Create a "worldColors" array to store hex color codes, "#a0a0a0" for every "0" in "world", and "#5c5c5c" for every "1" in "world". Change the background of each box in the 3x3 grid to show the colors around the "playerPosition" to their corresponding colors in the "worldColors" array.

What the code does:

Makes a 3x3 grid. I can't tell anything else.

Error messages:

None, I couldn't find any. If there are any, I'm sorry, didn't see them, new to Repl.

Line numbers:

Scattered around the script.js file.

Repl link:

https://repl.it/@3498024/project1#script.js

This could also be, because the html file doesn't communicate with the script file correctly.

Do Hex codes not work? I am pretty sure they do.

Voters
Profile icon
uh1093
Profile icon
Coder100
Profile icon
3498024
Comments
hotnewtop
Profile icon
Coder100

Wow, thank you for taking your time to write your questioh like that! You will not believe how many people overlook this important step!

Profile icon
PattanAhmed

@Coder100 Imao!
Me first :)