Jump to content

#GitHubGameOff2017


Capitaine Herlock
 Share

Recommended Posts

Hi, i am trying to continue Phaserquest in the GitHubGameOff GameJam so i've started from a basic example using EasyStarJS but i need to animate the character and the tween is really complicated even if the answer was found on the forum

So my question is :

How can we animate a character starting  from the "Player Animation" commit in this git https://github.com/reneromain/GitHubGameOff/ i don't know if my question is clear

if(this.ismoving === true){
          this.tween.stop();
        }
        i = 0,
        ilen = path.length;
        function moveObject( object ){
          if(path.length > 1){
            object.ismoving = true;
            var StepX = path[i].x || false, StepY = path[i].y || false;
            tween = game.add.tween( object ).to({ x: StepX*32, y: StepY*32}, 150).start();
            dx = path[i].x;
            tween.onComplete.add(function(){
              i++;
              if(i < ilen){
                console.log(path[i]);console.log(path[i+1]);
                if (path[i].x > dx) {
                  player.play('right');
                };
                // TODO : Animate left, up, down
                moveObject( object );
              }else{
                player.play('idle');
                return false;
              }
            });
          }else{
            //@TODO add emoticon - no path (!)
            this.ismoving = false;
          }
        }
        moveObject(player);
    	}
    });

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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