Coding game trouble

I am trying to code a game where a bunch of planets spawn as “enemies” and the player has to maneuver around them. I am able to get the player to move and the game to respond if the player collides with a planet, but I cannot get the game to give the player a point when they reach the end. I am using javascript and this is what I tried:
if(parseInt(player.style.top) == 0){
respawn();
scorePlayer += 1;
displayScore();
}
the variables and functions are all already defined and I know that the respawn function works (because it will respawn if it collides with a planet and the displayScore function works because it starts displaying the score (as zero) once the page loads. What am I doing wrong?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.