|
hey everyone! so.. I'm having a problem... I'm making a game of batleships, and i is going very well so far, but now I wanted to make an enemy shoot at me, so i've already make the boat look at me but now i cant make it shoot! this is my script can anyone tell me what is wrong with it? var bullitprefab: Transform; shoot(); function shoot(){ this should be this be enought, right?
(comments are locked)
|
|
Well nothing is really wrong with it but the variable bullitprefab has to be rigidbody. Let me give you an example on how I would use this, and explain some stuff: tnx a lot Thomas, but now i have this error when i'm compiling it: expecting ( found 'shoot', when you crate a new function.. any idea of wht it might be?
Jun 18 '12 at 07:59 PM
ruifernandes01
Edited my answer, and by some reason my nickname won't show.... well that's my problem.
Jun 23 '12 at 07:36 PM
Hybris
i'm still with the same problem, in line twelve..
Jun 23 '12 at 08:33 PM
ruifernandes01
oh srry, for some reason it didn't update, it should work now. add at the end of update function an { remove the last } of the shoot function, srry my mistake it's hard to throw in code
Jun 24 '12 at 07:40 AM
Hybris
no problem! :) now there is an problem on : if(Vector3.Distance(transform.position, transform.Find("Player")) < 10){
Jun 24 '12 at 01:05 PM
ruifernandes01
(comments are locked)
|
|
hey, thanks for your availability! I now have some errors like:
can you "inlightme" one more time? plz last } too much, srry will update my answer right away!...stupid me......thats like very stupid of me...cant believe it.. BTW plz make a comment instead of an answer oh and unity acts weird if you still have the error of var not expected do this: var bullet : Rigidbody; bullet = Instantiate(bulletprefab, spawn.position, transform.rotation); It's just the long way around, sometimes unity does this I don't know why
May 25 '12 at 06:31 PM
Hybris
(comments are locked)
|
|
I'm kind of a newbie in scripting... i've created my function, one called Shoot.right?
(comments are locked)
|


It should, but what is calling the
Shootfunction?