Oroton Posted January 30, 2016 Share Posted January 30, 2016 and play here.. www.brissyriders.com/turtlewiz/index.htm What i am wanting is to know how do I animate the character. and how can i animate the enemies. I have extended the character (turtle.png) sprite sheet, but I don't know how to animate it when he walks. Or how to Animate the enimies, can anyone help me? Thanks. Turtlewiz_files.zip Quote Link to comment Share on other sites More sharing options...
Oroton Posted February 6, 2016 Author Share Posted February 6, 2016 So, you can see where all the added Animation code is.. with //Added by Oroton. Any help here would be good. I just can't figure out why it isn't animating I think it's a syntax error. Found around Here.. Sprite.prototype.draw = function() { if (!this.flashOn) { ctx.drawImage( this.tileset.image, /* Obscure everthing below this */ //Added by Oroton this.states[this.currentState].frames[this.states[this.currentState].currentFrame].split(',')[0] * this.tileset.tileWidth, this.states[this.currentState].frames[this.states[this.currentState].currentFrame].split(',')[1] * this.tileset.tileHeight, this.tileset.tileWidth, /* Obscure everthing above this */ //Added by Oroton this.tileset.tileHeight, Math.round(this.x), Math.round(this.y), this.width, this.height ); } } wizAnim.zip Quote Link to comment Share on other sites More sharing options...
Kv Posted February 8, 2016 Share Posted February 8, 2016 Try to change the current sprite every X frames. I use a counter for this task. Its value is raised by 1 every thime I refresh the screen. So if I update the screen 60 times per second (which means it's running with 60 FPS), I tell my objects which one of their costumes should they wear for the first 10 frames, then the next 10 and so on until their cycle is finished, then I set the counter back to 0. Quote Link to comment Share on other sites More sharing options...
Oroton Posted February 13, 2016 Author Share Posted February 13, 2016 I actually figured it out, i wasn't adding code to the correct variables. On to the next prolem Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.