var spaceship = {
fps : 10,
speed : 1,
traveled : 0,
currency : 0,
initialize : function() {
this.update();
},
update : function() {
this.traveled += this.speed/this.fps;
setTimeout(this.update, 1000/this.fps);
this.render();
},
render : function() {
$("#spaceshipbg").attr("background-position", "0px "+this.traveled+"px");
}
};
$(document).ready(function() {
spaceship.initialize();
});
So this is my code, Whenever i load up the page, i get an error with the line "this.render()". I can't see the problem here, i can successfully call this.update() from the initialize function, but when i call this.render() it says it's undefined