Forums

ForumsProgramming Forum

Does this place help with flash files?

Posted Dec 29, '11 at 5:33am

SilverFlash

SilverFlash

58 posts

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

 

Posted Dec 29, '11 at 10:52am

paladin2286

paladin2286

141 posts

Maybe you can find your wants in here

 

Posted Dec 29, '11 at 1:50pm

SilverFlash

SilverFlash

58 posts

i couldnt find the specific thing

 

Posted Jan 1, '12 at 12:16pm

fiester

fiester

18 posts

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

 

Posted Jan 1, '12 at 8:45pm

arobegamr

arobegamr

120 posts

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.

 
Reply to Does this place help with flash files?

You must be logged in to post a reply!