This is what I got so far, and it\'s not working at all :( all the variables are null in my player class and update never gets called.
I mean a programming class, not a
You're using Player like a constructor, but it is not set up like one.
Rather than using var
inside the constructor function, like var speed = 5;
you need to use
this.speed=5;
Then it wil return an instance of Player. As it is, you're just setting some variables and returning nothing in particular.
Now, as far as learning JS object creation and inheritance, I suggest checking out Douglas Crockford's resources. As you may know, it's not intended to be class-based like Java, PHP, Python and so on. JavaScript has prototypal inheritance based on cloning objects that already exist.
Crockford discusses doing class-based inheritance in JS in this older article. The problem is, you're not using JS to it's best trying to do that. This treatise may be interesting where he explains one way of cloning objects. That is the Object.beget method, which is good, but has limits as well. The best way is the 'functional' method. Sorry for the PowerPoint links, but you should read this: http://www.crockford.com/codecamp/The%20Good%20Parts%20ppt/4%20prototypal.ppt and this: http://www.crockford.com/codecamp/The%20Good%20Parts%20ppt/5%20functional.ppt
http://video.yahoo.com/watch/630959/2974197 is one version of a video where Crockford discusses the ins and outs of JS. http://www.youtube.com/watch?v=hQVTIJBZook is another of the same.
I really recommend getting the book JavaScript: The Good Parts for a thorough run down of pragmatic advanced JavaScript.