I have made a simple custom movement system. The movement is a 'arcade' type movement. You can move in all four directions, but the player can only be seen from a side view.
A issue I am having is that I am not sure how to make it so the player can run diangle also. (Ex-Move up and right at the same time)
And if someone could throw in a line of tile detection that'd be great!
PHP Code:
//#CLIENTSIDE
function onCreated()
{
player.zoom = 1;
disabledefmovement();
}
function onKeyPressed()
{
if (player.clientr.canmove == 1)
{
if (!this.moving){
this.moving = true;
onTimeOut();
}
}
}
function onTimeOut()
{
if (player.clientr.canmove == 1)
{
if (keydown(3))
{
player.x +=0.8;
player.dir = 3;
setAni("walk", NULL);
setTimer(0.2);
} else if (keydown(1)){
player.x -=0.8;
player.dir = 1;
setAni("walk", NULL);
setTimer(0.2);
} else if (keydown(0)){
player.y -=0.5;
setAni("walk", NULL);
setTimer(0.2);
} else if (keydown(2)){
player.y +=0.5;
setAni("walk", NULL);
setTimer(0.2);
} else {
this.moving = false;
}
if (this.moving) {
setTimer(0.05);
} else {
setAni("idle", NULL);
}
}
}