|
-
Customization?
Hi guys n00b to the forum.. ive found alot of help here so far so said i ask something myself
I'm working on a car game and i want the user be able to choose car,colour and in future other custom parts, i no how to display and cycle through the different parts.
What im stuck with is how to make the game know what parts i choose, say i have a green type 2 car, how do i send them choices to a race etc without duplicating things over and over is there is a way...
if somebody can point me towards a tutorial or anything rather then trying to explain it to me if its complicated.. help is greatly appreciated
thanks
scan..
-
Senior Member
well if you would search around a bit you would have already found the answer, but it is quite simple really, just create a global variable, save the choice value in it, and then in the game state, refer to this variable to rebuild your car. Easy work.
If you like me, add me to your friends list  .
PS: looking for spriters and graphics artists for a RPG and an Arcade fighting project. If you can help out, please pm me!
My Arcade My Blog
Add me on twitter: 
-
M.D.
use an object and like bluemagica pointed out, store it somewhere that any other object can reference it.
so after a player customizes their car, build the result then store it.
Code:
function getCarCustomizationSettings(car) {
var result = {};
result.body = car.body.currentFrame;
result.wheels = car.wheels.currentFrame;
return result;
}
function startGame() {
var settings = GameSettings.carSettings;
//show the correct car in game
game.car.body.gotoAndStop(settings.body);
game.car.wheels.gotoAndStop(settings.wheels);
}
//store the settings in a class named "GameSettings"
GameSettings.carSettings = getCarCustomizationSettings(theCarMovieClip);
//start the game
startGame();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|