So in my game I'm using w,s and spacebar to move up down and shoot. Unfortunately, however, there is a delay in the movement for like one second which is really annoying. Is there a way to remove that?

The code I am using:

onEvent("play", "keydown", function(e) {
if (e.key == "s") {
setPosition("player", getXPosition("player"), getYPosition("player") + 5);
}
});

    gZany App Lab doesn't have any keyDown() functions, so the best way to check is by combining event listeners. Try something like this:

    var sKeyDown = false;
    onEvent("screen1", "keydown", function(e) {
      if (e.key == "s") {
        sKeyDown = true;
      }
    });
    onEvent("screen1", "keyup", function(e) {
      if (e.key == "s") {
        sKeyDown = false;
      }
    });
    timedLoop(25, function() {
      if (sKeyDown) {
        setPosition("player", getXPosition("player"), getYPosition("player") + 5);
      }
    });

    But for any project that involves movement or key detection, Game Lab is the better choice by far. If you still want to use App Lab though, I would recommend using the canvas element instead of moving actual UI elements all over the place.

      Binary_Coder ah, I see. Thanks for the tip. I can't switch to gamelab now because I'm already so far into this project so that would be a real pain.

      Chat