- Home /
Script for Car
I am making a car for my game. The whole point of the game is to get to the end as fast as you can and not get destroyed by the walls. I am also very new to this and I dont know what to do for any of the scripts listed: walls (so when you hit it you'll be destroyed), the car, the timer, the start/finish, the camera, restart button, and the game over button. Thanks for helping guys!
This is a really big question and I'm not sure if anyone could fit this all in one answer. Try asking this on the forum and I might be able to help you out. I can help you out by telling you to add this script to anything that you want to load a new level when the car hits it:
var levelToLoad : String;
function OnTriggerEnter(){
Application.LoadLevel(levelToLoad);
}
$$anonymous$$ake sure you save it as a JavaScript file!
Answer by Jinxology · Dec 24, 2013 at 03:04 AM
Some quick suggestions to get you going:
Walls: Add a Box Collider
The car: Add Box Collider (to detect collisions) and Rigid Body (to apply position physics)
The timer: GUI Text that updates the .text property in the Update method
The camera: Position the camera where you want it, then in the Update, just set transform.position.x and transform.position.y, leaving .z where it is.
Restart and Game Over button: GUI Button
The best way to learn is to dig into each of those suggestions and mess around, read a lot, and google for examples.
Answer by Commander Quackers · Dec 24, 2013 at 03:29 AM
All of these requested scripts are all over the place, you have to be resourceful and use Google. We are not going to give you scripts like that I'm sorry, but here is how I'd approach it:
For walls destroyng the car, just add a box collider to the wall, set as trigger, and make a script that loads a game over scene when you enter the trigger.
Side note: Don't expect to get scripts handed to you in the forums, however we can give you the basic idea and such.
Good luck.
Your answer
Follow this Question
Related Questions
Add points when player passes through something + Timer 1 Answer
Game over? 1 Answer
How to set lap timer for network multiplayer 0 Answers
Basic toggle timer Help! 2 Answers
component activate on timer 2 Answers