Skip to content

Scene PlayerGun

Matthew Mahan edited this page Nov 13, 2023 · 1 revision

Scene PlayerGun

Variables

  • var cooldown
    • Number of ticks before the gun can be shot again.
  • var time_to_live
    • Maximum lifetime of a bullet before deleting itself.
  • var speed
    • Speed of a bullet.

Methods

  • func shoot_left(s, hardpoint=self) -> null:

    • s is the object holding the gun.
    • hardpoint is this gun instance.
    • Creates a new bullet with velocity in the direction of aim.
    • Plays animations of shooting.
    • Plays sounds of shooting.
  • func _physics_process(delta) -> null:

    • Counts down the ticks after shooting.
    • Destroys a bullet that collides with an object.
    • Changes the position of the gun to visually represent the direction of aim.

Clone this wiki locally