diff --git a/bullet/bullet.tscn b/bullet/bullet.tscn index ff7b164..56ea42b 100644 --- a/bullet/bullet.tscn +++ b/bullet/bullet.tscn @@ -136,7 +136,7 @@ script = ExtResource("1_0qjqd") shape = SubResource("CircleShape2D_k2aps") [node name="image" type="Sprite2D" parent="."] -modulate = Color(2, 2, 2, 1) +modulate = Color(1.1, 1.1, 1.1, 1) texture = ExtResource("1_k2aps") [node name="animation" type="AnimationPlayer" parent="."] diff --git a/components/canon.tscn b/components/canon.tscn new file mode 100644 index 0000000..030c089 --- /dev/null +++ b/components/canon.tscn @@ -0,0 +1,92 @@ +[gd_scene load_steps=7 format=3 uid="uid://cmy4ja82e7jdd"] + +[ext_resource type="Script" uid="uid://dccya6vnwi1x4" path="res://player/railgun.gd" id="1_pl3fu"] +[ext_resource type="PackedScene" uid="uid://dnndsvtgqr8eq" path="res://bullet/bullet.tscn" id="2_8i0oe"] +[ext_resource type="PackedScene" uid="uid://800ou0i3omcs" path="res://effects/flash.tscn" id="3_ki6jn"] + +[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(".:sprite_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(".:sprite_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 +step = 0.1 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath(".:sprite_scale:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0, 0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.1, 0.003124, 0.835, -0.066667, -0.000579298, 0.133333, -0.000579298, 1, -0.2, 0.00127017, 0.25, 0), +"times": PackedFloat32Array(0, 0.166667, 0.4) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath(".:sprite_scale:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0, 0, 0), +"points": PackedFloat32Array(1, -0.25, 0, 0.1, -0.000583708, 1.177, -0.066667, -0.00146496, 0.133333, -0.00517273, 1, -0.2, 0.003124, 0.25, 0), +"times": PackedFloat32Array(0, 0.166667, 0.4) +} +tracks/2/type = "method" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath(".") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0.1), +"transitions": PackedFloat32Array(1), +"values": [{ +"args": [], +"method": &"do_shoot" +}] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_g6k8r"] +_data = { +&"RESET": SubResource("Animation_g6k8r"), +&"shoot": SubResource("Animation_qjkh3") +} + +[node name="railgun" type="Marker2D"] +gizmo_extents = 3.0 +script = ExtResource("1_pl3fu") +bullet = ExtResource("2_8i0oe") +sprite_scale = Vector2(1, 1) + +[node name="flash" parent="." instance=ExtResource("3_ki6jn")] +unique_name_in_owner = true +oneshot = false + +[node name="animations" type="AnimationPlayer" parent="."] +libraries = { +&"": SubResource("AnimationLibrary_g6k8r") +} diff --git a/hud/IBMBIOS8x8-8.fnt b/hud/IBMBIOS8x8-8.fnt new file mode 100644 index 0000000..e436107 Binary files /dev/null and b/hud/IBMBIOS8x8-8.fnt differ diff --git a/hud/IBMBIOS8x8-8.fnt.import b/hud/IBMBIOS8x8-8.fnt.import new file mode 100644 index 0000000..197acbe --- /dev/null +++ b/hud/IBMBIOS8x8-8.fnt.import @@ -0,0 +1,17 @@ +[remap] + +importer="font_data_bmfont" +type="FontFile" +uid="uid://dbski8evni5if" +path="res://.godot/imported/IBMBIOS8x8-8.fnt-1601f954a6e0fb5e00ea614d2477cb7c.fontdata" + +[deps] + +source_file="res://hud/IBMBIOS8x8-8.fnt" +dest_files=["res://.godot/imported/IBMBIOS8x8-8.fnt-1601f954a6e0fb5e00ea614d2477cb7c.fontdata"] + +[params] + +fallbacks=[] +compress=true +scaling_mode=2 diff --git a/hud/aim_indicator.gd b/hud/aim_indicator.gd index 1b425d2..0d86f4f 100644 --- a/hud/aim_indicator.gd +++ b/hud/aim_indicator.gd @@ -13,4 +13,4 @@ func _physics_process(_delta: float) -> void: dot.visible = false else: dot.visible = true - dot.position.x = angle / PI * 13.0 + dot.position.x = angle / PI * 32.0 diff --git a/hud/aim_indicator/dot.png b/hud/aim_indicator/dot.png index 707633d..85cb159 100644 Binary files a/hud/aim_indicator/dot.png and b/hud/aim_indicator/dot.png differ diff --git a/hud/aim_indicator/scale.png b/hud/aim_indicator/scale.png index 6e7056e..a244bb4 100644 Binary files a/hud/aim_indicator/scale.png and b/hud/aim_indicator/scale.png differ diff --git a/hud/container.png b/hud/container.png new file mode 100644 index 0000000..4b31bd1 Binary files /dev/null and b/hud/container.png differ diff --git a/hud/container.png.import b/hud/container.png.import new file mode 100644 index 0000000..e1eae5e --- /dev/null +++ b/hud/container.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bpmshe0qinq6g" +path="res://.godot/imported/container.png-b6eb836c8095356597f7621dec423886.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://hud/container.png" +dest_files=["res://.godot/imported/container.png-b6eb836c8095356597f7621dec423886.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/crt.gdshader b/hud/crt.gdshader new file mode 100644 index 0000000..6df84e1 --- /dev/null +++ b/hud/crt.gdshader @@ -0,0 +1,65 @@ +/* +Shader from Godot Shaders - the free shader library. +godotshaders.com/shader/VHS-and-CRT-monitor-effect + +This shader is under CC0 license. Feel free to use, improve and +change this shader according to your needs and consider sharing +the modified result to godotshaders.com. +*/ + +shader_type canvas_item; + +uniform float scanlines_opacity : hint_range(0.0, 1.0) = 0.4; +uniform float scanlines_width : hint_range(0.0, 0.5) = 0.25; +uniform float grille_opacity : hint_range(0.0, 1.0) = 0.3; +uniform vec2 resolution = vec2(640.0, 480.0); +uniform float aberration : hint_range(-1.0, 1.0) = 0.03; +uniform float brightness = 1.4; +uniform float warp_amount :hint_range(0.0, 5.0) = 1.0; + +uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; + +vec2 warp(vec2 uv) { + vec2 delta = uv - 0.5; + float delta2 = dot(delta.xy, delta.xy); + float delta4 = delta2 * delta2; + float delta_offset = delta4 * warp_amount; + return ((uv + delta * delta_offset) - vec2(0.5, 0.5)) * 0.97 + vec2(0.5, 0.5); +} + +float border (vec2 uv) { + float radius = min(warp_amount, 0.08); + radius = max(min(min(abs(radius * 2.0), abs(1.0)), abs(1.0)), 1e-5); + vec2 abs_uv = abs(uv * 2.0 - 1.0) - vec2(1.0, 1.0) + radius; + float dist = length(max(vec2(0.0), abs_uv)) / radius; + float square = smoothstep(0.96, 1.0, dist); + return clamp(1.0 - square, 0.0, 1.0); +} + +void fragment() { + vec2 uv = warp(SCREEN_UV); + + float time = fract(TIME / 3.0); + float x = (uv.y - time)*100.0; + uv.x += pow(100.0,-x*x) * sin(x) / 200.0; + + COLOR.r = texture(SCREEN_TEXTURE, uv + vec2(aberration, 0.0) * .1).r; + COLOR.g = texture(SCREEN_TEXTURE, uv - vec2(aberration, 0.0) * .1).g; + COLOR.b = texture(SCREEN_TEXTURE, uv).b; + COLOR.a = 1.0; + + vec3 grill = vec3(smoothstep(0.85, 0.95, abs(sin(uv.x * (resolution.x * 3.14159265)))), smoothstep(0.85, 0.95, abs(sin(1.05 + uv.x * (resolution.x * 3.14159265)))), smoothstep(0.85, 0.95, abs(sin(2.1 + uv.x * (resolution.x * 3.14159265))))); + COLOR.r = mix(COLOR.r, COLOR.r * grill.r, grille_opacity); + COLOR.g = mix(COLOR.g, COLOR.g * grill.g, grille_opacity); + COLOR.b = mix(COLOR.b, COLOR.b * grill.b, grille_opacity); + + COLOR.r = clamp(COLOR.r * brightness, 0.0, 1.0); + COLOR.g = clamp(COLOR.g * brightness, 0.0, 1.0); + COLOR.b = clamp(COLOR.b * brightness, 0.0, 1.0); + + float scanlines = 0.5; + scanlines = smoothstep(scanlines_width, scanlines_width + 0.5, abs(sin(uv.y * (resolution.y * 3.14159265)))); + COLOR.rgb = mix(COLOR.rgb, COLOR.rgb * vec3(scanlines), scanlines_opacity); + + COLOR *= border(uv); +} \ No newline at end of file diff --git a/hud/crt.gdshader.uid b/hud/crt.gdshader.uid new file mode 100644 index 0000000..363d008 --- /dev/null +++ b/hud/crt.gdshader.uid @@ -0,0 +1 @@ +uid://ddc1twbjwqs6e diff --git a/hud/hud.tscn b/hud/hud.tscn index 223f3cf..915700b 100644 --- a/hud/hud.tscn +++ b/hud/hud.tscn @@ -1,37 +1,83 @@ -[gd_scene load_steps=13 format=3 uid="uid://cyq7l8x1pbh1h"] +[gd_scene load_steps=22 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="Shader" uid="uid://c6i3a0ue8m0sj" path="res://hud/vignette.gdshader" id="2_jvpmi"] [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"] +[ext_resource type="Texture2D" uid="uid://bpmshe0qinq6g" path="res://hud/container.png" id="12_hwufu"] +[ext_resource type="FontFile" uid="uid://mseegkts3icm" path="res://hud/Px437_Acer_VGA_8x8.ttf" id="13_mq7b8"] +[ext_resource type="Shader" uid="uid://ddc1twbjwqs6e" path="res://hud/crt.gdshader" id="14_jvpmi"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_0jxvb"] +shader = ExtResource("2_jvpmi") +shader_parameter/vignette_intensity = 1.0 +shader_parameter/vignette_opacity = 1.0 + +[sub_resource type="Gradient" id="Gradient_0jxvb"] +offsets = PackedFloat32Array(0) +colors = PackedColorArray(1, 1, 1, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_pt78x"] +gradient = SubResource("Gradient_0jxvb") +width = 1 [sub_resource type="ShaderMaterial" id="ShaderMaterial_sh35x"] shader = ExtResource("4_qv4qp") shader_parameter/min_y = 0.235291 +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jvpmi"] +content_margin_left = 3.0 +content_margin_top = 3.0 +content_margin_right = 3.0 +content_margin_bottom = 3.0 +bg_color = Color(0.6, 0.6, 0.6, 0) + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_t2ad4"] +shader = ExtResource("14_jvpmi") +shader_parameter/scanlines_opacity = 0.2 +shader_parameter/scanlines_width = 0.5 +shader_parameter/grille_opacity = 0.1 +shader_parameter/resolution = Vector2(640, 480) +shader_parameter/aberration = 0.00200005 +shader_parameter/brightness = 1.0 +shader_parameter/warp_amount = 0.3 + [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="vignette" type="TextureRect" parent="."] +material = SubResource("ShaderMaterial_0jxvb") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture1D_pt78x") + [node name="energy_indicator" type="Control" parent="."] layout_mode = 3 -anchors_preset = 2 +anchors_preset = 7 +anchor_left = 0.5 anchor_top = 1.0 +anchor_right = 0.5 anchor_bottom = 1.0 -offset_left = 10.0 -offset_top = -8.0 -offset_right = 10.0 -offset_bottom = -8.0 +offset_left = -268.0 +offset_top = -4.0 +offset_right = -268.0 +offset_bottom = -4.0 +grow_horizontal = 2 grow_vertical = 0 -scale = Vector2(6, 6) +scale = Vector2(4, 4) script = ExtResource("2_1kkc0") [node name="bg" type="Sprite2D" parent="energy_indicator"] @@ -63,11 +109,11 @@ anchor_left = 0.5 anchor_top = 1.0 anchor_right = 0.5 anchor_bottom = 1.0 -offset_top = -39.0 -offset_bottom = -39.0 +offset_top = -143.0 +offset_bottom = -143.0 grow_horizontal = 2 grow_vertical = 0 -scale = Vector2(6, 6) +scale = Vector2(4, 4) script = ExtResource("4_fjv1a") [node name="scale" type="Sprite2D" parent="aim_indicator"] @@ -79,24 +125,90 @@ texture = ExtResource("5_svhta") [node name="component_indicators" type="Control" parent="."] layout_mode = 3 -anchors_preset = 3 -anchor_left = 1.0 +anchors_preset = 7 +anchor_left = 0.5 anchor_top = 1.0 -anchor_right = 1.0 +anchor_right = 0.5 anchor_bottom = 1.0 -grow_horizontal = 0 +offset_left = 351.0 +offset_top = 6.0 +offset_right = 351.0 +offset_bottom = 6.0 +grow_horizontal = 2 grow_vertical = 0 -scale = Vector2(6, 6) +scale = Vector2(4, 4) script = ExtResource("10_sh35x") -[node name="Sprite2D" type="Sprite2D" parent="component_indicators"] +[node name="one" type="Sprite2D" parent="component_indicators"] position = Vector2(-11.1667, -11.3333) texture = ExtResource("11_gms7k") -[node name="Sprite2D2" type="Sprite2D" parent="component_indicators"] +[node name="two" type="Sprite2D" parent="component_indicators"] position = Vector2(-28.8333, -11.3333) texture = ExtResource("11_gms7k") -[node name="Sprite2D3" type="Sprite2D" parent="component_indicators"] +[node name="three" type="Sprite2D" parent="component_indicators"] position = Vector2(-46.3333, -11) texture = ExtResource("11_gms7k") + +[node name="console" 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 = -67.0 +offset_bottom = -67.0 +grow_horizontal = 2 +grow_vertical = 0 +scale = Vector2(4, 4) + +[node name="container" type="Sprite2D" parent="console"] +texture = ExtResource("12_hwufu") + +[node name="console_text" type="RichTextLabel" parent="."] +anchors_preset = 7 +anchor_left = 0.5 +anchor_top = 1.0 +anchor_right = 0.5 +anchor_bottom = 1.0 +offset_left = -112.0 +offset_top = -113.0 +offset_right = 336.0 +offset_bottom = 71.0 +grow_horizontal = 2 +grow_vertical = 0 +scale = Vector2(0.5, 0.5) +theme_override_colors/font_shadow_color = Color(0, 0, 0, 1) +theme_override_constants/outline_size = 10 +theme_override_constants/shadow_offset_y = 2 +theme_override_constants/shadow_offset_x = 1 +theme_override_constants/shadow_outline_size = 3 +theme_override_constants/line_separation = 3 +theme_override_fonts/normal_font = ExtResource("13_mq7b8") +theme_override_font_sizes/normal_font_size = 16 +theme_override_styles/normal = SubResource("StyleBoxFlat_jvpmi") +text = "-- status -- + +[shields] - medium +[reactor] - danger +[hull] - critical +[railgun] - normal +[sensors] - normal + +-- ok --" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="copy" type="BackBufferCopy" parent="."] +copy_mode = 2 + +[node name="crt_filter" type="TextureRect" parent="."] +material = SubResource("ShaderMaterial_t2ad4") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = SubResource("GradientTexture1D_pt78x") diff --git a/hud/radar/line_pattern1.png b/hud/radar/line_pattern1.png index 33f534c..7fe1080 100644 Binary files a/hud/radar/line_pattern1.png and b/hud/radar/line_pattern1.png differ diff --git a/hud/radar/line_pattern2.png b/hud/radar/line_pattern2.png index 90ec68f..b503016 100644 Binary files a/hud/radar/line_pattern2.png and b/hud/radar/line_pattern2.png differ diff --git a/hud/radar/line_pattern3.png b/hud/radar/line_pattern3.png index 617b354..ecc07be 100644 Binary files a/hud/radar/line_pattern3.png and b/hud/radar/line_pattern3.png differ diff --git a/hud/radar/line_pattern4.png b/hud/radar/line_pattern4.png index 735b249..d67ee9e 100644 Binary files a/hud/radar/line_pattern4.png and b/hud/radar/line_pattern4.png differ diff --git a/hud/radar/threat.tscn b/hud/radar/threat.tscn index 4102387..5cbccdc 100644 --- a/hud/radar/threat.tscn +++ b/hud/radar/threat.tscn @@ -1,6 +1,6 @@ [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="Texture2D" uid="uid://cxfxrcm7n85cp" path="res://hud/aim_indicator/dot.png" id="1_66ojb"] [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"] @@ -57,8 +57,8 @@ 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") +modulate = Color(1.1, 1.1, 1.1, 1) +texture = ExtResource("1_66ojb") script = ExtResource("2_oq6ws") [node name="animations" type="AnimationPlayer" parent="."] diff --git a/hud/vignette.gdshader b/hud/vignette.gdshader new file mode 100644 index 0000000..02fc2f3 --- /dev/null +++ b/hud/vignette.gdshader @@ -0,0 +1,27 @@ +/* +Shader from Godot Shaders - the free shader library. +godotshaders.com/shader/VHS-and-CRT-monitor-effect + +This shader is under CC0 license. Feel free to use, improve and +change this shader according to your needs and consider sharing +the modified result to godotshaders.com. +*/ + +shader_type canvas_item; + +uniform float vignette_intensity = 0.4; +uniform float vignette_opacity : hint_range(0.0, 1.0) = 0.5; + +uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; + +float vignette(vec2 uv){ + uv *= 1.0 - uv.xy; + float vignette = uv.x * uv.y * 15.0; + return pow(vignette, vignette_intensity * vignette_opacity); +} + +void fragment() +{ + COLOR = texture(SCREEN_TEXTURE, UV); + COLOR.rgb *= vignette(UV); +} \ No newline at end of file diff --git a/hud/vignette.gdshader.uid b/hud/vignette.gdshader.uid new file mode 100644 index 0000000..8064713 --- /dev/null +++ b/hud/vignette.gdshader.uid @@ -0,0 +1 @@ +uid://c6i3a0ue8m0sj diff --git a/main.tscn b/main.tscn index 8cfe226..3e78cb9 100644 --- a/main.tscn +++ b/main.tscn @@ -812,8 +812,6 @@ glow_blend_mode = 1 [node name="main" type="Node2D"] [node name="player" parent="." instance=ExtResource("1_1fxsm")] -thruster_strength = 40.0 -rotation_strength = 10.0 [node name="t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D6/wMAAQAAAAAAAgD7/wMAAQAAAAAAAQD8/wMAAQAAAAAAAAD8/wQAAQAAAAAAAAD7/wQAAQAAAAAAAQD4/wYAAQAAAAAAAwD4/wMAAQAAAAAAAgD4/wQAAQAAAAAAAAD5/wUAAQAAAAAAAgD5/wYAAQAAAAAAAQD6/wYAAQAAAAAAAAD7/wYAAQAAAAAAAgD4/wUAAQAAAAAAAgAGAAYAAQAAAAAAAwAKAAYAAQAAAAAAAwAKAAUAAQAAAAAAAwAKAAQAAQAAAAAAAAAJAP3/AQAAAAAAAAAJAP7/AQAAAAAAAAAKAP7/AQAAAAAAAgAKAP3/AQAAAAAAAgADAP//AQAAAAAAAAAAAPz/AQAAAAAAAwD///z/AQAAAAAAAgD6//7/AQAAAAAAAQD7//7/AQAAAAAAAgD7//3/AQAAAAAAAwD6//3/AQAAAAAAAgAAAAEAAQAAAAAAAAA=") diff --git a/player/components.gd b/player/components.gd new file mode 100644 index 0000000..af80e17 --- /dev/null +++ b/player/components.gd @@ -0,0 +1,7 @@ +extends Node2D + +@onready var canon: Marker2D = %canon +@onready var reactor: Reactor = $reactor + +func _process(_delta: float) -> void: + %image.scale = canon.sprite_scale diff --git a/player/components.gd.uid b/player/components.gd.uid new file mode 100644 index 0000000..a42074f --- /dev/null +++ b/player/components.gd.uid @@ -0,0 +1 @@ +uid://qg3wympvxydq diff --git a/player/player.gd b/player/player.gd index d086f68..00862c0 100644 --- a/player/player.gd +++ b/player/player.gd @@ -27,7 +27,7 @@ func _physics_process(delta: float) -> void: %thruster.active = false if Input.is_action_just_pressed("shoot"): - %railgun.shoot() + %canon.shoot() func _integrate_forces(state: PhysicsDirectBodyState2D) -> void: state.angular_velocity = lerp(state.angular_velocity, angular_velocity_target, 0.1) diff --git a/player/player.tscn b/player/player.tscn index cd211c1..3aa3a7d 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -1,12 +1,11 @@ -[gd_scene load_steps=20 format=3 uid="uid://b3xadpl4pu33u"] +[gd_scene load_steps=16 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://cmy4ja82e7jdd" path="res://components/canon.tscn" id="6_boad6"] +[ext_resource type="Script" uid="uid://qg3wympvxydq" path="res://player/components.gd" id="6_rgyib"] [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"] @@ -46,78 +45,6 @@ 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 -step = 0.1 -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, 0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.1, 0.003124, 0.835, -0.066667, -0.000579298, 0.133333, -0.000579298, 1, -0.2, 0.00127017, 0.25, 0), -"times": PackedFloat32Array(0, 0.166667, 0.4) -} -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, 0, 0), -"points": PackedFloat32Array(1, -0.25, 0, 0.1, -0.000583708, 1.177, -0.066667, -0.00146496, 0.133333, -0.00517273, 1, -0.2, 0.003124, 0.25, 0), -"times": PackedFloat32Array(0, 0.166667, 0.4) -} -tracks/2/type = "method" -tracks/2/imported = false -tracks/2/enabled = true -tracks/2/path = NodePath(".") -tracks/2/interp = 1 -tracks/2/loop_wrap = true -tracks/2/keys = { -"times": PackedFloat32Array(0.1), -"transitions": PackedFloat32Array(1), -"values": [{ -"args": [], -"method": &"do_shoot" -}] -} - -[sub_resource type="AnimationLibrary" id="AnimationLibrary_g6k8r"] -_data = { -&"RESET": SubResource("Animation_g6k8r"), -&"shoot": SubResource("Animation_qjkh3") -} - [node name="player" type="RigidBody2D" node_paths=PackedStringArray("radar", "reactor")] physics_material_override = SubResource("PhysicsMaterial_6481p") gravity_scale = 0.0 @@ -144,30 +71,21 @@ player = NodePath("../..") polygon = PackedVector2Array(-5, 7, 0, -7, 5, 7, 2, 8, -2, 8) [node name="image" type="Sprite2D" parent="."] +unique_name_in_owner = true texture = ExtResource("2_1h4u8") [node name="thruster" parent="." instance=ExtResource("3_r6c8y")] unique_name_in_owner = true position = Vector2(0, 8) -[node name="railgun" type="Marker2D" parent="."] -unique_name_in_owner = true -position = Vector2(0, -10) -gizmo_extents = 3.0 -script = ExtResource("5_g6k8r") -bullet = ExtResource("2_yw30f") - -[node name="flash" parent="railgun" instance=ExtResource("5_qjkh3")] -unique_name_in_owner = true -oneshot = false - -[node name="animations" type="AnimationPlayer" parent="railgun"] -libraries = { -&"": SubResource("AnimationLibrary_g6k8r") -} - [node name="radar" parent="." instance=ExtResource("7_rgyib")] -[node name="components" type="Node" parent="."] +[node name="components" type="Node2D" parent="."] +script = ExtResource("6_rgyib") + +[node name="canon" parent="components" node_paths=PackedStringArray("player") instance=ExtResource("6_boad6")] +unique_name_in_owner = true +position = Vector2(0, -10) +player = NodePath("../..") [node name="reactor" parent="components" instance=ExtResource("9_hg6s5")] diff --git a/player/railgun.gd b/player/railgun.gd index 98f1279..716f504 100644 --- a/player/railgun.gd +++ b/player/railgun.gd @@ -6,7 +6,9 @@ extends Marker2D @export var energy_cost: float = 0.5 @onready var flash: Flash = %flash -@onready var player: Player = get_parent() +@export var player: Player + +@export var sprite_scale: Vector2 var can_shoot: bool = true diff --git a/project.godot b/project.godot index 4bfbe3c..0ddc053 100644 --- a/project.godot +++ b/project.godot @@ -57,4 +57,4 @@ shoot={ textures/canvas_textures/default_texture_filter=0 viewport/hdr_2d=true -environment/defaults/default_clear_color=Color(0, 0, 0, 1) +environment/defaults/default_clear_color=Color(0.0338533, 0.0338533, 0.0338533, 1)