soulVampire Posted April 21, 2020 Share Posted April 21, 2020 trying to create two types of players sprites one for walking which is width 22px, height 57px the other images are for crawling and are width 50px height 32px, been trying to use add the new sprite to the code but having no success this code is for walking, init : function (x, y, settings) { // call the constructor this._super(me.Entity, 'init', [x, y, settings]); // max walking & jumping speed this.body.setMaxVelocity(1.5, 11); this.body.setFriction(0.4, 0); // set the display to follow our position on both axis me.game.viewport.follow(this.pos, me.game.viewport.AXIS.BOTH, 0.4); // ensure the player is updated even when outside of the viewport this.alwaysUpdate = true; this.mutipleJump = 1; // define a basic walking animation (using all frames) this.renderable.addAnimation("walk", [0, 1, 2, 3, 4, 5]); // define a standing animation (using the first frame) this.renderable.addAnimation("stand", [0]); this.renderable.setCurrentAnimation("stand"); }, now I want to add the this,renderable.addAnimation("crawl", [0,1,2,3,4,5]) but not using tiled to pass the values want to do it from the program, so define a base state in tiled(walking) and define the more complex actions in game.PlayerEntity() section so that I can add crawl, running, climping and other player actions within the program, if any one has any ideas would love to hear Quote Link to comment Share on other sites More sharing options...
obiot Posted April 24, 2020 Share Posted April 24, 2020 sorry so I guess you find the solution here, since it's working in your demo 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.