A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: Really hard question!!!

  1. #1
    Hey there !!
    I am making a car game and i made the car rotate to Left when u press (LeftArrow) and right (RightArrow) Now i need to make it go foward when i press UP arrow and brake on DownArrow !!!

    I you dont understand,for example this game : http://www.raceracer.com !!!
    That's how i want my controlls to be done )

    Plz help

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    You may or may not know this, but I had trouble pulling up your site, and playing your game on my mac. But I noticed on my PC it works great... BTW great game and idea! I sent you an email with more details in it about my thoughts on your game... hope you get it!


  3. #3
    hey virtuoso18 !!!
    I think you got the wrong idea...
    The game is not mine .Some1 else made it.
    But i said i am making my own game and i need help with the controlls .the http://www.raceracer.com site was only an example
    for how i want my controlls to be !!!
    I wish i could make a game like that lol

  4. #4
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    Oh, sorry, well what I did to start my game was look up the words GTA in the forum search and you will most likely find everything you need to make your own car game. I will be making a car game tutorial soon as I finish with my own game and I will most likely be using my own codeing ideas as example code. Let me know if still can't find what you are looking for after the search and I'll see what I can do...good luck!


  5. #5
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793
    Frankly, the controls of Race Racer are kind of lousy.



  6. #6
    virtuoso18,
    I found some stuff ... and everything work's but i dont want the backround to move, I only want the car to move

  7. #7
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124
    Can you put up a link to your FLA and I'll have a look and see what I can do for you ok?


  8. #8
    But i dont have a website yet
    I can email you ???

  9. #9
    Junior Member
    Join Date
    Aug 2001
    Posts
    15

    Unhappy It is simple

    You poeple must be yanks!!

    The code is so simple.
    Here it is lil chap or how i would code it

    //this goes in the car mc
    onClipEvent(load){
    carspeed=5;
    brake=10;
    }
    onClipEvent(enterFrame){
    this._y-=carspeed;
    if(Key.isDown(Key.LEFT)){
    //turn left
    this._x-=carspeed;
    this._rotation=-90;
    }
    if(Key.isDown(Key.RIGHT)){
    //turn right
    this._x+=carspeed+5;
    this._rotation=90;
    }
    if(Key.isDown(Key.Up)){
    //speed up
    this._y-=carspeed;
    this._rotation=0;
    }
    if(Key.isDown(Key.DOWN)){
    //brakes
    this._y+=brake;
    this._rotation=0;
    }
    }


    that should do it right there

    GOOD NIGHT its lats here in the OZ!

    ======================
    <- brake
    -> speed up
    /\ up
    \/ down
    [swf width="550" height="200" background="#FFDDBB"]http://www.angelfire.com/rpg2/flashgames/gamecarex.swf[/swf]

  10. #10
    Ummm...FlashJockyDad
    That's not really what i want!!But thx anyway
    i want the controlls like on http://www.Raceracer.com
    and the code u posted is not really wat i want!!!
    This is wat i am up to but i dont want the backround to move ..that's the problem . Here it is :
    -----------------------------------------
    this goes in the car mc
    -----------------------------------------
    tellTarget(_parent){
    camshot(this);
    };
    //turn car
    this.tmpang = ((this.xspd* 2) *this.dir);
    if(this.tmpang > 4){this.tmpang = 4};
    if(this.tmpang < -4){this.tmpang = -4};

    this.ang += this.tmpang;
    this._rotation = this.ang;

    this.yspd = 0;


    //cause friction:
    this.xspd /= 1;
    this.yspd /= 1;

    //move car using some trig

    this.xxx += Math.cos((this.ang/180)*Math.PI)*this.xspd;0
    this.yyy += Math.sin((this.ang/180)*Math.PI)*this.xspd;0

    this.xxx += Math.cos(((this.ang+90)/180)*Math.PI)*this.yspd;0
    this.yyy += Math.sin(((this.ang+90)/180)*Math.PI)*this.yspd;0
    ------------------------------------------------------
    and this is the track mc (the backround)But it's got zoom in and zoom out thing on it 2 !!!
    ------------------------------------------------------
    n=100;
    nn = 0;
    ni = 0;

    //arrays for making map, must match array in main scene

    map0 = new Array(9, 6, 6, 6, 6, 6, 6, 6, 6, 10);
    map1 = new Array(5, 1, 7, 7, 2, 14, 1, 7, 2, 8);
    map2 = new Array(5, 8, 9, 10, 5, 14, 3, 6, 4, 8);
    map3 = new Array(5, 8, 5, 8, 5, 14, 1, 7, 2, 8);
    map4 = new Array(5, 3, 4, 3, 4, 14, 8, 13, 5, 8);
    map5 = new Array(5, 1, 7, 7, 2, 14, 3, 6, 4, 8);
    map6 = new Array(5, 3, 6, 10, 5, 14, 1, 7, 2, 8);
    map7 = new Array(5, 1, 2, 8, 5, 14, 8, 13, 5, 8);
    map8 = new Array(5, 3, 4, 3, 4, 14, 3, 6, 4, 8);
    map9 = new Array(11, 7, 7, 7, 7, 7, 7, 7, 7, 12);

    //attach movies as nesisary
    while(nn < 10){

    ni = 0;

    while(ni < 10){
    zxtmp = ("sq"add (eval("map"add ni)[nn]))
    attachMovie( zxtmp, "sq"add n, n);
    eval("sq"add n)._x = (nn * 100)-50;
    eval("sq"add n)._y = (ni * 100)-50;
    n++
    ni++;

    };

    nn++;

    };

    //field need these variables to work with camera function!!!

    this.xxx = 0;
    this.yyy = 0;

  11. #11
    [Devil in DarkGreen]

    Join Date
    Aug 2000
    Posts
    523
    sigh...i only know directInput can do it

  12. #12

    Helppp

    Hey ppl i still need help
    Can any 1 help meeeee???

  13. #13
    Junior Member
    Join Date
    Sep 2001
    Posts
    26

    Re: Helppp

    If you send me the fla I'll take a look if you want

    [email protected]

    (or i could mail some example code)

  14. #14
    Junior Member
    Join Date
    Aug 2001
    Posts
    10

    RaceRacer

    Hi
    What you need to do (well, what ive done) is calculate the rotation and momentum and move the image x an amount and y an amount (along a tangent). The trigonometry given is good and should work fine - its looks better than mine!

    Ray Beez; how do you suggest i enhance the controls? i dont quite understand your remark. Do you refer to the keys or handling?

    Good luck
    Cheers
    Tom.

  15. #15
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793

    RaceRacer:


    Well... the easiest way to see what's wrong with the controls is just to play a similar game on a "real" game system. Try SPRINT by Atari on the MAME emulator, or Grand Theft Auto. It's better to immitate game controls that have already proven themselves, than say, imitating a real car.

    One thing you could do is limit the top speed so that the player isn't forced to let go the accelerator unless they are headed into a tight curve. (People usually keep the gas button always held down, except when they want to brake. Even a realistic game like Gran Tourismo on PS2 is like this.)

    Next, if your car were smaller, the car speed would have the illusion of being greater at a lower actual speed.

    Lastly, perhaps the rotation (left/right) could be tweaked so that it's partially ratio'd to the car speed.


    Whatever you do, (in ANY game development) it is always best to gain gameplay and good play control over visuals. So if at any point you are tempted to say "well I have it at that speed because it looks realistic", stop yourself immediately and remind yourself that the game must play well first, and look nice second.

    RB

  16. #16
    Senior Member
    Join Date
    Mar 2000
    Location
    New York, New York
    Posts
    124

    Re: RaceRacer

    Originally posted by RaceRacer
    Ray Beez; how do you suggest i enhance the controls? i dont quite understand your remark. Do you refer to the keys or handling?
    Well, what I have noticed with your controls is that the car tends to slid in a strange
    way when you are accelerating and trying to turn. I think it might have something to
    do with the way you car graphics are placed. Are all of your car graphics centered
    between the cross hair?

    As for DJ-ZoMBiE, I can not do anything with the code you posted, please post or
    send me a FLA and I can try to fix it for you...



  17. #17
    Junior Member
    Join Date
    Aug 2001
    Posts
    10
    Hi
    As for the car turning, ive actually centred the centre of the movie clip on the cars rear axel, and it does feel a bit strange - but it feels stranger when the car turns around the centre. I appreciate your comment, though and ill muck around with different positions.
    Ray Beez - I like your idea about the speed bieng ratio'd! Thanks for that. I think the constant acceleration is quite fun! It requires more skill. Remember the bus/tanker in GTA2? - They never seemed to slow down, and i really liked that.
    Please note that i dont intend to simulate or accurately potray "real" car handling like GT2 etc.
    Thanks for the comments though - ill bear them in mind for the next seasons upgrade.
    Dj-zombie - you can use the trig given to move the car cant you?? It looks like it should work.. Try using just the trig (with speed and rotation variables)
    Cheers
    Tom.

  18. #18

    Smile Hmmm..yeh

    yeh..thx every 1 for your help ...I'll email u the fla file(chris47 and virtuoso18 ) and see if u can help ;/

  19. #19
    Senior Member Ray Beez's Avatar
    Join Date
    Jun 2000
    Posts
    2,793

    Raceraceraceracer

    RacerRacer:
    OK if you want constant accell to be part of the gameplay, maybe it should be slower, given how quickly the car can get from one curve to another?

    I'm not asking to make the game dead-easy, but too hard is just as bad.



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