This commit is contained in:
qwertzuiopy 2025-04-14 22:07:39 +02:00
parent 02ea283fa5
commit 4160fd0d8c
48 changed files with 1477 additions and 80 deletions

16
components/reactor.gd Normal file
View file

@ -0,0 +1,16 @@
extends Node
class_name Reactor
var energy: float = 1.0
var production: float = 0.005
func _physics_process(_delta: float) -> void:
energy += production
energy = minf(1.0, energy)
func try_drain(amount) -> bool:
if energy < amount:
return false
else:
energy -= amount
return true

View file

@ -0,0 +1 @@
uid://0d467kggbn3d

6
components/reactor.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dqic53gtybiyf"]
[ext_resource type="Script" uid="uid://0d467kggbn3d" path="res://components/reactor.gd" id="1_yoeux"]
[node name="reactor" type="Node"]
script = ExtResource("1_yoeux")

16
hud/aim_indicator.gd Normal file
View file

@ -0,0 +1,16 @@
extends Control
class_name AimIndicator
@export var player: Player
@onready var dot: Sprite2D = $dot
func _physics_process(_delta: float) -> void:
if player == null:
return
var angle := player.radar.get_closest_threat_angle(player.global_rotation)
if angle == 100:
dot.visible = false
else:
dot.visible = true
dot.position.x = angle / PI * 13.0

1
hud/aim_indicator.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bkcrwbj4qsyu6

