A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Racing Game - help me actionscript blockades!

  1. #1

    Angry

    I need help! I need walls for the game i am creating. The cars can go right off the track! Here is the game file: http://www.1matthew.com/flash/game.rar And here is the actionscript for the car, any help would be great!:


    onClipEvent(load){
    accel = .2
    deccel = .95
    steer = .02
    MINspd = -5
    MAXspd = 6
    }

    onClipEvent(enterFrame){
    if (LR = Key.isDown(Key.RIGHT)-Key.isDown(Key.LEFT)) angle += LR*steer*speed
    if (UD = Key.isDown(Key.UP)-Key.isDown(Key.DOWN)) speed = Math.min(Math.max(speed+UD*accel,MINspd),MAXspd)
    else speed *= deccel

    _rotation = angle*180/Math.PI
    _x += Math.cos(angle)*speed
    _y += Math.sin(angle)*speed
    if (_y<0) {
    _y = 400;
    }
    if (_y>400) {
    _y = 0;
    }
    if (_x<0) {
    _x = 600;
    }
    if (_x>600) {
    _x = 0;
    }
    }

  2. #2
    Slackware 9.0 Runes_Tooth's Avatar
    Join Date
    Mar 2002
    Location
    Crono Triggyarr
    Posts
    508
    Go here.

    He has plenty of tutorials on how to do hitTests, which is what you would do to keep the car on the track.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center