change speed of MC w/ setInterval
OK, I am trying to make a driving game. The car just moves side to side, I want to beable to control the speed of the track- ie acceleration, on collision with the side of the track speed reduces, etc. I am just trying to get basic control over the speed. this is what I have so far. its all in the first actions frame:
carSpeed = 2000;
track.onRelease = function(){
carSpeed = carSpeed - 500;
}
onEnterFrame = function() {//for (carSpeed > 200) {
trackFrames = function () {
track.nextFrame();
updateAfterEvent();
};
speed = setInterval(trackFrames, carSpeed);
at this point I'm just trying to gain control before I start adding collision and whatnot. The problem with this is that it appears to accelerate on it's own. When I click, it acclerates more quickly.
I have also tried attaching keyPress<"Up"> to the track MC, but it doesn't seem to work.
Any suggestions? Should I attach to the actions to the track MC?