first Prototype
This commit is contained in:
parent
89503407e7
commit
c887a2168c
78 changed files with 2494 additions and 2 deletions
18
scenes/weapon/shotgun/shotgun.gd
Normal file
18
scenes/weapon/shotgun/shotgun.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
class_name Shotgun extends "res://scenes/weapon/weapon.gd"
|
||||
|
||||
@onready var bullet = preload("res://scenes/bullet/bulletShotgun/bulletShotgun.tscn")
|
||||
|
||||
@export var bulletAmount: int = 5
|
||||
|
||||
func attack():
|
||||
if cooldownTimer.is_stopped():
|
||||
spawnBullet()
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
func spawnBullet():
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
for i in range(0, bulletAmount):
|
||||
var newBullet = bullet.instantiate()
|
||||
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation + getSpread(), damage, range, penetration)
|
||||
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
|
||||
1
scenes/weapon/shotgun/shotgun.gd.uid
Normal file
1
scenes/weapon/shotgun/shotgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://c3temu27a4onl
|
||||
12
scenes/weapon/shotgun/shotgun.tscn
Normal file
12
scenes/weapon/shotgun/shotgun.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bpys0cnyfwcun"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://btyuxgfn12p1y" path="res://scenes/weapon/weapon.tscn" id="1_qorbs"]
|
||||
[ext_resource type="Script" uid="uid://c3temu27a4onl" path="res://scenes/weapon/shotgun/shotgun.gd" id="2_p550e"]
|
||||
|
||||
[node name="Shotgun" instance=ExtResource("1_qorbs")]
|
||||
script = ExtResource("2_p550e")
|
||||
bulletAmount = 10
|
||||
damage = 2
|
||||
cooldown = 0.5
|
||||
spread = 0.8
|
||||
range = 0.3
|
||||
Loading…
Add table
Add a link
Reference in a new issue