From 4160fd0d8c65de31463be381990762fbdabfcb85 Mon Sep 17 00:00:00 2001 From: qwertzuiopy Date: Mon, 14 Apr 2025 22:07:39 +0200 Subject: [PATCH] :3 --- components/reactor.gd | 16 + components/reactor.gd.uid | 1 + components/reactor.tscn | 6 + hud/aim_indicator.gd | 16 + hud/aim_indicator.gd.uid | 1 + hud/aim_indicator/dot.png | Bin 0 -> 105 bytes hud/aim_indicator/dot.png.import | 34 ++ hud/aim_indicator/scale.png | Bin 0 -> 137 bytes hud/aim_indicator/scale.png.import | 34 ++ hud/component_indicators.gd | 1 + hud/component_indicators.gd.uid | 1 + hud/dia_smalll.png | Bin 0 -> 241 bytes hud/dia_smalll.png.import | 34 ++ hud/dial.png | Bin 0 -> 666 bytes hud/dial.png.import | 34 ++ hud/dial_full.png | Bin 0 -> 179 bytes hud/dial_full.png.import | 34 ++ hud/energy_indicator.gd | 14 + hud/energy_indicator.gd.uid | 1 + hud/hud.gd | 11 + hud/hud.gd.uid | 1 + hud/hud.tscn | 102 ++++ hud/radar/line_pattern.png | Bin 0 -> 73 bytes hud/radar/line_pattern.png.import | 34 ++ hud/radar/line_pattern1.png | Bin 0 -> 73 bytes hud/radar/line_pattern1.png.import | 34 ++ hud/radar/line_pattern2.png | Bin 0 -> 76 bytes hud/radar/line_pattern2.png.import | 34 ++ hud/radar/line_pattern3.png | Bin 0 -> 76 bytes hud/radar/line_pattern3.png.import | 34 ++ hud/radar/line_pattern4.png | Bin 0 -> 73 bytes hud/radar/line_pattern4.png.import | 34 ++ hud/radar/radar.gd | 15 + hud/radar/threat.gd | 9 +- hud/radar/threat.tscn | 57 ++- hud/text.png | Bin 0 -> 134 bytes hud/text.png.import | 34 ++ hud/yclip.gdshader | 7 + hud/yclip.gdshader.uid | 1 + main.tscn | 792 ++++++++++++++++++++++++++++- player/player.gd | 6 +- player/player.tscn | 67 +-- player/railgun.gd | 24 +- player/ship.png | Bin 297 -> 284 bytes tiles/big_wall.png | Bin 421 -> 605 bytes tiles/small_wall.png | Bin 236 -> 2295 bytes tiles/small_wall_2.png | Bin 0 -> 1696 bytes tiles/small_wall_2.png.import | 34 ++ 48 files changed, 1477 insertions(+), 80 deletions(-) create mode 100644 components/reactor.gd create mode 100644 components/reactor.gd.uid create mode 100644 components/reactor.tscn create mode 100644 hud/aim_indicator.gd create mode 100644 hud/aim_indicator.gd.uid create mode 100644 hud/aim_indicator/dot.png create mode 100644 hud/aim_indicator/dot.png.import create mode 100644 hud/aim_indicator/scale.png create mode 100644 hud/aim_indicator/scale.png.import create mode 100644 hud/component_indicators.gd create mode 100644 hud/component_indicators.gd.uid create mode 100644 hud/dia_smalll.png create mode 100644 hud/dia_smalll.png.import create mode 100644 hud/dial.png create mode 100644 hud/dial.png.import create mode 100644 hud/dial_full.png create mode 100644 hud/dial_full.png.import create mode 100644 hud/energy_indicator.gd create mode 100644 hud/energy_indicator.gd.uid create mode 100644 hud/hud.gd create mode 100644 hud/hud.gd.uid create mode 100644 hud/hud.tscn create mode 100644 hud/radar/line_pattern.png create mode 100644 hud/radar/line_pattern.png.import create mode 100644 hud/radar/line_pattern1.png create mode 100644 hud/radar/line_pattern1.png.import create mode 100644 hud/radar/line_pattern2.png create mode 100644 hud/radar/line_pattern2.png.import create mode 100644 hud/radar/line_pattern3.png create mode 100644 hud/radar/line_pattern3.png.import create mode 100644 hud/radar/line_pattern4.png create mode 100644 hud/radar/line_pattern4.png.import create mode 100644 hud/text.png create mode 100644 hud/text.png.import create mode 100644 hud/yclip.gdshader create mode 100644 hud/yclip.gdshader.uid create mode 100644 tiles/small_wall_2.png create mode 100644 tiles/small_wall_2.png.import diff --git a/components/reactor.gd b/components/reactor.gd new file mode 100644 index 0000000..17cb8b4 --- /dev/null +++ b/components/reactor.gd @@ -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 diff --git a/components/reactor.gd.uid b/components/reactor.gd.uid new file mode 100644 index 0000000..582ce78 --- /dev/null +++ b/components/reactor.gd.uid @@ -0,0 +1 @@ +uid://0d467kggbn3d diff --git a/components/reactor.tscn b/components/reactor.tscn new file mode 100644 index 0000000..19c1e50 --- /dev/null +++ b/components/reactor.tscn @@ -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") diff --git a/hud/aim_indicator.gd b/hud/aim_indicator.gd new file mode 100644 index 0000000..1b425d2 --- /dev/null +++ b/hud/aim_indicator.gd @@ -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 diff --git a/hud/aim_indicator.gd.uid b/hud/aim_indicator.gd.uid new file mode 100644 index 0000000..1304c94 --- /dev/null +++ b/hud/aim_indicator.gd.uid @@ -0,0 +1 @@ +uid://bkcrwbj4qsyu6 diff --git a/hud/aim_indicator/dot.png b/hud/aim_indicator/dot.png new file mode 100644 index 0000000000000000000000000000000000000000..707633d69a3e674f108065d5b0120ba46ca69466 GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^%plCc1|-8Yw(bW~2A(dCAsjQ4YhG*o|Nq~%jLmK7 zd>)_w?>8FH`K@{8!+$wzX5qz`{MnShZRhFnvX^AAcH|4vDP>^+>SgeB^>bP0l+XkK D%R(P$ literal 0 HcmV?d00001 diff --git a/hud/aim_indicator/dot.png.import b/hud/aim_indicator/dot.png.import new file mode 100644 index 0000000..e17c257 --- /dev/null +++ b/hud/aim_indicator/dot.png.import @@ -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 diff --git a/hud/aim_indicator/scale.png b/hud/aim_indicator/scale.png new file mode 100644 index 0000000000000000000000000000000000000000..6e7056e4dfa5139b647d8810eda49773979734ad GIT binary patch literal 137 zcmeAS@N?(olHy`uVBq!ia0vp^3P8-t!3HE%q~8?+sQ^zG#}JK)$tev?qKRAo8+@C) zeY?cQPQ}k38B4bAIFpmdKI;Vst08Icf8vp-G2e89iA?ZAr`%7r#SMpDDb#?H>oR} z%bIqqxZ;cD@sw$6Oy(S5)$^I1AKme8nfDWW`2db9D>ToB_WwO)UQwK^{l`x~zwT>- z_=zdcPCbkXb7m-To!}sG;9+eHk4nCL3#UdFL;LrO(PxzmSZ3Njl-hPpJUTG?2irA{ z+@6!d%!U`4%YDA||2wWC@YDTH`<&UcPJ7)|{?-%aJ@wk&%Nvq02r zgFUhA%#38mJ79kGHeBV_r0IKJ4GvnjhM_LRmowz;xcZ z{;BpEq6C_{0I48B{~;v+)A?fcu7W(?-*Ql?1|xzH1Ob@N_k*ztvRKWJpmHD)hOOiv zY|bU~qWJ-4`}u|6AAi_sI;xN$_Jc+o@FF*uQlY65@sp44%gzF%!yJAzRU!#}bf>R~ zCm}9hWf+?>Ke$e&64?O!lY~Bcvn9^2?$Dbpk%Ye37RZ8JT5%UuHR{I1_usWq3LN^4 zu~=owm@A1@gp^1^AG=Y)rHOO34VL-TP0rI!b8_^t_ zmH;@vx?>0B+GAAw%wnZHJ**#FtrF=7eyVJG0g7yO*lm(%Nk|LTK)iDk>66!S& zn<9V|A7pZzw5CY>l&uyhiu7hnY@UPiZri3JT5MEJij`IrafuCStkx8%qXrqLil|8b z(MgB6!Q=gHp45y1lojFB*gOYWya;77FG5KX`uLe2zFIr0xl-auc%)Ewy2d82FU)PH z6+yfR@QkSUUUrBlVd1n=mg;HcTt{2rmkh$@Bd2C%l1bA72#Qo=r9F^&DZ@9-DOEgG z8JE1(Ie9(}q-OH$3S(2q+$S0zCp4G>WGwV5oRhggs30Z`(EP}`{rmy|6~YQaFhIRS zI5{T(;KW0CWq{&Z0{XQCId=gdt9_vY{GW@Oe@Feu@D$dU6aWAK07*qoM6N<$g6gO- A!T3kcif|QxEbUP~c%+n7o1C z+d#p41Aq1f`&C+x6ds1{V?1xr7pQcsqxS@y^)rS8dzwJTR1wOn}V^M?~0 diY-4>&4t-iCuf-dd 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) diff --git a/hud/energy_indicator.gd.uid b/hud/energy_indicator.gd.uid new file mode 100644 index 0000000..bfed816 --- /dev/null +++ b/hud/energy_indicator.gd.uid @@ -0,0 +1 @@ +uid://dm6tu57vgijdh diff --git a/hud/hud.gd b/hud/hud.gd new file mode 100644 index 0000000..c8a4d3a --- /dev/null +++ b/hud/hud.gd @@ -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 diff --git a/hud/hud.gd.uid b/hud/hud.gd.uid new file mode 100644 index 0000000..51428fe --- /dev/null +++ b/hud/hud.gd.uid @@ -0,0 +1 @@ +uid://dwjysathl0a8g diff --git a/hud/hud.tscn b/hud/hud.tscn new file mode 100644 index 0000000..223f3cf --- /dev/null +++ b/hud/hud.tscn @@ -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") diff --git a/hud/radar/line_pattern.png b/hud/radar/line_pattern.png new file mode 100644 index 0000000000000000000000000000000000000000..33f534c7cfa2301a730ade883015fb0291fda478 GIT binary patch literal 73 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c2!3HFM+VGzRQUabXjv*W~lPi?hf1A(9$-p4L WlF9JP;vXl0atxlXelF{r5}E-1%MoS( literal 0 HcmV?d00001 diff --git a/hud/radar/line_pattern.png.import b/hud/radar/line_pattern.png.import new file mode 100644 index 0000000..85fbcc9 --- /dev/null +++ b/hud/radar/line_pattern.png.import @@ -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 diff --git a/hud/radar/line_pattern1.png b/hud/radar/line_pattern1.png new file mode 100644 index 0000000000000000000000000000000000000000..33f534c7cfa2301a730ade883015fb0291fda478 GIT binary patch literal 73 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c2!3HFM+VGzRQUabXjv*W~lPi?hf1A(9$-p4L WlF9JP;vXl0atxlXelF{r5}E-1%MoS( literal 0 HcmV?d00001 diff --git a/hud/radar/line_pattern1.png.import b/hud/radar/line_pattern1.png.import new file mode 100644 index 0000000..200983b --- /dev/null +++ b/hud/radar/line_pattern1.png.import @@ -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 diff --git a/hud/radar/line_pattern2.png b/hud/radar/line_pattern2.png new file mode 100644 index 0000000000000000000000000000000000000000..90ec68f2883a04c51abb6e3a2390bf4e25495388 GIT binary patch literal 76 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c2!3HFM+VGzRQo^1tjv*W~lM{fTLV5kS`HWl) YVlSBtA2;564wPo_boFyt=akR{06_l|@&Et; literal 0 HcmV?d00001 diff --git a/hud/radar/line_pattern2.png.import b/hud/radar/line_pattern2.png.import new file mode 100644 index 0000000..f560a00 --- /dev/null +++ b/hud/radar/line_pattern2.png.import @@ -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 diff --git a/hud/radar/line_pattern3.png b/hud/radar/line_pattern3.png new file mode 100644 index 0000000000000000000000000000000000000000..617b3544f561679f7cc69f261f74fb6c468f08e8 GIT binary patch literal 76 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c2!3HFM+VGzRQo^1tjv*W~lM@=6%s*xQmz0o@ ZVBphaGJJo!QyeJG;OXk;vd$@?2>>ZG5k>$2 literal 0 HcmV?d00001 diff --git a/hud/radar/line_pattern3.png.import b/hud/radar/line_pattern3.png.import new file mode 100644 index 0000000..538d76f --- /dev/null +++ b/hud/radar/line_pattern3.png.import @@ -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 diff --git a/hud/radar/line_pattern4.png b/hud/radar/line_pattern4.png new file mode 100644 index 0000000000000000000000000000000000000000..735b249da0a87e3ea462affafb6e5ae6c9176918 GIT binary patch literal 73 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c2!3HFM+VGzRQUabXjv*W~lM@`6@}FG&$IQT* W$z*7KTht9G$KdJe=d#Wzp$P!)3lIkY literal 0 HcmV?d00001 diff --git a/hud/radar/line_pattern4.png.import b/hud/radar/line_pattern4.png.import new file mode 100644 index 0000000..8c55e20 --- /dev/null +++ b/hud/radar/line_pattern4.png.import @@ -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 diff --git a/hud/radar/radar.gd b/hud/radar/radar.gd index b14e15e..b111bd7 100644 --- a/hud/radar/radar.gd +++ b/hud/radar/radar.gd @@ -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 diff --git a/hud/radar/threat.gd b/hud/radar/threat.gd index c4e5f39..9eb12a0 100644 --- a/hud/radar/threat.gd +++ b/hud/radar/threat.gd @@ -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 diff --git a/hud/radar/threat.tscn b/hud/radar/threat.tscn index 849851b..4102387 100644 --- a/hud/radar/threat.tscn +++ b/hud/radar/threat.tscn @@ -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 diff --git a/hud/text.png b/hud/text.png new file mode 100644 index 0000000000000000000000000000000000000000..eaff96b08230f6b0643ec9857c74d090b65ceb52 GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^+(69E!3HGn void: diff --git a/player/player.tscn b/player/player.tscn index 5a83d4f..cd211c1 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -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")] diff --git a/player/railgun.gd b/player/railgun.gd index 2909b28..98f1279 100644 --- a/player/railgun.gd +++ b/player/railgun.gd @@ -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,13 +18,14 @@ func shoot() -> void: func do_shoot() -> void: if not can_shoot: return - var instance : Bullet = bullet.instantiate() as Bullet - parent.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) - flash.flash() + if player.reactor.try_drain(energy_cost): + var instance : Bullet = bullet.instantiate() as Bullet + player.get_parent().add_child(instance) + instance.global_position = global_position + instance.apply_central_impulse(Vector2.UP.rotated(global_rotation) * speed) + 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 can_shoot = true diff --git a/player/ship.png b/player/ship.png index 4eb7343aec98c29f7cbb6f7f52eaae7530e7ce17..9ef0c1d6fc96e0ed0db7e340678f2dc46ce62419 100644 GIT binary patch delta 75 zcmZ32(|%0$EMj&~}{XA3^Nzj=S8gv2**BLf4QmK!~5Hom$mDALOV1X@n3{;$3# e+nCNbql#gcOWdFINr@#4K;Y@>=d#Wzp$P!fS{|qX delta 86 zcmV-c0IC0+0;vL!Bnkm@Qb$4nuFf3kks-Q4^jG@9<<9@AB(Na3Qq)Z zO>}bPxN`6y-_xT%q$aOwVVg9e>Kdw4UkA9ka7tSCyZB zJ38H_=4wo0LpMY9y{WfN<9~e!{rq^=PDcmc1nvZ9B*H-a+1H@1PkXetXYZ@rJ9Uvw z{YIuGPOF~9$SvaEcZH>T9f$M9qPE;w4-Gk_^ONFKCtENT_)QkdyZ*;u#)G$iosSsb zQR$noTr_b7@1gnxr>D=`7mM$YV7!^vUm#`S>h<~bPM6FFds-y_EdRNv<9x$brdw`a zFQ;EWd#@}1yeQib7q2pzZ=Iih$sG_o&?bdOB>Nkr2 z|6<_u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ov zx^~Hd0S=5T;-v4lEki>+=hvi;1T4Rvj)^2Cuz8_eUPaA*Ez>)2o+O&oPa~yJ%gS8))s*CjfyjK5|{_b|l{{UcMz>O-W R+~xoP002ovPDHLkV1fmXW5xgg literal 236 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|mU+53hFJ6_ z*SyyFKfjUbz@Y;N4os-?nx}Kt_^g~0PXZ9kQ2f-?2n33cds*i6_Rs(5#`KUW#WO`J zRz^BO$xYCX!JOgd%*;LeB`;OfKYpSd-S&u8V#e2*qWbcdJToLVFr?h>x%u(9(Ln=? z-;)Io2drUJXlL9t`6A<{)QG(dn+0!%r8rO2JuKC6WCzn>)+fuDdzSDR_Xx-zW^g(w gKAl@q^XxeW-z8r8R)!iTKo>K3y85}Sb4q9e0IvF0kN^Mx diff --git a/tiles/small_wall_2.png b/tiles/small_wall_2.png new file mode 100644 index 0000000000000000000000000000000000000000..e9ff83895315a8d3239f33b7cea82a9136233a98 GIT binary patch literal 1696 zcmV;R24DG!P) zy-piJ5XTn_$%SbscmtaByhIf77H%kc63R5ZMP%hA($hp~QG^5y6p<{F#^oP7H6`LDGn(C`6JpP*d5b>jS|$~{#=gb>27-``jz#Qye)?<(!2 z?s`o8T)lOuPfd*!GkLwc2(Nb+YK{k>olRPA{dgeGpW8l^v)d<@KF7XVH<#i3>(A_Q39%9){_rI33~6dH)#B&sto){9Karz_~fQp2RWL=5bT;OX|7tOTHJX&*h&Q#BuY-yw~S}cX$m9 zXHGRRXc`SOEiwhYr_thNX9}fd>lCHyPg&ND^M8K)uc746jbH2uT%t$kZCUtBQ2VfJ z@elgddQokwbp0XvS{xL;RQz1j&I6B=?mZ8jdTn@ur+~!2+-&!4P_I8!pKFt&mx!N> z*T6u1JSZ9Tm{qKtKGgrD$e&BAd0_4h$i-`50GbA{ z8tM7%?KLn^Z=IGojR$gG16S~QU>K-1sHm3)N5Q2ZqKJg4e)%yat9dryAJ(z(jor?gy60-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