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
Binary file not shown.
@@ -0,0 +1,71 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://hq2acth6vm2d"
path="res://.godot/imported/mecha-body.blend-9265dc8fca82c0eb6c666e9c3b7ef0a5.scn"
[deps]
source_file="res://entities/mecha/assets/3d/mecha-body.blend"
dest_files=["res://.godot/imported/mecha-body.blend-9265dc8fca82c0eb6c666e9c3b7ef0a5.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
mesh_library/use_node_names_as_mesh_names=false
array_mesh/deduplicate_surfaces=true
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/fallback_path": "res://common/materials/default3d.tres",
"use_external/path": "uid://41afldgohk0o"
}
}
}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/vertex_colors=1
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/gpu_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=2
gltf/texture_map_mode=1
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,71 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cahdsj2xg25fy"
path="res://.godot/imported/mecha-leg.blend-6470342e2c60263cb402b38e461944d0.scn"
[deps]
source_file="res://entities/mecha/assets/3d/mecha-leg.blend"
dest_files=["res://.godot/imported/mecha-leg.blend-6470342e2c60263cb402b38e461944d0.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
mesh_library/use_node_names_as_mesh_names=false
array_mesh/deduplicate_surfaces=true
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/fallback_path": "res://common/materials/default3d.tres",
"use_external/path": "uid://41afldgohk0o"
}
}
}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/vertex_colors=1
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/gpu_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=2
gltf/texture_map_mode=1
Binary file not shown.
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="icon icon-tabler icons-tabler-outline icon-tabler-viewfinder"
version="1.1"
id="svg7"
sodipodi:docname="pointer.svg"
inkscape:version="1.3.2 (091e20e, 2023-11-25, custom)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs7">
<inkscape:path-effect
effect="fillet_chamfer"
id="path-effect2"
is_visible="true"
lpeversion="1"
nodesatellites_param="F,0,1,1,0,3.0840606,0,1 @ F,0,1,1,0,3.0840606,0,1 @ F,0,1,1,0,3.0840606,0,1 @ F,0,0,1,0,3.0840606,0,1"
radius="0"
unit="px"
method="auto"
mode="F"
chamfer_steps="1"
flexible="false"
use_knot_distance="true"
apply_no_radius="true"
apply_with_radius="true"
only_selected="false"
hide_knots="false" />
</defs>
<sodipodi:namedview
id="namedview7"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:showpageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
inkscape:deskcolor="#505050"
inkscape:zoom="26.162951"
inkscape:cx="7.8546186"
inkscape:cy="10.855045"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg7" />
<path
stroke="none"
d="M0 0h24v24H0z"
fill="none"
id="path1" />
<path
style="opacity:0.99;fill:#ffffff;stroke:none;stroke-width:7.32073;stroke-linecap:round;paint-order:stroke fill markers"
d="M 4.5637528,7.5609963 10.142119,18.132668 a 1.7858436,1.7858436 2.2539244 0 0 3.088495,0.121559 L 20.496517,6.7727607 A 1.1112523,1.1112523 52.142331 0 0 19.21332,5.1219064 L 15.745404,6.2515455 A 10.824164,10.824164 177.861 0 1 9.8175039,6.472952 L 6.1199605,5.5671764 A 1.386555,1.386555 127.9726 0 0 4.5637528,7.5609963 Z"
id="path2"
inkscape:path-effect="#path-effect2"
inkscape:original-d="M 3.1244684,4.8333801 11.581403,20.860284 22.145728,4.1667036 12.812996,7.2067483 Z"
transform="matrix(1.190867,0,0,1.190867,-2.3927323,-2.3049427)" />
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@@ -0,0 +1,44 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dvgqy34aw6xfc"
path.s3tc="res://.godot/imported/pointer.svg-f098bd9bb13ed2213cbb52b3b3bd4f05.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://entities/mecha/assets/textures/pointer.svg"
dest_files=["res://.godot/imported/pointer.svg-f098bd9bb13ed2213cbb52b3b3bd4f05.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
svg/scale=5.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false
+142
View File
@@ -0,0 +1,142 @@
@tool
extends CharacterBody3D
class_name Mecha
const STEP_MOVE_DISPLACEMENT = 3
const RECOIL_STRENGHT = 0.5
const MOUSE_SENSIVITY = 0.01
const ZOOM_SENSIVITY = 1.
const MAX_ZOOM = 60.
const MIN_ZOOM = 15.
const MAX_HP : float = 50.
signal died
@export var hp : float = MAX_HP
@export var max_speed : float = 15.
@export var turn_speed : float = 5.
var destination := Vector2()
@onready var legs : Array[MechaLeg] = [
%Leg1,
%Leg2,
%Leg3,
%Leg4,
]
var turn_normal : Vector2 = Vector2.UP
var selected_item = 0
var current_recoil = 0.
func _ready():
for l in legs:
l.step.connect(next_leg_can_step)
func next_leg_can_step():
for l in legs:
l.can_step = false
await get_tree().create_timer(MechaLeg.STEP_DURATION / len(legs)).timeout
for l in legs:
l.can_step = true
func _process(delta):
if not Engine.is_editor_hint():
var target = calculate_target_position()
%Target.global_position = target
var target_turn = (Vector2(position.x,position.z) - Vector2(target.x,target.z)).normalized()
turn_normal = lerp(
turn_normal,
target_turn,
min(turn_speed * delta, 1.)
)
var speed = 0.
var item_used = false
for i in range(len(%Inventory.get_children())):
var item = %Inventory.get_children()[i]
if item is Weapon:
var used = item.process_fire(
delta,
self,
selected_item == i and Input.is_action_pressed("fire")
)
if used:
item_used = true
if not item_used and Input.is_action_pressed("move_to"):
speed = max_speed
var front_factor = 1 - (turn_normal - target_turn).length() / 2.
velocity = position.direction_to(target) * speed * front_factor
%Model.rotation.y = - turn_normal.angle()
# Recoil
%Model.position = Vector3(turn_normal.x, 0, turn_normal.y) * current_recoil * RECOIL_STRENGHT
current_recoil = lerp(current_recoil, 0., 0.5)
%StepTargets.position.x = lerp(
0,
-STEP_MOVE_DISPLACEMENT,
speed/max_speed
)
%Camera3D.look_at(self.position)
move_and_slide()
func calculate_target_position() -> Vector3:
var camera : Camera3D = get_viewport().get_camera_3d()
if camera:
var ray_normal := camera.project_ray_normal(get_viewport().get_mouse_position())
var ray_origin := camera.project_ray_origin(get_viewport().get_mouse_position())
var plane = Plane(Vector3.UP, 0)
var intersection = plane.intersects_ray(ray_origin, ray_normal)
if intersection:
return intersection
return global_position
func get_target_angle() -> float:
return - turn_normal.angle() + PI / 2
func get_projectile_spwan_point() -> Vector3:
return global_position + Vector3.UP * 2.
func add_recoil(recoil : = 1.):
current_recoil += recoil
func hit(damage = 1.):
hp = max(0, hp - damage)
if hp == 0:
die()
func die():
died.emit()
func _unhandled_input(event):
if Input.is_action_just_pressed("zoom_in"):
%Camera3D.position.z = max(MIN_ZOOM, %Camera3D.position.z - ZOOM_SENSIVITY)
if Input.is_action_just_pressed("zoom_out"):
%Camera3D.position.z = min(MAX_ZOOM, %Camera3D.position.z + ZOOM_SENSIVITY)
if event is InputEventMouseMotion and Input.is_action_pressed("turn_camera") and Input.mouse_mode == Input.MOUSE_MODE_VISIBLE:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
%CameraPivot.rotation.y -= event.relative.x * MOUSE_SENSIVITY
%CameraPivot.rotation.x -= event.relative.y * MOUSE_SENSIVITY
if %CameraPivot.rotation.x > deg_to_rad(-20):
%CameraPivot.rotation.x = deg_to_rad(-20)
if %CameraPivot.rotation.x < deg_to_rad(-80):
%CameraPivot.rotation.x = deg_to_rad(-80)
+1
View File
@@ -0,0 +1 @@
uid://bbjxgsv6p27ly
+94
View File
@@ -0,0 +1,94 @@
[gd_scene format=3 uid="uid://0t1qprxnrxpw"]
[ext_resource type="Script" uid="uid://bbjxgsv6p27ly" path="res://entities/mecha/mecha.gd" id="1_ariye"]
[ext_resource type="PackedScene" uid="uid://hq2acth6vm2d" path="res://entities/mecha/assets/3d/mecha-body.blend" id="1_wfen8"]
[ext_resource type="PackedScene" uid="uid://dhgclnvdm41nl" path="res://entities/mecha/mecha_leg.tscn" id="2_p6u1l"]
[ext_resource type="Texture2D" uid="uid://dvgqy34aw6xfc" path="res://entities/mecha/assets/textures/pointer.svg" id="4_ua006"]
[ext_resource type="Script" uid="uid://7s4jtqkpp21e" path="res://entities/mecha/weapons/gatling/gatling.gd" id="5_pfbkk"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_g4v7s"]
height = 5.0075684
radius = 2.546875
[node name="Mecha" type="CharacterBody3D" unique_id=608967332]
axis_lock_linear_y = true
axis_lock_angular_x = true
axis_lock_angular_z = true
motion_mode = 1
script = ExtResource("1_ariye")
max_speed = 20.0
[node name="Model" type="Node3D" parent="." unique_id=1153097662]
unique_name_in_owner = true
[node name="mecha-body" parent="Model" unique_id=479724907 instance=ExtResource("1_wfen8")]
transform = Transform3D(1.3113416e-07, 0, -1, 0, 1, 0, 1, 0, 1.3113416e-07, 0, 2, 0)
[node name="Leg1" parent="Model" unique_id=1161871766 instance=ExtResource("2_p6u1l")]
unique_name_in_owner = true
transform = Transform3D(-0.70710665, 0, -0.70710677, 0, 1, 0, 0.70710677, 0, -0.70710665, 0, 2, 0)
step_target_path = NodePath("../StepTargets/Marker3D")
[node name="Leg2" parent="Model" unique_id=1040806054 instance=ExtResource("2_p6u1l")]
unique_name_in_owner = true
transform = Transform3D(0.70710677, 0, -0.70710665, 0, 1, 0, 0.70710665, 0, 0.70710677, 0, 2, 0)
step_target_path = NodePath("../StepTargets/Marker3D2")
[node name="Leg3" parent="Model" unique_id=636817449 instance=ExtResource("2_p6u1l")]
unique_name_in_owner = true
transform = Transform3D(0.70710665, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710665, 0, 2, 0)
step_target_path = NodePath("../StepTargets/Marker3D3")
[node name="Leg4" parent="Model" unique_id=373252400 instance=ExtResource("2_p6u1l")]
unique_name_in_owner = true
transform = Transform3D(-0.70710677, 0, 0.70710665, 0, 1, 0, -0.70710665, 0, -0.70710677, 0, 2, 0)
step_target_path = NodePath("../StepTargets/Marker3D4")
[node name="StepTargets" type="Node3D" parent="Model" unique_id=1107229276]
unique_name_in_owner = true
[node name="Marker3D" type="Marker3D" parent="Model/StepTargets" unique_id=1883887265]
transform = Transform3D(-0.7071066, 0, -0.7071067, 0, 1, 0, 0.7071067, 0, -0.7071066, -2.1213202, 0, 2.1213205)
[node name="Marker3D2" type="Marker3D" parent="Model/StepTargets" unique_id=2083428784]
transform = Transform3D(0.7071067, 0, -0.7071066, 0, 1, 0, 0.7071066, 0, 0.7071067, 2.1213205, 0, 2.1213202)
[node name="Marker3D3" type="Marker3D" parent="Model/StepTargets" unique_id=203630463]
transform = Transform3D(0.7071066, 0, 0.7071067, 0, 1, 0, -0.7071067, 0, 0.7071066, 2.12132, 0, -2.1213207)
[node name="Marker3D4" type="Marker3D" parent="Model/StepTargets" unique_id=1646251219]
transform = Transform3D(-0.7071067, 0, 0.7071066, 0, 1, 0, -0.7071066, 0, -0.7071067, -2.1213207, 0, -2.1213205)
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=781282910]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5037842, 0)
shape = SubResource("CylinderShape3D_g4v7s")
[node name="TargetContainer" type="Node" parent="." unique_id=857862335]
[node name="Target" type="Node3D" parent="TargetContainer" unique_id=871238190]
unique_name_in_owner = true
[node name="Sprite3D" type="Sprite3D" parent="TargetContainer/Target" unique_id=328289766]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9376632, -0.07640457)
modulate = Color(0.79607844, 0.2627451, 0.3647059, 1)
pixel_size = 0.02
billboard = 1
no_depth_test = true
texture = ExtResource("4_ua006")
[node name="CameraPivot" type="Node3D" parent="." unique_id=1668504271]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.8660253, 0.49999997, 0, -0.49999997, 0.8660253, 0, 0, 0)
[node name="Camera3D" type="Camera3D" parent="CameraPivot" unique_id=2082056518]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 50)
[node name="Inventory" type="Node3D" parent="." unique_id=1873054596]
unique_name_in_owner = true
[node name="Gatling" type="Node" parent="Inventory" unique_id=2131873567]
script = ExtResource("5_pfbkk")
metadata/_custom_type_script = "uid://7s4jtqkpp21e"
[editable path="Model/mecha-body"]
+32
View File
@@ -0,0 +1,32 @@
@tool
extends Node3D
class_name MechaLeg
const STEP_DURATION = 0.15
signal step
@export_node_path("Node3D") var step_target_path : NodePath
@onready var local_target : Node3D = %LocalTarget
@export var step_distance: float = 5
@export var can_step = true
func _process(_delta):
if step_target_path and can_step:
var step_target : Node3D = get_node(step_target_path) as Node3D
var dist := step_target.global_position.distance_to(local_target.global_position)
if dist > step_distance:
step.emit()
tween_step(get_node(step_target_path).global_position)
func tween_step(target_pos: Vector3):
var tween = create_tween().set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
tween.set_parallel(true)
tween.tween_property(local_target, "global_position:x", target_pos.x, STEP_DURATION * 0.7)
tween.tween_property(local_target, "global_position:z", target_pos.z, STEP_DURATION * 0.7)
tween.tween_property(local_target, "global_position:y", target_pos.y + 1.5, STEP_DURATION * 0.5)
tween.set_parallel(false)
tween.tween_property(local_target, "global_position:y", target_pos.y, STEP_DURATION * 0.3)
+1
View File
@@ -0,0 +1 @@
uid://brd008shv85w7
+57
View File
@@ -0,0 +1,57 @@
[gd_scene format=3 uid="uid://dhgclnvdm41nl"]
[ext_resource type="PackedScene" uid="uid://cahdsj2xg25fy" path="res://entities/mecha/assets/3d/mecha-leg.blend" id="1_h7rhd"]
[ext_resource type="Script" uid="uid://brd008shv85w7" path="res://entities/mecha/mecha_leg.gd" id="1_rf6lx"]
[node name="MechaLeg" type="Node3D" unique_id=1161871766]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.673074, 0.8926722, -2.4868906)
script = ExtResource("1_rf6lx")
step_target_path = NodePath("StepTarget")
step_distance = 4.0
[node name="StepTarget" type="Marker3D" parent="." unique_id=1875541333]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, -2, 0)
[node name="mecha-leg" parent="." unique_id=597959552 instance=ExtResource("1_h7rhd")]
transform = Transform3D(0.83249575, -0.55403143, 0, 0.55403143, 0.83249575, 0, 0, 0, 1, -0.018096328, 0, -0.013853073)
[node name="Skeleton3D" parent="mecha-leg/Armature" parent_id_path=PackedInt32Array(597959552, 1015042136) index="0" unique_id=1015525704]
bones/0/rotation = Quaternion(-3.2671387e-08, -1.890937e-08, -0.86549115, 0.5009242)
bones/0/scale = Vector3(0.99999994, 0.99999994, 1)
bones/1/position = Vector3(7.566918e-08, 2, -1.2818292e-14)
bones/1/rotation = Quaternion(-2.992432e-08, 6.2881918e-15, -0.39635947, 0.9180954)
bones/1/scale = Vector3(1.0000002, 1.0000002, 1)
bones/2/position = Vector3(6.1847814e-08, 2.1000001, 3.2634116e-14)
bones/2/rotation = Quaternion(-2.8624317e-08, -1.0078329e-14, -0.3791404, 0.92533916)
[node name="Bone_001" parent="mecha-leg/Armature/Skeleton3D" index="0" unique_id=442116879]
transform = Transform3D(-0.91758627, -0.39747998, 0.006730333, 0.39629143, -0.9132409, 0.094576165, -0.031445723, 0.089448966, 0.9954949, 1.6874223, -1.0735638, 0.008158923)
[node name="Bone" parent="mecha-leg/Armature/Skeleton3D" index="1" unique_id=1147044007]
transform = Transform3D(-0.5367859, 0.84371114, -0.00349133, -0.8437184, -0.53678185, 0.0021121316, -9.205331e-05, 0.0040794616, 0.99999166, 0, 0, 0)
[node name="CCDIK3D" type="CCDIK3D" parent="mecha-leg/Armature/Skeleton3D" index="2" unique_id=720183381]
angular_delta_limit = 0.606676447993229
deterministic = true
setting_count = 1
settings/0/target_node = NodePath("../../../../Node/LocalTarget")
settings/0/root_bone_name = "Bone"
settings/0/root_bone = 0
settings/0/end_bone_name = "Bone.002"
settings/0/end_bone = 2
settings/0/extend_end_bone = false
settings/0/joint_count = 3
settings/0/joints/0/rotation_axis = 3
settings/0/joints/0/limitation = null
settings/0/joints/1/rotation_axis = 3
settings/0/joints/1/limitation = null
settings/0/joints/2/rotation_axis = 3
settings/0/joints/2/limitation = null
[node name="Node" type="Node" parent="." unique_id=196901171]
[node name="LocalTarget" type="Marker3D" parent="Node" unique_id=1076144472]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.3219225, -1.137534, -2.3036175)
[editable path="mecha-leg"]
@@ -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