I have a small top-down shooter, and when the character shoots, the bullet is always in the same position, about 0.6 units above the player. And, the direction is always the same. I used this code.
if(Input.GetKeyDown(Keycode.Space)){
Instantiate(bullet, transform.position + Vector2(0, 0.6), Quaternion.identity);
}
It is only part of the code though…
Well you are actually creating bullets in front of the player with that code.You only Instantiate a bullet once for all your hitting space button.This is not a code for shooting
– ozturkcompanyThis is a tank. No rapid fire required. And no, I know how to do all the addForce stuff.
– LukamyteInstantiate? Well without seeing the rest of the code and talking about the code you posted,you set the bullet to be infront of the character about 0.6 units in here "transform.position + Vector2(0, 0.6)" and the direction is always the same because you set the rotation to Quaternion.identity
– ozturkcompanyso what do i do for the rotation?
– Lukamyte