How do you make a gun?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dezekeerjoran
:warning: Old Version Published before Godot 3 was released.

How do you make a gun that shoots toarts the player? but the gun has a delay of 1 second.
and it doesn’t have gravity(the bullet). hopefuly i am clear.

:bust_in_silhouette: Reply From: VitaZheltyakov

Watch the official demo
https://downloads.tuxfamily.org/godotengine/demos/2.1/Godot-Demos-2.1-latest.zip

oke. witch one?

dezekeerjoran | 2017-01-08 17:33

You will not be able to find it? Ha-ha-ha
“Simple shooter”

VitaZheltyakov | 2017-01-08 19:02

oke thanks but he shoots not toarts the player. but forwards. sorry

dezekeerjoran | 2017-01-08 19:23

“not toarts” - What does it mean? it’s not English

VitaZheltyakov | 2017-01-09 07:54

i mean that the bullet goes to the position of the player on the moment the bullet has been fired. toarts is probably a word just spellt it rong.english i’snt my natif laguage.

dezekeerjoran | 2017-01-09 19:37

toarts = towards? say it fast

jonathanh | 2017-01-10 07:44

probably. but still do i not have an answer

dezekeerjoran | 2017-01-10 19:59

:bust_in_silhouette: Reply From: sionco

For 2D/3D have a look at the “look_at” methods.

There are two possible ways to use it:

  1. Use it on the gun to point the gun in the direction of the player, then when you create a bullet copy the angle to the bullet.

  2. Use it on the bullet. When you create a bullet, set the bullet’s angle to look at the player using look_at.