Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

can interact with the game

cant interact with the game

my workspace: w.trhou.se/v5x93iq5cr

1 Answer

Steven Parker
Steven Parker
231,269 Points

This won't be a simple fix, you've got a bit of debugging to do. I can show you a couple of examples and make some suggestions.

One issue is argument ordering, for example:

// in Player.js:
class Player {
    constructor(name,id,color,active= false){                 // note: id comes before color

// but then in Game.js:
      const players=[new Player('player1','#e15258',1,true),  // yet color is given before id

Another issue is operator usage:

// in Game.js:
        if(event.Key='ArrowLeft'){    // note: assignment (=) used instead of comparison (==)

Since they are available, you might want to download the Project Files. Many errors can be identified by comparing your code to the project download files.

This might also be a good time to get familiar with the debugging capabilities of the browser's built-in developer tools. There are some courses and workshops available such as Debugging JavaScript in the Browser.