0 Replies Latest reply on Oct 30, 2017 7:10 PM by Marampazú

    Sidescroll game, the character pauses while advancing

    Marampazú Level 1

      Hello again.

       

      I'm trying to make a sidescroll minigame. The script that I use to move the character is this (the frames are in 60):

       

      function Main() {

      createjs.Ticker.addEventListener("tick", this.update.bind(this));

      canvas.onmousedown = this.userPressed.bind(this);

      window.onkeydown = this.userPressed.bind(this);

      }

       

      Main.prototype.update = function (evt) {

      console.log("Main::update()");

      }

       

      Main.prototype.userPressed = function (evt) {

      exportRoot.mc_Sebastian.x += 3;

      }

       

       

      var main = new Main();

       

      +++++++++++++++++++++++++++++++++++++++++++++++++++++

       

      It works, however at the time of making the animation the character advances 3 pixels (determined by a variable), makes a minimum pause and then continues with a fluid advance.

       

      You can try the script by adding a movieclip, it will surely be easier to see on the screen. That little pause is the one that does not allow to see a fluid movement. Hopefully you can help me with a tutorial that already exists or with an example on which I can base myself.

       

      As always, thanks for the help.