My game plays itself?
Posted
by
sc8ing
on Stack Overflow
See other posts from Stack Overflow
or by sc8ing
Published on 2012-04-04T23:15:16Z
Indexed on
2012/04/04
23:29 UTC
Read the original article
Hit count: 106
I've been making a canvas game in HTML5 and am new to a lot of it. I would like to use solely javascript to create my elements too (it is easier to embed into other sites this way and I feel it is cleaner). I had my game reloading in order to play again, but I want to be able to keep track of the score and multiple other variables without having to put each into the URL (which I have been doing) to make it seem like the game is still going. I'm also going to add "power ups" and other things that need to be "remembered" by the script.
Anyways, here's my question. When one player kills another, the game will play itself for a while and make my computer very slow until I reload the page. Why is it doing this? I cleared the interval for the main function (which loops the game and keeps everything running) and this used to make everything stop moving - it no longer does. What's wrong here?
This is my game: http://dl.dropbox.com/u/11168436/game/game.html
Controls: Move the skier with arrow keys and shoot with M (you shoot in the direction you were last moving in). The snowboarder is moved with ESDF and shoots with Q.
Thanks for your time.
© Stack Overflow or respective owner