Remember, Graal's directions use the values, 0, 1, 2, 3 and has built-in functions to make tasks working with them easy.
A good way to get the direction to move would have to be adding key checking in your Timeout loop like so.
PHP Code:
//#CLIENTSIDE
// Your GUI Code..
function onTimeout() {
// Loop through Arrow/Direction Keys
for (temp.i = 0; temp.i < 4; temp.i++) {
// Check if direction key is pressed
if (keydown(temp.i)) {
// Record the direction pressed and exit the loop.
this.direction = temp.i;
break;
}
}
// Move your control based on the direction vector, and multiply that by the speed.
ron_plr.x += vecx(this.direction) * this.speed;
ron_ply.y += vecy(this.direction) * this.speed;
// Other Code..
}
// Other Code..
Now to explain vecx, and vecy. The return -1, 0 or 1 depending on the direction passed to them..
PHP Code:
echo(vecx(0)); // would display 0
echo(vecx(1)); // would display -1
echo(vecx(2)); // would display 0
echo(vecx(3)); // would display 1
The reason 0 and 2 when passed into vecx is because it basically simulates as if you were moving 1 space to the direction specified. So if you were moving straight up or down, only your Y axis value would change. Vice-versa for vecy.
Also another good habit to get into is only loop when you need to!
PHP Code:
function onTimeout() {
if ( ron_game.visible != true ) {
this.gamestatus = "off";
}
else if (this.gamestatus == "on") {
this.speed = ( ( this.level * .25 ) + .15 );
ron_game.text = "Catch that Greasy Chicken! Score : " @ this.score;
// Movement Stuff here
// Other Game related code..
// Continue Looping
setTimer( 0.05 );
}
}
Following your code base, that above example would continue timing out every 0.05 seconds while the gamestatus was on.