FOR JAN: Downloading and Integrating Scripts

View previous topic View next topic Go down

FOR JAN: Downloading and Integrating Scripts

Post  --Account Deleted-- on Fri Oct 22, 2010 5:06 am

OK, here is a brief explaination of how to incorporate the Reggae Speed gameplay scripts into a level. At present, there are three main scripts to download: the AI Script, the Player Movement Script and the Main Menu Script.

To grab the AI Script from the repository, click here.
To grab the Player Movement Script from the repository, click here.
To grab the Main Menu Script from the repository, click here.

1. You will need to design 2 separate scenes in order for the scripts to work. The first one should just be a basic scene which will be the background for the Main Menu. You must call this scene 'MainMenuScene' without the quotes. Secondly, there will be the main racetrack scene (there will only be one track in the prototype). You must call this scene 'Race1'. Now, you must ensure that the scenes are interpreted as levels by the scripting layer. In order to do this, you must click on the 'File' menu, click 'Build Settings'. Load up the MainMenuScene and click 'Add Current'. Then do the same for the Race1 scene.

2. Now, click back over to the MainMenuScene. At the same time, open up the MainMenuScript.txt file you got from the repository. In Unity, click the 'Assets' menu, go to 'Create' and then 'Javascript'. Change the name of the script from 'NewBehaviourScript' to 'MainMenuScript', then click the 'Edit' button in the inspector. Delete the code which is already there, and then copy and paste the code from the MainMenuScript.txt textfile into the Unity Script Editor. Press Ctrl+S to save, and then close the Script Editor. Now, drag the MainMenuScript out of the 'Project' panel and drop it onto the Main Camera in the MainMenuScene. The MainMenuScript is now set up!

3. You will now want to do a similar thing with the PlayerMovementScript. Open up the Race1 scene in Unity, and also open up the PlayerMovementScript.txt Script File you got from the repository. Back in Unity, click 'Assets', then 'Create' then 'Javascript'. Change the script's name from 'NewBehaviourScript' to 'PlayerMovementScript'. Now, click the 'Edit' button in the inspector. Delete the code already there, then copy and paste the code from the PlayerMovementScript.txt textfile into the Unity Script Editor. Press Ctrl+S to save, and then close the Script Editor. Drag the PlayerMovementScript out of the 'Project' panel and drop it onto the Player Cart Object in the Race1 scene.

4. Now, click on the Player Cart Object in the 'Project' panel, and look at the 'Inspector' panel. At the bottom, you should see the PlayerMovementScript. Underneath the PlayerMovementScript, you should see something which says 'CameraTransform: None (Transform)'. Click the triangle next to the part which says 'None' and select the Main Camera from the drop-down menu. Next, locate the section which says 'FinishLine: None (GameObject)'. Click the triangle and select the Finish Line Object from the drop-down menu (the finish line must have a collider on it, or else it will not work). Lastly, click on the line which says 'BoostPickups', and then change the 'Size' from 0 to the number of Boost Pickups in the scene (for instance, if you have placed 6 in the scene, just put 6!). You will now see a list of elements. These represent the all the Boost Pickups in the scene. Now, click the triangle next to each element and select each a Boost Pickup so that each element contains a different Pickup (the pickups, of course, must also have colliders). Once that's complete, you have set up the PlayerMovementScript.

5. The last script you need to set up is the AIScript. Open the Unity Race1 scene, and open up the AIScript.txt you got from the repository. In Unity, click 'Assets', then 'Create', then 'Javascript'. Change the script's naem from 'NewBehaviourScript' to 'AIScript'. Now, click the 'Edit' button in the inspector. Delete the code which appears, then copy and paste the code from the AIScript.txt textfile into the Unity Script Editor. Press CtrL+S to save, then close the Script Editor. Next, drag the AIScript our of the 'Project' panel and drop it onto the AI Cart in the Race1 scene (if there is more than 1 AI Cart in the scene, obviously you'll have to drag it onto each one separately).

6. Finally, click the AI Cart Object in the 'Project' panel, then check the 'Inspector' panel. You should be able to see the AIScript at the bottom of the 'Inspector'. Underneath this, you should see a line which says 'LeftWall: None (GameObject)'. Click the triangle next to the 'None' and select the Object which marks the Left Wall of the Race Track (the Walls of the track have a collider object). Do the same thing for the 'RightWall: None (GameObject)' tag underneath, except select the Right Wall Object. Obviously, if there is more than one AI Cart is the scene, you should repeat this step for each AI Cart.

You're done! Click over to the MainMenuScene, and run the game!

--Account Deleted--
EX Reggae Speed Programmer
EX Reggae Speed Programmer

Posts : 58
Join date : 2010-08-10

View user profile http://biomass-forums.darkbb.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum