A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Customization?

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Posts
    1

    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..

  2. #2
    Senior Member bluemagica's Avatar
    Join Date
    Jun 2008
    Posts
    766
    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:

  3. #3
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    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();
    lather yourself up with soap - soap arcade

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