I just tested my examples and they worked fine, also remember you're working with pixels not Graal x, y, coordinates. So try increasing your speed above 1.
Try.. this.speed = this.lvl * 1;
That assumes that you're setting this.lvl to 1 though.
Also just learned that you should use keydownglobal() function instead of keydown()
Here is my example..
PHP Code:
//#CLIENTSIDE
function onCreated() {
new GuiWindowCtrl("GameGUI") {
profile = GuiBlueWindowProfile;
clientrelative = true;
clientextent = "320,240";
canmove = true;
canresize = false;
closequery = false;
destroyonhide = false;
text = "Game - Use Arrow Keys to Move Button";
x = 287;
y = 241;
new GuiButtonCtrl("GameGUI_Button") {
profile = GuiBlueButtonProfile;
text = "Exit";
width = 80;
x = 119;
y = 108;
}
}
setTimer(0.05);
}
function GameGUI_Button.onAction() {
// Button "Fun Example" has been pressed
GameGUI.destroy();
}
function onTimeout() {
if (GameGUI.visible) {
this.speed = 2;
// Loop through Arrow/Direction Keys
for (temp.i = 0; temp.i < 4; temp.i++) {
// Check if direction key is pressed
if (keydownglobal(temp.i)) {
// Record the direction pressed and exit the loop.
this.direction = temp.i;
temp.pressed = true;
break;
}
}
// Check if a Direction key was pressed.
if (temp.pressed) {
// Move Button
GameGUI_Button.x += vecx(this.direction) * this.speed;
GameGUI_Button.y += vecy(this.direction) * this.speed;
}
// Freezeplayer to prevent graal movement
freezeplayer(0.05);
// Continue game loop
setTimer(0.05);
}
}