The error isn't defined, the page simply doesn't finish compiling the code when I put
obj_player.step() or obj_player.draw() inside the system functions.
I fixed it right now though., looking back at my code. It seems I forgot to add a "this" statement infront of a variable
Thanks devnull!
I have new question , still in relation to objects so I'll continue it here.
So, I got the drawing script to work :
Code:
this.draw = function()
{
ctx.drawImage( this.sprite.spr_stand , this.x, this.y);
}
I want to use a state for my sprite, so I have this set up :
Code:
this.floor = 0;
this.air = 1;
this.state = this.air;
this.sprite = {
spr_stand: image_index.player_stand,
spr_jump: image_index.player_jump
};
But I don't know how to implant this in side the drawImage, I've tried this
Code:
ctx.drawImage( this.sprite[ this.state ] , this.x, this.y);
But it doesn't work, any help? Thanks in advance!