Turret. How i can do it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Turret. How i can do it?

People, all sprites call the letters of the alphabet, how to make a damn turret, what would the sprite b spawn sprite c that flies into the sprite v, forgive me if the question is stupid. Unity

9th Jul 2019, 5:16 PM
Anton
1 Answer
0
I assume that you mean a stationary, occasionally shooting object. The object obviously needs to rotate, so that it faces the player when shooting. I don't know how exactly to do this, but I think you can use ray casts. Then you have to use a timer if you want it to shoot at a consistent pace or implement another system if you want it to shoot at random intervals. You need one Prefab as the bullet/projectile of your turret. You can instantiate it using the Instantiate function, and rotate it, so that it faces the same way as your turret does. I unfortunately do not have any code to share, but I hope I could be of help.
5th Apr 2021, 7:41 AM
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️
️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️️ - avatar