- Home /
How do I shoot ????
I got my shooting script but I don't know how to shoot .
how do i set my controls so when i left click it shoots and what must I do to add a projectile and let it work ????
Here are some links I strongly suggest to all new users :
Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/essential-skills/
Start at the bottom and work up : http://www.unity3dstudent.com/category/modules/beginner/
this is the YouTube link for the above as one playlist : http://www.youtube.com/watch?v=-oXYHNSmTxg&list=PL27B696FB515608D2&feature=plcp
Character controller and terrain : http://cgcookie.com/unity/2011/12/05/introduction-to-character-controllers/
That is good to get started. Then start with a small tutorial, this is a simple 2D space shooter : http://www.unityjumpstart.com/ProofOfConcept_1/ : click on the videos part1.mp4 part2,3,4 =]
I just found another by our own Eric : http://wiki.unity3d.com/index.php?title=2DShooter : http://forum.unity3d.com/threads/7883-2D-shooter-tutorial
By then you should be getting the hang of things and starting to have ideas of your own. When you decide what kind of game you want to make, then look at each part you'll need. For example, if you want to make some terrain then walk around it with a character : http://cgcookie.com/unity/2011/12/05/introduction-to-character-controllers/
Here's another on the same 'site but I havn't checked the difficulty : http://cgcookie.com/unity/2012/02/24/game-planning-lunar-lander-01/
Basically then just search for tutorials, there are many out there, either written or on youtube.
the Unity Wiki tutorials : http://wiki.unity3d.com/index.php/Tutorials
A big list of tutorials : http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html
Helpful page with information on using Built-In Arrays and Lists (you'll need this later!) : http://www.unifycommunity.com/wiki/index.php?title=Which_$$anonymous$$ind_Of_Array_Or_Collection_Should_I_Use?
The unity wiki link above is very handy with lots of scripts and shaders too (just check out all the links down the left, and the tabs along the top : http://wiki.unity3d.com/index.php/Scripts )
http://answers.unity3d.com/questions/148211/list-of-frequently-asked-beginners-questions.html
http://forum.unity3d.com/threads/132628-How-to-help-the-Absolute-Beginner
If you know what kind of game you want to make, edit your question and write there what you are thinking of, then there may be a tutorial out there for that!
But just be aware, you will do lots of typing, deleting, typing, bashing head on desk, being really happy when it works and you understand how and why. I hope this helps, Happy Coding =]
You need to assign it to an game object and give it this script:
var bullet: Rigidbody; var power: float = 1500; var moveSpeed: float = 27; var explosion : Transform;
function Update () {
var h : float = Input.GetAxis("Horizontal") Time.deltaTime moveSpeed; var v : float = Input.GetAxis("Vertical") Time.deltaTime moveSpeed;
if(Input.GetButtonUp("Fire1")) {
var instance: Rigidbody = Instantiate(bullet, transform.position, transform.rotation); var fwd: Vector3 = transform.TransformDirection(Vector3.forward); instance.AddForce(fwd * power); var newExplosion = Instantiate(explosion, transform.position,transform.rotation) as GameObject; Destroy(newExplosion,3);
}
}
Your answer
Follow this Question
Related Questions
How Do You To Make An Object Shoot A Projectile? 1 Answer
keybind problem 0 Answers
moving gun in first person shooter while walking 8 Answers
shooting script wont work 3 Answers
How to shoot only once 5 Answers