Jump to content

Mr TwinkleToes


soulVampire
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...