Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-19-2002, 11:01 AM   #1
leight
Registered User
 
Join Date: Oct 2002
Posts: 7
Default driving game variables

hi guys,
im new to actionscript.org ok so i may ask some dumb questions:S

im making a driving game right, and im wanting to know how to make it so that when the player clicks onto the track they chose it goes onto a screen which lets them chose the car they want to race. when they chose the car it goes onto the track they chose with the car that they chose. how do i do that???
thanks heaps
leighton
leight is offline   Reply With Quote
Old 10-19-2002, 11:12 AM   #2
Ricod
(@_@) -("pretty lights")
 
Ricod's Avatar
 
Join Date: Sep 2001
Location: the Netherlands
Posts: 3,982
Default

Make at least one mc with different framelabels and stops() on them. On the track selection, you could either name the tracks or give them numbers. Anything to identify them. Then, when a track is selected save it in a variable. Let's say in the _root. the code of the trackbutton could then have sumthing like
ActionScript Code:
on (release){ _root.chosenTrack = "MonacoGP"; gotoAndStop("CarSelection"); }
Then on the car selection frame, do the same thing, but then for instance _root.chosenCar = "LamourghiniDiablo";

You can then use these variables to load in the right track and car. Using either if else statements or switch case (still need to look into that one) You know how to attach mcs right ?
__________________
RicoD
Link ?
Ricod is offline   Reply With Quote
Old 10-19-2002, 11:58 AM   #3
leight
Registered User
 
Join Date: Oct 2002
Posts: 7
Default

ok, i have got the 'mainMenu' in frame 1, 'trackSelection' in frame 2 and 'carSelection' in frame 3.

on the main menu a button says 'time trial'. i click on that button and it goes onto the 'trackSelection'. i chose my track 'bathurst' and it goes onto the 'carSelection'. now when i chose my car im wanting it to go to the 'bathurst' scene because the 'bathurst' track was chosen, but it doesn't for some reason.

attach movieClips - is it where you have one mc inside another mc??? i dont really know

thanks again
leighton
leight is offline   Reply With Quote
Old 10-19-2002, 12:50 PM   #4
Ricod
(@_@) -("pretty lights")
 
Ricod's Avatar
 
Join Date: Sep 2001
Location: the Netherlands
Posts: 3,982
Default

attachMovie() ... you can search for it in the F1 html (press f1 for the helpfile)

If you are using scenes, you should use framelabels. Label the first frame of your scene, and tell the _root to go to that label, instead of a scene. Going to scenes isn't possibly from anywhere else but the main timeline. This is because scenes are normal frames behind each other (if scene 1 consists of 20 frames, then the 1st frame of scene 2 is frame 21 of the main timeline).
__________________
RicoD
Link ?
Ricod is offline   Reply With Quote
Old 10-19-2002, 08:15 PM   #5
leight
Registered User
 
Join Date: Oct 2002
Posts: 7
Default

what would be faster and easier to work - to make it so that all the tracks are in one mc or to have one scene for each track???

and also, what do i need to attachMovie () for???
thanks
leighton

Last edited by leight; 10-19-2002 at 08:42 PM.
leight is offline   Reply With Quote
Old 10-19-2002, 09:15 PM   #6
leight
Registered User
 
Join Date: Oct 2002
Posts: 7
Default

ok i have made it so that all of the scenes/tracks are now on the main timeline in different frames with lables.

-----NOTE-----
track1 - bathurst
track 2 - easternCreek
car 1 - skaife
car 2 - ambrose

for the tracks actionscript

-----BATHURST-----
on (release) {
_root.chosenTrack = "bathurst";
gotoAndStop ("carSelection");
}

-----EASTERNCREEK-----
on (release) {
_root.chosenTrack = "easternCreek";
gotoAndStop ("carSelection");
}

-----SKAIFE-----
on (release) {
_root.chosenCar = "skaife";
gotoAndStop = _root.chosenTrack = "";
}

-----AMBROSE-----
on (release) {
_root.chosenCar = "ambrose";
gotoAndStop = _root.chosenTrack = "";
}


i dont know whats wrong with that:S
thanks again

leighton - the actionscript dummy

Last edited by leight; 10-19-2002 at 09:42 PM.
leight is offline   Reply With Quote
Old 10-20-2002, 08:12 AM   #7
leight
Registered User
 
Join Date: Oct 2002
Posts: 7
Default

hey kool - i got it so that when the user clicks on the track and then the car it goes onto the track which they chose

now - i have a movieclip with the different cars in different frames. how do i make it so that the car is chosen is on the track???

thanks
leighton
leight is offline   Reply With Quote
Old 10-20-2002, 08:38 AM   #8
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

make your cars as a MC and linkage them in the library.
a holder empty mc on the stage
and when the user choses the car (clicks at the chosing's button):
ActionScript Code:
on(release){ _root.holder.attachMovie("chosenCar","newName",10) gotoAndStop("the First Frame Of The Track's Movie" }
__________________
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Old 10-20-2002, 09:00 AM   #9
leight
Registered User
 
Join Date: Oct 2002
Posts: 7
Default

so from what i gather - our saying that i need to make my cars - all mc's, and put them into one mc ('supercar'). then i have to attach all of the cars inside the 'supercar' mc by writing this in the 'supercar' actions:

on (release) {
set (_root.holder.attachMovie("chosenCar", "newName",0), "");
gotoAndStop(_root.chosenTrack);
}

is that right??? or do i need to put that actionscript in the car buttons where the user choses the car???

thanks
leighton
leight is offline   Reply With Quote
Old 10-20-2002, 09:43 AM   #10
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

no, every car should have its own linkage name
also there is a 'Chose Your Car Screen', which has all the cars instance that works as a buttons to chose from it
__________________
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:46 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.