cekneb
07-20-2005, 09:20 PM
Hi!
i want to make a Racing Game in flash. There is a car which is driving on a track. The handbrake is SPACE. when you use it there should be skidmarks (skids). A friend of mine helped me a little bit and has shown me this code:
function skid(Handbrakey)
{
var skidleft = _root.track.attachMovie("skidmark", "skidleft"+skids, skids);
for(var i = 0;i < this.displaywheels;i++)
{
wheelsPos[i] = getPos(this["w"+i]);
if (handbrakey) {
// play hardcore squeal
skidleft.lineStyle(4, 0x000000, 70);
skidleft.moveto(this.wheelsPos[i].x-track_x,this.wheelsPos[i].y-track_y);
skidleft.lineTo(this.lastpos[i].x,this.lastpos[i].y);
}
else
{
// play gentle squeel sound
skidleft.lineStyle(3, 0x000000, 50);
skidleft.moveto(this.wheelsPos[i].x-track_x,this.wheelsPos[i].y-track_y);
skidleft.lineTo(this.lastpos[i].x,this.lastpos[i].y);
}
lastpos[i].x = this.wheelsPos[i].x-track_x
lastpos[i].y = this.wheelsPos[i].y-track_y
skids++;
}
return true;
}
Is there anybody who could help me to understand this? Some little Words?
I thank you very much
greetz
cekneb
i want to make a Racing Game in flash. There is a car which is driving on a track. The handbrake is SPACE. when you use it there should be skidmarks (skids). A friend of mine helped me a little bit and has shown me this code:
function skid(Handbrakey)
{
var skidleft = _root.track.attachMovie("skidmark", "skidleft"+skids, skids);
for(var i = 0;i < this.displaywheels;i++)
{
wheelsPos[i] = getPos(this["w"+i]);
if (handbrakey) {
// play hardcore squeal
skidleft.lineStyle(4, 0x000000, 70);
skidleft.moveto(this.wheelsPos[i].x-track_x,this.wheelsPos[i].y-track_y);
skidleft.lineTo(this.lastpos[i].x,this.lastpos[i].y);
}
else
{
// play gentle squeel sound
skidleft.lineStyle(3, 0x000000, 50);
skidleft.moveto(this.wheelsPos[i].x-track_x,this.wheelsPos[i].y-track_y);
skidleft.lineTo(this.lastpos[i].x,this.lastpos[i].y);
}
lastpos[i].x = this.wheelsPos[i].x-track_x
lastpos[i].y = this.wheelsPos[i].y-track_y
skids++;
}
return true;
}
Is there anybody who could help me to understand this? Some little Words?
I thank you very much
greetz
cekneb