Premier commit

This commit is contained in:
2026-09-01 22:41:37 +02:00
commit 7cff988739
133 changed files with 6412 additions and 0 deletions
@@ -0,0 +1,24 @@
extends Node3D
class_name Bullet
const MAX_LIFETIME = 3.
var damage : float = 10.
var speed : float = 150.
var lifetime : float = 0.
@onready var raycast : RayCast3D = %RayCast3D
func _process(delta):
lifetime += delta
position += transform.basis * Vector3(0,0,-speed) * delta
if raycast.is_colliding():
if raycast.get_collider() is Alien:
raycast.get_collider().hit(damage)
queue_free()
if raycast.get_collider() is StaticBody3D:
queue_free()
if lifetime > MAX_LIFETIME:
queue_free()
@@ -0,0 +1 @@
uid://es5nf3pho7t1
@@ -0,0 +1,28 @@
[gd_scene format=3 uid="uid://da2dnjy802y1l"]
[ext_resource type="Script" uid="uid://es5nf3pho7t1" path="res://entities/mecha/weapons/gatling/bullet/bullet.gd" id="1_s22gb"]
[sub_resource type="CapsuleMesh" id="CapsuleMesh_yf5fn"]
radius = 0.328125
height = 2.694336
radial_segments = 4
rings = 1
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_57qmd"]
shading_mode = 0
albedo_color = Color(0.99215686, 0.9372549, 0.56078434, 1)
disable_receive_shadows = true
[node name="Bullet" type="Node3D" unique_id=226363088]
script = ExtResource("1_s22gb")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=564603597]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, 0)
mesh = SubResource("CapsuleMesh_yf5fn")
surface_material_override/0 = SubResource("StandardMaterial3D_57qmd")
[node name="RayCast3D" type="RayCast3D" parent="." unique_id=888262706]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, -1.3228955)
target_position = Vector3(0, -3, 0)
collide_with_areas = true
+49
View File
@@ -0,0 +1,49 @@
extends Weapon
class_name Gatling
const BULLET_SCENE : PackedScene = preload("res://entities/mecha/weapons/gatling/bullet/bullet.tscn")
var max_bullet_rate : float = 100.
var min_bullet_rate : float = 1.
var bullet_dispersion : float = 0.03
var bullet_rate := min_bullet_rate
var bullet_acc = 0.1
var bullet_decc = 1.
var time_shooting = 0.
func process_fire(delta : float, mecha : Mecha, shoot : bool) -> bool:
if shoot:
bullet_rate = lerp(
bullet_rate,
max_bullet_rate,
min(bullet_acc * delta, 1)
)
else :
bullet_rate = lerp(
bullet_rate,
min_bullet_rate,
min(bullet_decc * delta, 1)
)
time_shooting += delta
if shoot:
for i in range(roundi(bullet_rate * time_shooting)):
time_shooting -= 1/bullet_rate
shoot_bullet(mecha)
else :
time_shooting = 0.
return shoot
func shoot_bullet(mecha : Mecha,):
var new_bullet : Bullet = BULLET_SCENE.instantiate()
new_bullet.rotation.y = mecha.get_target_angle()
new_bullet.position = mecha.get_projectile_spwan_point()
mecha.add_recoil()
add_child(new_bullet)
new_bullet.rotation += Vector3(
randf_range(-bullet_dispersion, bullet_dispersion),
randf_range(-bullet_dispersion, bullet_dispersion),
randf_range(-bullet_dispersion, bullet_dispersion)
)
@@ -0,0 +1 @@
uid://7s4jtqkpp21e
+5
View File
@@ -0,0 +1,5 @@
@abstract
extends Node
class_name Weapon
@abstract func process_fire(delta : float, mecha : Mecha, shoot : bool) -> bool
+1
View File
@@ -0,0 +1 @@
uid://cyonrs821lwwg