BIN
hud/aim_indicator/dot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cxfxrcm7n85cp"
path="res://.godot/imported/dot.png-7c9255f201ba11edc4a0fe23c3290ff1.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/aim_indicator/dot.png"
dest_files=["res://.godot/imported/dot.png-7c9255f201ba11edc4a0fe23c3290ff1.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/aim_indicator/scale.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://phih5e11qe3a"
path="res://.godot/imported/scale.png-57744c464fe9e89383ba0f36c96fe685.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/aim_indicator/scale.png"
dest_files=["res://.godot/imported/scale.png-57744c464fe9e89383ba0f36c96fe685.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

View file

@ -0,0 +1 @@
extends Control

View file

@ -0,0 +1 @@
uid://cbfjmrwk5vvgx

BIN
hud/dia_smalll.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 B

34
hud/dia_smalll.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://tnjq0pju1y5o"
path="res://.godot/imported/dia_smalll.png-c5ef927364136ffb39c9023ac1d62f5a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/dia_smalll.png"
dest_files=["res://.godot/imported/dia_smalll.png-c5ef927364136ffb39c9023ac1d62f5a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/dial.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

34
hud/dial.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c7pknth5b6pt6"
path="res://.godot/imported/dial.png-204b560adca7d42912b76c878d309f42.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/dial.png"
dest_files=["res://.godot/imported/dial.png-204b560adca7d42912b76c878d309f42.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/dial_full.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 B

34
hud/dial_full.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dxnwaxcclojrh"
path="res://.godot/imported/dial_full.png-536b6a74c15baf626163cb0cdbe790ea.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/dial_full.png"
dest_files=["res://.godot/imported/dial_full.png-536b6a74c15baf626163cb0cdbe790ea.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

14
hud/energy_indicator.gd Normal file
View file

@ -0,0 +1,14 @@
extends Control
class_name EnergyIndicator
@export var player: Player
@onready var fg: Sprite2D = $fg
@onready var upper: Marker2D = $upper
@onready var lower: Marker2D = $lower
func _physics_process(_delta: float) -> void:
var energy := player.reactor.energy
var upperb := remap(upper.position.y, -34, 0, 0, 1)
var lowerb := remap(lower.position.y, -34, 0, 0, 1)
var min_y := remap(1.0 - energy, 0, 1, upperb, lowerb)
(fg.material as ShaderMaterial).set_shader_parameter("min_y", min_y)

View file

@ -0,0 +1 @@
uid://dm6tu57vgijdh

11
hud/hud.gd Normal file
View file

@ -0,0 +1,11 @@
extends CanvasLayer
class_name Hud
@export var player: Player
@export var aim_indicator: AimIndicator
@export var energy_indicator: EnergyIndicator
func _ready() -> void:
aim_indicator.player = player
energy_indicator.player = player

1
hud/hud.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://dwjysathl0a8g

102
hud/hud.tscn Normal file
View file

@ -0,0 +1,102 @@
[gd_scene load_steps=13 format=3 uid="uid://cyq7l8x1pbh1h"]
[ext_resource type="Script" uid="uid://dwjysathl0a8g" path="res://hud/hud.gd" id="1_0ivg5"]
[ext_resource type="Texture2D" uid="uid://c7pknth5b6pt6" path="res://hud/dial.png" id="1_6ca3a"]
[ext_resource type="Texture2D" uid="uid://dtrxl6d62e3c2" path="res://hud/text.png" id="1_318vg"]
[ext_resource type="Script" uid="uid://dm6tu57vgijdh" path="res://hud/energy_indicator.gd" id="2_1kkc0"]
[ext_resource type="Texture2D" uid="uid://dxnwaxcclojrh" path="res://hud/dial_full.png" id="2_2gk58"]
[ext_resource type="Script" uid="uid://bkcrwbj4qsyu6" path="res://hud/aim_indicator.gd" id="4_fjv1a"]
[ext_resource type="Shader" uid="uid://b1dxg2p1lqx1g" path="res://hud/yclip.gdshader" id="4_qv4qp"]
[ext_resource type="Texture2D" uid="uid://phih5e11qe3a" path="res://hud/aim_indicator/scale.png" id="4_w8tcp"]
[ext_resource type="Texture2D" uid="uid://cxfxrcm7n85cp" path="res://hud/aim_indicator/dot.png" id="5_svhta"]
[ext_resource type="Script" uid="uid://cbfjmrwk5vvgx" path="res://hud/component_indicators.gd" id="10_sh35x"]
[ext_resource type="Texture2D" uid="uid://tnjq0pju1y5o" path="res://hud/dia_smalll.png" id="11_gms7k"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_sh35x"]
shader = ExtResource("4_qv4qp")
shader_parameter/min_y = 0.235291
[node name="hud" type="CanvasLayer" node_paths=PackedStringArray("aim_indicator", "energy_indicator")]
script = ExtResource("1_0ivg5")
aim_indicator = NodePath("aim_indicator")
energy_indicator = NodePath("energy_indicator")
[node name="energy_indicator" type="Control" parent="."]
layout_mode = 3
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = 10.0
offset_top = -8.0
offset_right = 10.0
offset_bottom = -8.0
grow_vertical = 0
scale = Vector2(6, 6)
script = ExtResource("2_1kkc0")
[node name="bg" type="Sprite2D" parent="energy_indicator"]
position = Vector2(17, -17)
texture = ExtResource("1_6ca3a")
[node name="fg" type="Sprite2D" parent="energy_indicator"]
modulate = Color(1.1, 1.1, 1.1, 1)
material = SubResource("ShaderMaterial_sh35x")
position = Vector2(17, -17)
texture = ExtResource("2_2gk58")
[node name="upper" type="Marker2D" parent="energy_indicator"]
position = Vector2(17.5, -26.0001)
gizmo_extents = 3.0
[node name="lower" type="Marker2D" parent="energy_indicator"]
position = Vector2(17.3333, -11)
gizmo_extents = 3.0
[node name="text" type="Sprite2D" parent="energy_indicator"]
position = Vector2(17.5, -6)
texture = ExtResource("1_318vg")
[node name="aim_indicator" type="Control" parent="."]
layout_mode = 3
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_top = -39.0
offset_bottom = -39.0
grow_horizontal = 2
grow_vertical = 0
scale = Vector2(6, 6)
script = ExtResource("4_fjv1a")
[node name="scale" type="Sprite2D" parent="aim_indicator"]
texture = ExtResource("4_w8tcp")
[node name="dot" type="Sprite2D" parent="aim_indicator"]
position = Vector2(-13, 0)
texture = ExtResource("5_svhta")
[node name="component_indicators" type="Control" parent="."]
layout_mode = 3
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 0
grow_vertical = 0
scale = Vector2(6, 6)
script = ExtResource("10_sh35x")
[node name="Sprite2D" type="Sprite2D" parent="component_indicators"]
position = Vector2(-11.1667, -11.3333)
texture = ExtResource("11_gms7k")
[node name="Sprite2D2" type="Sprite2D" parent="component_indicators"]
position = Vector2(-28.8333, -11.3333)
texture = ExtResource("11_gms7k")
[node name="Sprite2D3" type="Sprite2D" parent="component_indicators"]
position = Vector2(-46.3333, -11)
texture = ExtResource("11_gms7k")

BIN
hud/radar/line_pattern.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://u24e08wntllm"
path="res://.godot/imported/line_pattern.png-2d0f0bbd403bb86e0dc98f37128c7313.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/radar/line_pattern.png"
dest_files=["res://.godot/imported/line_pattern.png-2d0f0bbd403bb86e0dc98f37128c7313.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/radar/line_pattern1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://45x7cysybp10"
path="res://.godot/imported/line_pattern1.png-e905f27dc8bd4716c98832f5f3f2141d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/radar/line_pattern1.png"
dest_files=["res://.godot/imported/line_pattern1.png-e905f27dc8bd4716c98832f5f3f2141d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/radar/line_pattern2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bdeu7o7ot7863"
path="res://.godot/imported/line_pattern2.png-b42d98c671fa3c9f40176e695342dc34.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/radar/line_pattern2.png"
dest_files=["res://.godot/imported/line_pattern2.png-b42d98c671fa3c9f40176e695342dc34.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/radar/line_pattern3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dj8k7p8o7w11w"
path="res://.godot/imported/line_pattern3.png-32a68df136812f801e41f935ea854235.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/radar/line_pattern3.png"
dest_files=["res://.godot/imported/line_pattern3.png-32a68df136812f801e41f935ea854235.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

BIN
hud/radar/line_pattern4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dol4rha25gfdq"
path="res://.godot/imported/line_pattern4.png-b7ca190a13a81dba84de16d5bec367de.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/radar/line_pattern4.png"
dest_files=["res://.godot/imported/line_pattern4.png-b7ca190a13a81dba84de16d5bec367de.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

View file

@ -28,3 +28,18 @@ func release_danger(node: Node2D) -> void:
func _process(_delta: float) -> void:
global_rotation = 0.0
# returns 100 if there is no threat, else -PI to PI
func get_closest_threat_angle(angle: float) -> float:
var min_diff: float = 100
for i: int in get_child_count():
var threat: Threat = get_child(i)
var a := global_position.angle_to_point(threat.node.global_position) - angle + PI / 2
while a > PI:
a -= 2 * PI
while a < -PI:
a += 2 * PI
if abs(a) < abs(min_diff):
min_diff = a
return min_diff

View file

@ -2,6 +2,8 @@ extends Sprite2D
class_name Threat
@export var node: Node2D
@onready var line: Line2D = $line
@onready var animations: AnimationPlayer = $animations
const dst: float = 70.0
@ -11,11 +13,10 @@ func _physics_process(_delta: float) -> void:
else:
position = dst * (node.global_position - get_parent().global_position).normalized()
modulate.a = 1
line.points[0] = -position
func declare_danger():
print("danger")
$animations.play("blink")
animations.play("blink")
func release_danger():
print("no danger")
$animations.stop()
animations.stop()
visible = true

View file

@ -1,7 +1,26 @@
[gd_scene load_steps=6 format=3 uid="uid://dwk5lnfnntqh2"]
[gd_scene load_steps=11 format=3 uid="uid://dwk5lnfnntqh2"]
[ext_resource type="Texture2D" uid="uid://b8u4cc61kpl" path="res://hud/radar/threat_normal.png" id="1_cuq7j"]
[ext_resource type="Script" uid="uid://bm76ox7rvuita" path="res://hud/radar/threat.gd" id="2_oq6ws"]
[ext_resource type="Texture2D" uid="uid://45x7cysybp10" path="res://hud/radar/line_pattern1.png" id="3_66ojb"]
[ext_resource type="Texture2D" uid="uid://bdeu7o7ot7863" path="res://hud/radar/line_pattern2.png" id="4_k5g0t"]
[ext_resource type="Texture2D" uid="uid://dj8k7p8o7w11w" path="res://hud/radar/line_pattern3.png" id="5_q6cw4"]
[ext_resource type="Texture2D" uid="uid://dol4rha25gfdq" path="res://hud/radar/line_pattern4.png" id="6_qa0nt"]
[sub_resource type="Animation" id="Animation_3aocn"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_oq6ws"]
resource_name = "blink"
@ -20,27 +39,23 @@ tracks/0/keys = {
"values": [false, true, false, true]
}
[sub_resource type="Animation" id="Animation_3aocn"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3aocn"]
_data = {
&"RESET": SubResource("Animation_3aocn"),
&"blink": SubResource("Animation_oq6ws")
}
[sub_resource type="AnimatedTexture" id="AnimatedTexture_hpcgs"]
frames = 4
speed_scale = -2.0
frame_0/texture = ExtResource("3_66ojb")
frame_1/texture = ExtResource("4_k5g0t")
frame_1/duration = 1.0
frame_2/texture = ExtResource("5_q6cw4")
frame_2/duration = 1.0
frame_3/texture = ExtResource("6_qa0nt")
frame_3/duration = 1.0
[node name="threat" type="Sprite2D"]
modulate = Color(2, 2, 2, 1)
texture = ExtResource("1_cuq7j")
@ -50,3 +65,13 @@ script = ExtResource("2_oq6ws")
libraries = {
&"": SubResource("AnimationLibrary_3aocn")
}
[node name="line" type="Line2D" parent="."]
z_index = -1
z_as_relative = false
texture_repeat = 2
points = PackedVector2Array(9, 13, 0, 0)
width = 1.0
default_color = Color(1, 1, 1, 0.458824)
texture = SubResource("AnimatedTexture_hpcgs")
texture_mode = 1

BIN
hud/text.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

34
hud/text.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dtrxl6d62e3c2"
path="res://.godot/imported/text.png-85ac651c4114738a1037075c89a1e462.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://hud/text.png"
dest_files=["res://.godot/imported/text.png-85ac651c4114738a1037075c89a1e462.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1

7
hud/yclip.gdshader Normal file
View file

@ -0,0 +1,7 @@
shader_type canvas_item;
uniform float min_y;
void fragment() {
COLOR = texture(TEXTURE, UV) * step(min_y, UV.y);
}

1
hud/yclip.gdshader.uid Normal file
View file

@ -0,0 +1 @@
uid://b1dxg2p1lqx1g

792
main.tscn

File diff suppressed because one or more lines are too long

View file

@ -3,12 +3,12 @@ class_name Player
@export var thruster_strength := 40.0
@export var rotation_strength := 10.0
@export var drift_curve : Curve
var angular_velocity_target := 0.0
@onready var radar: Radar = $radar
@export var radar: Radar
@export var reactor: Reactor
var delay := false
func _physics_process(delta: float) -> void:

View file

@ -1,12 +1,14 @@
[gd_scene load_steps=18 format=3 uid="uid://b3xadpl4pu33u"]
[gd_scene load_steps=20 format=3 uid="uid://b3xadpl4pu33u"]
[ext_resource type="Script" uid="uid://erjhplyctxik" path="res://player/player.gd" id="1_kkw55"]
[ext_resource type="Texture2D" uid="uid://dlenptyfk1iwn" path="res://player/ship.png" id="2_1h4u8"]
[ext_resource type="PackedScene" uid="uid://cyq7l8x1pbh1h" path="res://hud/hud.tscn" id="2_rgyib"]
[ext_resource type="PackedScene" uid="uid://dnndsvtgqr8eq" path="res://bullet/bullet.tscn" id="2_yw30f"]
[ext_resource type="PackedScene" uid="uid://y08tu4ftj3t4" path="res://player/thruster.tscn" id="3_r6c8y"]
[ext_resource type="Script" uid="uid://dccya6vnwi1x4" path="res://player/railgun.gd" id="5_g6k8r"]
[ext_resource type="PackedScene" uid="uid://800ou0i3omcs" path="res://effects/flash.tscn" id="5_qjkh3"]
[ext_resource type="PackedScene" uid="uid://dfm1atk5lpdo4" path="res://hud/radar/radar.tscn" id="7_rgyib"]
[ext_resource type="PackedScene" uid="uid://dqic53gtybiyf" path="res://components/reactor.tscn" id="9_hg6s5"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_6481p"]
friction = 0.0
@ -44,6 +46,31 @@ scale_max = 2.0
scale_curve = SubResource("CurveTexture_w2mcu")
alpha_curve = SubResource("CurveTexture_q5aon")
[sub_resource type="Animation" id="Animation_g6k8r"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("%railgun/../image:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("%railgun/../image:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_qjkh3"]
resource_name = "shoot"
length = 0.4
@ -85,46 +112,21 @@ tracks/2/keys = {
}]
}
[sub_resource type="Animation" id="Animation_g6k8r"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("%railgun/../image:scale:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("%railgun/../image:scale:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(1, -0.25, 0, 0.25, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_g6k8r"]
_data = {
&"RESET": SubResource("Animation_g6k8r"),
&"shoot": SubResource("Animation_qjkh3")
}
[node name="player" type="RigidBody2D"]
[node name="player" type="RigidBody2D" node_paths=PackedStringArray("radar", "reactor")]
physics_material_override = SubResource("PhysicsMaterial_6481p")
gravity_scale = 0.0
can_sleep = false
angular_damp = 2.0
script = ExtResource("1_kkw55")
thruster_strength = null
rotation_strength = null
drift_curve = SubResource("Curve_f6djc")
radar = NodePath("radar")
reactor = NodePath("components/reactor")
[node name="camera" type="Camera2D" parent="."]
zoom = Vector2(4, 4)
@ -135,6 +137,9 @@ amount = 100
lifetime = 30.0
process_material = SubResource("ParticleProcessMaterial_k0vl1")
[node name="hud" parent="camera" node_paths=PackedStringArray("player") instance=ExtResource("2_rgyib")]
player = NodePath("../..")
[node name="collision" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-5, 7, 0, -7, 5, 7, 2, 8, -2, 8)
@ -162,3 +167,7 @@ libraries = {
}
[node name="radar" parent="." instance=ExtResource("7_rgyib")]
[node name="components" type="Node" parent="."]
[node name="reactor" parent="components" instance=ExtResource("9_hg6s5")]

View file

@ -1,11 +1,12 @@
extends Marker2D
@export var bullet : PackedScene
@export var speed : float = 100.0
@export var knockback : float = 30.0
@export var bullet: PackedScene
@export var speed: float = 100.0
@export var knockback: float = 30.0
@export var energy_cost: float = 0.5
@onready var flash: Flash = %flash
@onready var parent: RigidBody2D = get_parent()
@onready var player: Player = get_parent()
var can_shoot: bool = true
@ -17,12 +18,13 @@ func shoot() -> void:
func do_shoot() -> void:
if not can_shoot:
return
if player.reactor.try_drain(energy_cost):
var instance : Bullet = bullet.instantiate() as Bullet
parent.get_parent().add_child(instance)
player.get_parent().add_child(instance)
instance.global_position = global_position
instance.apply_central_impulse(Vector2.UP.rotated(global_rotation) * speed)
instance.player = parent
parent.apply_central_impulse(Vector2.DOWN.rotated(global_rotation) * knockback)
instance.player = player
player.apply_central_impulse(Vector2.DOWN.rotated(global_rotation) * knockback)
flash.flash()
can_shoot = false
await get_tree().create_timer(0.5).timeout

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 284 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 B

After

Width:  |  Height:  |  Size: 605 B

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 B

After

Width:  |  Height:  |  Size: 2.2 KiB

Before After
Before After

BIN
tiles/small_wall_2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b1bkcg45orxr0"
path="res://.godot/imported/small_wall_2.png-39a3d70409d292baf907fc3d9c5045b4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://tiles/small_wall_2.png"
dest_files=["res://.godot/imported/small_wall_2.png-39a3d70409d292baf907fc3d9c5045b4.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
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=1