[SOLVED] [work in progress] Error in the game creation for the sphere to move

I had a problem with my game, can you give me hints, advice, or anything

I had a problem screenshot the game error so here is the error
[move.js?id=8837089:12]: Uncaught SyntaxError: Unexpected token }
SyntaxError: Unexpected token }

var Move = pc.createScript('move');

// initialize code called once per entity
Move.prototype.initialize = function() {
    
};

// update code called every frame
Move.prototype.update = function(dt) {
    this.entity.translateLocal(0.01, -0.9, 0.10);
}
};



    return Move;
));

As it is a SyntaxError, that means there is something wrong with the code itself rather than the logic. The error message ‘Unexpected token }’ means there is an extra } somewhere in the code. The error message also tells you which line it thinks that the error is on.

Looks like you’re upgrading a script from the previous scripting system? You have some additional unnecessary code at the end. Your code should be:

var Move = pc.createScript('move');

// initialize code called once per entity
Move.prototype.initialize = function() {
    
};

// update code called every frame
Move.prototype.update = function(dt) {
    this.entity.translateLocal(0.01, -0.9, 0.10);
};
1 Like

Hi Will,

I did put the correct code in but it said this

Error loading scripts. Open the browser console for details.

how do I get to the browser console

since I still have issues and still learning to code in java script, do you like to join the platformer 2 project

If you’re on Chrome, you should be able to bring up the console by pressing CTRL+SHIFT+I (more details).

You can also just right click anywhere on the page and click “Inspect Element” and it will bring up the developer tools.

You have hit the same problem as this user: [SOLVED] My script doesn't work

1 Like