Jetpack
Hey i made a script
and when i am on the ground my gani is ever idle help...
Quote:
//#CLIENTSIDE
function onCreated() {
this.jetpack = 0;
}
function onKeyPressed(code,key)
{
if( key == "b" )
{
if (this.jetpack = 0) {
if(player.z >= 10)
{
this.jetpack = 1;
player.chat="Stop!";
}
else
{
settimer(0.1);
player.z+= 0.2;
}
}
}
else if( key == "o" )
{
this.jetpack = 0;
player.z = 0;
}
}
function onTimeOut()
{
if(player.z > 0)
{
this.jetpack = 1;
replaceAni("walk", "grab");
this.speed = 0.05;
player.z-= 0.05;
for ( temp.i = 0; i < 4; i ++ )
{
if ( keydown(i) )
{ // if the key for that direction is pressed
player.x += vecx(i) * this.speed;
player.y += vecy(i) * this.speed;
}
settimer(0.05);
}
}
else
{
this.jetpack = 0;
replaceAni("grab", "walk");
settimer(0);
}
}
|