first Prototype
This commit is contained in:
parent
89503407e7
commit
c887a2168c
78 changed files with 2494 additions and 2 deletions
14
scenes/weapon/minigun/minigun.gd
Normal file
14
scenes/weapon/minigun/minigun.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class_name Minigun extends "res://scenes/weapon/weapon.gd"
|
||||
|
||||
@onready var bullet = preload("res://scenes/bullet/bulletMinigun/bulletMinigun.tscn" )
|
||||
|
||||
func attack():
|
||||
if cooldownTimer.is_stopped():
|
||||
print(getSpread())
|
||||
spawnBullet()
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
func spawnBullet():
|
||||
var newBullet = bullet.instantiate()
|
||||
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
|
||||
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation + getSpread(), damage, range, penetration)
|
||||
1
scenes/weapon/minigun/minigun.gd.uid
Normal file
1
scenes/weapon/minigun/minigun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bxedwccs1lj6j
|
||||
7
scenes/weapon/minigun/minigun.tscn
Normal file
7
scenes/weapon/minigun/minigun.tscn
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c6lpcf6nk7f3s"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://btyuxgfn12p1y" path="res://scenes/weapon/weapon.tscn" id="1_dt38b"]
|
||||
[ext_resource type="Script" uid="uid://bxedwccs1lj6j" path="res://scenes/weapon/minigun/minigun.gd" id="2_u46t0"]
|
||||
|
||||
[node name="Minigun" instance=ExtResource("1_dt38b")]
|
||||
script = ExtResource("2_u46t0")
|
||||
14
scenes/weapon/railgun/railgun.gd
Normal file
14
scenes/weapon/railgun/railgun.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class_name Railgun extends "res://scenes/weapon/weapon.gd"
|
||||
|
||||
@onready var bullet = preload("res://scenes/bullet/bulletRailgun/bulletRailgun.tscn")
|
||||
|
||||
func attack():
|
||||
if cooldownTimer.is_stopped():
|
||||
spawnBullet()
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
func spawnBullet():
|
||||
var newBullet = bullet.instantiate()
|
||||
newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation, damage, penetration)
|
||||
|
||||
get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
|
||||
1
scenes/weapon/railgun/railgun.gd.uid
Normal file
1
scenes/weapon/railgun/railgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dth0orslxriyp
|
||||
13
scenes/weapon/railgun/railgun.tscn
Normal file
13
scenes/weapon/railgun/railgun.tscn
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bm2e5fwynwur8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://btyuxgfn12p1y" path="res://scenes/weapon/weapon.tscn" id="1_lb4uk"]
|
||||
[ext_resource type="Script" uid="uid://dth0orslxriyp" path="res://scenes/weapon/railgun/railgun.gd" id="2_ur8td"]
|
||||
|
||||
[node name="Railgun" instance=ExtResource("1_lb4uk")]
|
||||
script = ExtResource("2_ur8td")
|
||||
damage = 10
|
||||
cooldown = 10.0
|
||||
penetration = 5
|
||||
|
||||
[node name="cooldownTimer" parent="." index="0"]
|
||||
wait_time = 10.0
|
||||
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
|
||||
20
scenes/weapon/weapon.gd
Normal file
20
scenes/weapon/weapon.gd
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
class_name Weapon extends Node2D
|
||||
|
||||
@onready var bulletPoint = $BulletPoint
|
||||
@onready var cooldownTimer = $cooldownTimer
|
||||
|
||||
@export var damage: int = 1
|
||||
@export var cooldown: float = 0.1
|
||||
@export var penetration: int = 1
|
||||
@export var spread: float = 0.1
|
||||
@export var range: float = 8.0
|
||||
|
||||
func attack():
|
||||
randomize()
|
||||
if cooldownTimer.is_stopped():
|
||||
cooldownTimer.start(cooldown)
|
||||
|
||||
|
||||
func getSpread() -> float:
|
||||
var rng = RandomNumberGenerator.new()
|
||||
return rng.randf_range(-spread, spread)
|
||||
1
scenes/weapon/weapon.gd.uid
Normal file
1
scenes/weapon/weapon.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dpfc01642pwq0
|
||||
12
scenes/weapon/weapon.tscn
Normal file
12
scenes/weapon/weapon.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://btyuxgfn12p1y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dpfc01642pwq0" path="res://scenes/weapon/weapon.gd" id="1_l3xq3"]
|
||||
|
||||
[node name="Weapon" type="Node2D" groups=["weapon"]]
|
||||
script = ExtResource("1_l3xq3")
|
||||
|
||||
[node name="cooldownTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="BulletPoint" type="Marker2D" parent="."]
|
||||
position = Vector2(0, -128)
|
||||
Loading…
Add table
Add a link
Reference in a new issue