Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Sidescroll game, the character pauses while advancing

Community Beginner ,
Oct 30, 2017 Oct 30, 2017

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.

127
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation