beanymanuk Posted May 4, 2010 Share Posted May 4, 2010 Hi I am trying to build this HTML 5 snake game buts the scoring part of the game does not work in firefox anyone know why not? http://blog.new-bamboo.co.uk/2009/12/30/html5-canvas-snake-game Think its around this part of the code function updateScore(){ var score = (snakeLength - 3)*10 document.getElementById('score').innerText = score; } Anyone got any ideas? game here try in Firefox and score does not increase but in Chrome it does http://snake.heroku.com/ Thankyou in advance Link to comment https://forums.phpfreaks.com/topic/200737-html-5-snake-game/ Share on other sites More sharing options...
Alex Posted May 4, 2010 Share Posted May 4, 2010 You're missing a semicolon. var score = (snakeLength - 3)*10; Link to comment https://forums.phpfreaks.com/topic/200737-html-5-snake-game/#findComment-1053336 Share on other sites More sharing options...
beanymanuk Posted May 4, 2010 Author Share Posted May 4, 2010 Good spot that never noticed that was missing. Still the same though score not updating Link to comment https://forums.phpfreaks.com/topic/200737-html-5-snake-game/#findComment-1053339 Share on other sites More sharing options...
Alex Posted May 4, 2010 Share Posted May 4, 2010 You were actually missing that in two places. You fixed it in your gameOver function, but not in your updateScore function. Link to comment https://forums.phpfreaks.com/topic/200737-html-5-snake-game/#findComment-1053341 Share on other sites More sharing options...
beanymanuk Posted May 4, 2010 Author Share Posted May 4, 2010 figured out what was wrong in the end WRONG document.getElementById('score').innerText = score; RIGHT document.getElementById("score").innerHTML = score; Link to comment https://forums.phpfreaks.com/topic/200737-html-5-snake-game/#findComment-1053345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.