If you create an object method like this:Every time you create a new instance of MyObject, a new copy of that function is created. This is inefficient. Instead, if you do:Code:function MyObject() { this.func = function() { doNothing(); }; }... the function is only created once, then pointers to it assigned to each new copy of MyObject.Code:function MyObject() { } MyObject.prototype.func = function() { doNothing(); };
In Konqueror, there's an interesting bug: on hitting the apple for the first time, the snake jumps back to its starting point then back to where it was after a few seconds, after which it is unable to collide with the apple (although it can still hit walls).
/EDIT: Also, if you toggle between speeds a few times, your snake goes super-sonic.![]()



Reply With Quote



Bookmarks