Ultima attività: Ha giocato a Elements (Mar 23, 2023 8:26am)
onClipEvent (load) {
//initial settings when movie clip starts
_global.xmovespeed2 = 2 //speed of movie clip
_global.ymovespeed2 = 2 //speed of movie clip
_global.driveangle2 =270; // initialized
}
onClipEvent (enterFrame) {
//this section is for keyboard control
//top speed limitif(_global.xmovespeed2 > 10) //if you try to go faster than 10 you are set back to 10
{ global.xmovespeed2 = 10
}
if(global.ymovespeed2 > 10)
{ _global.ymovespeed2 = 10
}
//changes the angle of car 15 degrees
if (Key.isDown(68))
{
_global.driveangle2+=5;
}
if (Key.isDown(65))
{
_global.driveangle2-=5;
}
if (Key.isDown(83)) //slow down the move variable
{
_global.xmovespeed2*=0.9;
_global.ymovespeed2*=0.9;
}
if (Key.isDown(87)) //speed up the move varialbe
{
_global.xmovespeed2*=1.1
_global.ymovespeed2*=1.1
}
radians = driveangle2 * Math.PI/180;
this._x+= _global.xmovespeed2*Math.sin(radians); //moves the tank this.y+= -global.ymovespeed2*Math.cos(radians); if (_global.driveangle2 >=360) _global.driveangle2 = 0; //reset to 0 when i get to 360 if (_global.driveangle2 <0) _global.driveangle2 = 345; // resetsthis._rotation = _global.driveangle2; //rotation is changed here
}
Feed attività
mtbc has not published any activity yet.Would you like to post a shout to welcome them to Kongregate?