ForumsProgramming ForumDoes this place help with flash files?

4 1520
SilverFlash
offline
SilverFlash
57 posts
30

If so can anybody help with this. I want to make a collision for this car im making. Heres the file

http://megaswf.com/serve/1569201

i put the codes in a seperate .as file. here are the codes


// Race control

// Create key listener
var keyListener:Object = new Object();
keyListener.onKeyDown = function () {
switch ( Key.getCode() ) {
case Key.UP:
_root.mainCar.ForwardOn();
break;
case Key.DOWN:
_root.mainCar.ReverseOn();
break;
case Key.RIGHT:
_root.mainCar.RightTurnOn();
break;
case Key.LEFT:
_root.mainCar.LeftTurnOn();
break;
}
}
keyListener.onKeyUp = function () {
switch ( Key.getCode() ) {
case Key.UP:
_root.mainCar.ForwardOff();
break;
case Key.DOWN:
_root.mainCar.ReverseOff();
break;
case Key.RIGHT:
_root.mainCar.RightTurnOff();
break;
case Key.LEFT:
_root.mainCar.LeftTurnOff();
break;
}
}
Key.addListener(keyListener);





the codes are for the car. what is the function for the walls. plz help

  • 4 Replies
paladin2286
offline
paladin2286
149 posts
955

Maybe you can find your wants in here

SilverFlash
offline
SilverFlash
57 posts
30

i couldnt find the specific thing

fiester
offline
fiester
18 posts
30

what do you mean collision???????????????????????????

arobegamr
offline
arobegamr
130 posts
540

There is no one function for anything. There are many different methods to make something happen, especially something as broad as collision detection.

In addition, using KeyUp and KeyDown along with a KeyCode detector will give you problems.

Use an event handler with an enterFrame function instead.

var keyHandler:MovieClip = _root.createEmptyMovieClip("keyHandler",_root.getNextHighestDepth());
keyHandler.onEnterFrame = function(){
if(Key.isDown(Key.UP)){
_root.mainCar.forwardOn();
}else{
_root.mainCar.forwardOff();
}
}


And so on for the rest. Sorry to not help for the walls, but there's simply not enough information here.

Showing 1-4 of 4