first Prototype
This commit is contained in:
parent
89503407e7
commit
c887a2168c
78 changed files with 2494 additions and 2 deletions
40
scenes/bullet/bullet.gd
Normal file
40
scenes/bullet/bullet.gd
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
class_name Bullet extends CharacterBody2D
|
||||
|
||||
@onready var damageArea = $DamageArea
|
||||
@onready var rangeTimer = $rangeTimer
|
||||
|
||||
var speed = 10 * 10000
|
||||
|
||||
var damage: int = 1
|
||||
var penetration: int = 1
|
||||
var penetratedCount: int = 0
|
||||
var range: float = 1.0
|
||||
|
||||
func _ready() -> void:
|
||||
damageArea.damage = damage
|
||||
rangeTimer.start(range)
|
||||
|
||||
func spawn(_positon: Vector2, _rotation: float, _damage: int, _range: float = 8.0, _penetration: int = 1, _speed: int = 10) -> void:
|
||||
global_position = _positon
|
||||
rotation = _rotation
|
||||
damage = _damage
|
||||
$DamageArea.damage = _damage
|
||||
penetration = _penetration
|
||||
range = _range
|
||||
speed = _speed * 10000
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = Vector2.UP.rotated(rotation) * speed * delta
|
||||
move_and_slide()
|
||||
|
||||
func _on_damage_area_area_entered(area: Area2D) -> void:
|
||||
penetratedCount += 1
|
||||
checkPenetration()
|
||||
|
||||
func checkPenetration():
|
||||
if penetration <= penetratedCount:
|
||||
queue_free()
|
||||
|
||||
func _on_range_timer_timeout() -> void:
|
||||
queue_free()
|
||||
1
scenes/bullet/bullet.gd.uid
Normal file
1
scenes/bullet/bullet.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://w5vknsebe1yd
|
||||
30
scenes/bullet/bullet.tscn
Normal file
30
scenes/bullet/bullet.tscn
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://0ndix1r8v6i1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://eqo7k2ronf8k" path="res://scenes/areas/damageArea/damageArea.tscn" id="1_5f68y"]
|
||||
[ext_resource type="Script" uid="uid://w5vknsebe1yd" path="res://scenes/bullet/bullet.gd" id="1_mkndb"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mkndb"]
|
||||
|
||||
[node name="Bullet" type="CharacterBody2D" groups=["bullet"]]
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_mkndb")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -9.53674e-07)
|
||||
scale = Vector2(0.125, 0.25)
|
||||
|
||||
[node name="rangeTimer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[node name="DamageArea" parent="." instance=ExtResource("1_5f68y")]
|
||||
|
||||
[node name="CollisionShape2D" parent="DamageArea" index="0"]
|
||||
shape = SubResource("RectangleShape2D_mkndb")
|
||||
|
||||
[connection signal="timeout" from="rangeTimer" to="." method="_on_range_timer_timeout"]
|
||||
[connection signal="area_entered" from="DamageArea" to="." method="_on_damage_area_area_entered"]
|
||||
|
||||
[editable path="DamageArea"]
|
||||
1
scenes/bullet/bulletMinigun/bulletMinigun.gd
Normal file
1
scenes/bullet/bulletMinigun/bulletMinigun.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name BulletMinigun extends "res://scenes/bullet/bullet.gd"
|
||||
1
scenes/bullet/bulletMinigun/bulletMinigun.gd.uid
Normal file
1
scenes/bullet/bulletMinigun/bulletMinigun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://58udf4vhqogw
|
||||
15
scenes/bullet/bulletMinigun/bulletMinigun.tscn
Normal file
15
scenes/bullet/bulletMinigun/bulletMinigun.tscn
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://ddv7o76dcnpx6"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://0ndix1r8v6i1" path="res://scenes/bullet/bullet.tscn" id="1_a54uy"]
|
||||
[ext_resource type="Script" uid="uid://58udf4vhqogw" path="res://scenes/bullet/bulletMinigun/bulletMinigun.gd" id="2_4u8er"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfwyw1sr6x2np" path="res://icon.svg" id="3_xaefx"]
|
||||
|
||||
[node name="BulletMinigun" instance=ExtResource("1_a54uy")]
|
||||
script = ExtResource("2_4u8er")
|
||||
|
||||
[node name="Sprite2D" parent="." index="1"]
|
||||
position = Vector2(4.76837e-07, 3.41061e-13)
|
||||
scale = Vector2(0.25, 0.25)
|
||||
texture = ExtResource("3_xaefx")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
3
scenes/bullet/bulletPool.tscn
Normal file
3
scenes/bullet/bulletPool.tscn
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[gd_scene format=3 uid="uid://dm0rd88xd5m7k"]
|
||||
|
||||
[node name="bulletPool" type="Node2D" groups=["bulletPool"]]
|
||||
1
scenes/bullet/bulletRailgun/bulletRailgun.gd
Normal file
1
scenes/bullet/bulletRailgun/bulletRailgun.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name BulletRailgun extends "res://scenes/bullet/bullet.gd"
|
||||
1
scenes/bullet/bulletRailgun/bulletRailgun.gd.uid
Normal file
1
scenes/bullet/bulletRailgun/bulletRailgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b884kxhja5sib
|
||||
9
scenes/bullet/bulletRailgun/bulletRailgun.tscn
Normal file
9
scenes/bullet/bulletRailgun/bulletRailgun.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://y7lohopyn6bw"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://0ndix1r8v6i1" path="res://scenes/bullet/bullet.tscn" id="1_0cdtm"]
|
||||
[ext_resource type="Script" uid="uid://b884kxhja5sib" path="res://scenes/bullet/bulletRailgun/bulletRailgun.gd" id="2_pmqys"]
|
||||
|
||||
[node name="BulletRailgun" instance=ExtResource("1_0cdtm")]
|
||||
script = ExtResource("2_pmqys")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
1
scenes/bullet/bulletShotgun/bulletShotgun.gd
Normal file
1
scenes/bullet/bulletShotgun/bulletShotgun.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
class_name BulletShotgun extends "res://scenes/bullet/bullet.gd"
|
||||
1
scenes/bullet/bulletShotgun/bulletShotgun.gd.uid
Normal file
1
scenes/bullet/bulletShotgun/bulletShotgun.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ddbv5kpk32diu
|
||||
9
scenes/bullet/bulletShotgun/bulletShotgun.tscn
Normal file
9
scenes/bullet/bulletShotgun/bulletShotgun.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bye43kihfl72l"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://0ndix1r8v6i1" path="res://scenes/bullet/bullet.tscn" id="1_shfn0"]
|
||||
[ext_resource type="Script" uid="uid://ddbv5kpk32diu" path="res://scenes/bullet/bulletShotgun/bulletShotgun.gd" id="2_mk7vs"]
|
||||
|
||||
[node name="BulletShotgun" instance=ExtResource("1_shfn0")]
|
||||
script = ExtResource("2_mk7vs")
|
||||
|
||||
[editable path="DamageArea"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue