}
}
public function onKeyboardUp(e:KeyboardEvent):void
{
for(var i:int=0;i<m_aKeys.length;i++)
{
if(m_aKeys[i]==e.keyCode)
m_aKeys[i]=-1;
}
}
public function timerHandler(e:TimerEvent):void
{
T_PlayerCar.Input(m_aKeys);
T_PlayerCar.Logic();
T_ComCar.adjustZ(T_PlayerCar.m_nSpeedZ);
T_ComCar.Thinking(T_PlayerCar);
T_ComCar.Logic();
if(T_PlayerCar.CollideWith(T_ComCar))
{
T_ComCar.MoveBack();
T_PlayerCar.MoveBack();
}
setRefFrames();
setCarOrder();
}
public function setRefFrames()
{
var frame=T_Road.currentFrame;
frame=frame+T_PlayerCar.getSpeedZ();
if(frame>T_Road.totalFrames)
frame=frame-T_Road.totalFrames;
T_Road.gotoAndStop(frame);
frame=T_Tree.currentFrame;
frame=frame+T_PlayerCar.getSpeedZ();
if(frame>T_Tree.totalFrames)
frame=frame-T_Tree.totalFrames;
T_Tree.gotoAndStop(frame);
frame=T_Rock.currentFrame;
frame=frame+T_PlayerCar.getSpeedZ();
if(frame>T_Rock.totalFrames)
frame=frame-T_Rock.totalFrames;
T_Rock.gotoAndStop(frame);
}
public function setCarOrder()
{
var indexP:int=this.getChildIndex(T_PlayerCar);
var indexC:int=this.getChildIndex(T_ComCar);
if(indexP>indexC&&T_PlayerCar.z>T_ComCar.z) Flash CS4三维游戏设计(赛车)(16):http://www.751com.cn/jisuanji/lunwen_294.html