diff options
50 files changed, 1258 insertions, 12 deletions
diff --git a/Stages/world_01.tscn b/Stages/world_01.tscn index 3f8f06f..26410bb 100644 --- a/Stages/world_01.tscn +++ b/Stages/world_01.tscn @@ -25,7 +25,7 @@ tile_map_data = PackedByteArray("AAABAAwAAgAAAAAAAAACAAwAAgABAAAAAAADAAwAAgABAAA [node name="Spawn" parent="." instance=ExtResource("2_r2f03")] position = Vector2(32, 16) -spawn_count = 50 +spawn_count = 5000 spawn_frequency = 1.0 [node name="GroundCollision" type="StaticBody2D" parent="."] diff --git a/UI/Assets/ButtonBackground.kra b/UI/Assets/ButtonBackground.kra Binary files differindex 01cc26c..326b497 100644 --- a/UI/Assets/ButtonBackground.kra +++ b/UI/Assets/ButtonBackground.kra diff --git a/UI/Assets/ButtonBackground.kra~ b/UI/Assets/ButtonBackground.kra~ Binary files differindex 064553c..e8ac47b 100644 --- a/UI/Assets/ButtonBackground.kra~ +++ b/UI/Assets/ButtonBackground.kra~ diff --git a/UI/Assets/ButtonBasher.png b/UI/Assets/ButtonBasher.png Binary files differnew file mode 100644 index 0000000..f208aea --- /dev/null +++ b/UI/Assets/ButtonBasher.png diff --git a/UI/Assets/ButtonBasher.png.import b/UI/Assets/ButtonBasher.png.import new file mode 100644 index 0000000..eeeb4e0 --- /dev/null +++ b/UI/Assets/ButtonBasher.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8osfrnc4myw0" +path="res://.godot/imported/ButtonBasher.png-fbb22ac75623ac93a0d316e7fa9aad4a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonBasher.png" +dest_files=["res://.godot/imported/ButtonBasher.png-fbb22ac75623ac93a0d316e7fa9aad4a.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/UI/Assets/ButtonBuilder.png b/UI/Assets/ButtonBuilder.png Binary files differnew file mode 100644 index 0000000..43f2ac8 --- /dev/null +++ b/UI/Assets/ButtonBuilder.png diff --git a/UI/Assets/ButtonBuilder.png.import b/UI/Assets/ButtonBuilder.png.import new file mode 100644 index 0000000..295d07f --- /dev/null +++ b/UI/Assets/ButtonBuilder.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dulw2grnjhxht" +path="res://.godot/imported/ButtonBuilder.png-31d072f3c269b5ac50e74b743c2cf437.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonBuilder.png" +dest_files=["res://.godot/imported/ButtonBuilder.png-31d072f3c269b5ac50e74b743c2cf437.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/UI/Assets/ButtonClimber.png b/UI/Assets/ButtonClimber.png Binary files differnew file mode 100644 index 0000000..5fee441 --- /dev/null +++ b/UI/Assets/ButtonClimber.png diff --git a/UI/Assets/ButtonClimber.png.import b/UI/Assets/ButtonClimber.png.import new file mode 100644 index 0000000..3d3655a --- /dev/null +++ b/UI/Assets/ButtonClimber.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cts81g3wb5khe" +path="res://.godot/imported/ButtonClimber.png-2dcd2f2a5ec4a4bd1a651f3b1b7caa56.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://UI/Assets/ButtonClimber.png" +dest_files=["res://.godot/imported/ButtonClimber.png-2dcd2f2a5ec4a4bd1a651f3b1b7caa56.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/UI/HUD.tscn b/UI/HUD.tscn index b060ce3..5ef4b02 100644 --- a/UI/HUD.tscn +++ b/UI/HUD.tscn @@ -1,13 +1,53 @@ -[gd_scene load_steps=9 format=3 uid="uid://d0mlxe0gcctle"] +[gd_scene load_steps=22 format=3 uid="uid://d0mlxe0gcctle"] [ext_resource type="Script" path="res://UI/hud.gd" id="1_rpghv"] [ext_resource type="Texture2D" uid="uid://nypt5ybs2yjf" path="res://UI/Assets/ButtonBlocker.png" id="2_6o4l1"] [ext_resource type="Theme" uid="uid://lpvaxe35v64b" path="res://UI/theme.tres" id="2_he3is"] [ext_resource type="Texture2D" uid="uid://bg118k8yia0bf" path="res://UI/Assets/ButtonDigger.png" id="3_585t4"] +[ext_resource type="Shader" path="res://UI/button.gdshader" id="3_v2jeg"] [ext_resource type="Texture2D" uid="uid://wreo4yu472g8" path="res://UI/Assets/ButtonPlus.png" id="4_dku02"] [ext_resource type="Texture2D" uid="uid://c0hcl4yvb02wx" path="res://UI/Assets/ButtonMiner.png" id="5_5j5y4"] [ext_resource type="Texture2D" uid="uid://dg3qtw0fdjmt5" path="res://UI/Assets/ButtonMinus.png" id="5_ybavg"] +[ext_resource type="Texture2D" uid="uid://c8osfrnc4myw0" path="res://UI/Assets/ButtonBasher.png" id="6_p3ffi"] [ext_resource type="Texture2D" uid="uid://61yuhqwes5hw" path="res://UI/Assets/ButtonFloater.png" id="6_qnbw6"] +[ext_resource type="Texture2D" uid="uid://dulw2grnjhxht" path="res://UI/Assets/ButtonBuilder.png" id="8_wjtr6"] +[ext_resource type="Texture2D" uid="uid://cts81g3wb5khe" path="res://UI/Assets/ButtonClimber.png" id="9_tcs2a"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_tsgkc"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_vfiay"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_22xig"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_sotrm"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ekuuk"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_gowx5"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_soqe0"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ywy56"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ascmt"] +shader = ExtResource("3_v2jeg") +shader_parameter/adjust = 0.0 [node name="HUD" type="CanvasLayer"] script = ExtResource("1_rpghv") @@ -46,7 +86,9 @@ theme = ExtResource("2_he3is") theme_override_constants/separation = 0 [node name="ButtonBlocker" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_tsgkc") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -54,7 +96,9 @@ texture = ExtResource("2_6o4l1") stretch_mode = 5 [node name="ButtonDigger" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_vfiay") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -62,7 +106,9 @@ texture = ExtResource("3_585t4") stretch_mode = 5 [node name="ButtonMiner" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_22xig") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -70,15 +116,19 @@ texture = ExtResource("5_5j5y4") stretch_mode = 5 [node name="ButtonBasher" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_sotrm") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 -texture = ExtResource("3_585t4") +texture = ExtResource("6_p3ffi") stretch_mode = 5 [node name="ButtonFloater" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_ekuuk") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -86,23 +136,29 @@ texture = ExtResource("6_qnbw6") stretch_mode = 5 [node name="ButtonBuilder" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_gowx5") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 -texture = ExtResource("3_585t4") +texture = ExtResource("8_wjtr6") stretch_mode = 5 [node name="ButtonClimber" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_soqe0") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 -texture = ExtResource("3_585t4") +texture = ExtResource("9_tcs2a") stretch_mode = 5 [node name="ButtonPlus" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_ywy56") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -110,7 +166,9 @@ texture = ExtResource("4_dku02") stretch_mode = 5 [node name="ButtonMinus" type="TextureRect" parent="HBoxContainer"] +unique_name_in_owner = true texture_filter = 1 +material = SubResource("ShaderMaterial_ascmt") custom_minimum_size = Vector2(16, 16) layout_mode = 2 mouse_default_cursor_shape = 2 @@ -120,9 +178,9 @@ stretch_mode = 5 [connection signal="gui_input" from="HBoxContainer/ButtonBlocker" to="." method="_on_button_blocker_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonDigger" to="." method="_on_button_digger_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonMiner" to="." method="_on_button_miner_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonBasher" to="." method="_on_button_digger_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonFloater" to="." method="_on_button_digger_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonBuilder" to="." method="_on_button_digger_gui_input"] -[connection signal="gui_input" from="HBoxContainer/ButtonClimber" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonBasher" to="." method="_on_button_basher_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonFloater" to="." method="_on_button_floater_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonBuilder" to="." method="_on_button_builder_gui_input"] +[connection signal="gui_input" from="HBoxContainer/ButtonClimber" to="." method="_on_button_climber_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonPlus" to="." method="_on_button_plus_gui_input"] [connection signal="gui_input" from="HBoxContainer/ButtonMinus" to="." method="_on_button_minus_gui_input"] diff --git a/UI/button.gdshader b/UI/button.gdshader new file mode 100644 index 0000000..0c89fa5 --- /dev/null +++ b/UI/button.gdshader @@ -0,0 +1,14 @@ +shader_type canvas_item; + +uniform float adjust = 0.0; + +void fragment() { + // Called for every pixel the material is visible on. + vec4 tex = texture(TEXTURE, UV); + + if (adjust < 0.0) { + COLOR.rgb = tex.rgb - vec3(0.2); + } else if (adjust > 0.0) { + COLOR.rgb = tex.rgb + vec3(0.2); + } +}
\ No newline at end of file @@ -1,6 +1,15 @@ extends CanvasLayer +var selected_button: TextureRect : + set(value): + if selected_button: + (selected_button.material as ShaderMaterial).set_shader_parameter("adjust", 0.0) + + selected_button = value + (selected_button.material as ShaderMaterial).set_shader_parameter("adjust", -1.0) + + func _ready() -> void: Game.score_changed.connect(func(): %Score.text = str(Game.score) @@ -14,14 +23,38 @@ func _ready() -> void: func _on_button_blocker_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): Game.selected_unit_type = preload("res://Units/Blocker.tscn") + selected_button = %ButtonBlocker func _on_button_digger_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): Game.selected_unit_type = preload("res://Units/Digger.tscn") + selected_button = %ButtonDigger func _on_button_miner_gui_input(event: InputEvent) -> void: if event.is_action_pressed("select"): Game.selected_unit_type = preload("res://Units/Miner.tscn") + selected_button = %ButtonMiner + +func _on_button_basher_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Basher.tscn") + selected_button = %ButtonBasher + +func _on_button_floater_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + #Game.selected_unit_type = preload("res://Units/Floater.tscn") + selected_button = %ButtonFloater + +func _on_button_builder_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + #Game.selected_unit_type = preload("res://Units/Builder.tscn") + selected_button = %ButtonBuilder + +func _on_button_climber_gui_input(event: InputEvent) -> void: + if event.is_action_pressed("select"): + Game.selected_unit_type = preload("res://Units/Climber.tscn") + selected_button = %ButtonClimber + func _on_button_plus_gui_input(event: InputEvent) -> void: diff --git a/Units/Assets/basher-01.png b/Units/Assets/basher-01.png Binary files differnew file mode 100644 index 0000000..09730bd --- /dev/null +++ b/Units/Assets/basher-01.png diff --git a/Units/Assets/basher-01.png.import b/Units/Assets/basher-01.png.import new file mode 100644 index 0000000..907f82a --- /dev/null +++ b/Units/Assets/basher-01.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cpfmng1mnkfaj" +path="res://.godot/imported/basher-01.png-a869cfce232271e0018dc1fb3524817b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/basher-01.png" +dest_files=["res://.godot/imported/basher-01.png-a869cfce232271e0018dc1fb3524817b.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/Units/Assets/basher.png b/Units/Assets/basher.png Binary files differnew file mode 100644 index 0000000..45e1d38 --- /dev/null +++ b/Units/Assets/basher.png diff --git a/Units/Assets/basher.png.import b/Units/Assets/basher.png.import new file mode 100644 index 0000000..29b3c50 --- /dev/null +++ b/Units/Assets/basher.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dt86q45n4goeq" +path="res://.godot/imported/basher.png-f175d4895a118ec1eaeda902de91a132.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/basher.png" +dest_files=["res://.godot/imported/basher.png-f175d4895a118ec1eaeda902de91a132.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/Units/Assets/builder-01.png b/Units/Assets/builder-01.png Binary files differnew file mode 100644 index 0000000..3d35067 --- /dev/null +++ b/Units/Assets/builder-01.png diff --git a/Units/Assets/builder-01.png.import b/Units/Assets/builder-01.png.import new file mode 100644 index 0000000..4ffccbe --- /dev/null +++ b/Units/Assets/builder-01.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://baruu45oc0t8i" +path="res://.godot/imported/builder-01.png-06086b2b37b7b5413709a396be8fa47f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/builder-01.png" +dest_files=["res://.godot/imported/builder-01.png-06086b2b37b7b5413709a396be8fa47f.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/Units/Assets/builder.png b/Units/Assets/builder.png Binary files differnew file mode 100644 index 0000000..2947659 --- /dev/null +++ b/Units/Assets/builder.png diff --git a/Units/Assets/builder.png.import b/Units/Assets/builder.png.import new file mode 100644 index 0000000..0f3cd28 --- /dev/null +++ b/Units/Assets/builder.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dwkcpts1p2w1p" +path="res://.godot/imported/builder.png-33da37fb87312ec7aba5526dcecdaca3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/builder.png" +dest_files=["res://.godot/imported/builder.png-33da37fb87312ec7aba5526dcecdaca3.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/Units/Assets/climber-01.png b/Units/Assets/climber-01.png Binary files differnew file mode 100644 index 0000000..bb18d82 --- /dev/null +++ b/Units/Assets/climber-01.png diff --git a/Units/Assets/climber-01.png.import b/Units/Assets/climber-01.png.import new file mode 100644 index 0000000..8ab5018 --- /dev/null +++ b/Units/Assets/climber-01.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://rdnsrxukh6ba" +path="res://.godot/imported/climber-01.png-0a6fa448acea36ebb909dccfea4c6f22.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-01.png" +dest_files=["res://.godot/imported/climber-01.png-0a6fa448acea36ebb909dccfea4c6f22.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/Units/Assets/climber-01.png~ b/Units/Assets/climber-01.png~ Binary files differnew file mode 100644 index 0000000..49c79b5 --- /dev/null +++ b/Units/Assets/climber-01.png~ diff --git a/Units/Assets/climber-02.png b/Units/Assets/climber-02.png Binary files differnew file mode 100644 index 0000000..c0fc062 --- /dev/null +++ b/Units/Assets/climber-02.png diff --git a/Units/Assets/climber-02.png.import b/Units/Assets/climber-02.png.import new file mode 100644 index 0000000..4a490e0 --- /dev/null +++ b/Units/Assets/climber-02.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b1cq83xbsyilh" +path="res://.godot/imported/climber-02.png-ba7902293593e75ba693524305f499d5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-02.png" +dest_files=["res://.godot/imported/climber-02.png-ba7902293593e75ba693524305f499d5.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/Units/Assets/climber-03.png b/Units/Assets/climber-03.png Binary files differnew file mode 100644 index 0000000..6d51021 --- /dev/null +++ b/Units/Assets/climber-03.png diff --git a/Units/Assets/climber-03.png.import b/Units/Assets/climber-03.png.import new file mode 100644 index 0000000..2228d67 --- /dev/null +++ b/Units/Assets/climber-03.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bh3hfiotx03kf" +path="res://.godot/imported/climber-03.png-8f7754a59f672aee33f179cda3319454.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-03.png" +dest_files=["res://.godot/imported/climber-03.png-8f7754a59f672aee33f179cda3319454.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/Units/Assets/climber-04.png b/Units/Assets/climber-04.png Binary files differnew file mode 100644 index 0000000..58edaaf --- /dev/null +++ b/Units/Assets/climber-04.png diff --git a/Units/Assets/climber-04.png.import b/Units/Assets/climber-04.png.import new file mode 100644 index 0000000..4857adb --- /dev/null +++ b/Units/Assets/climber-04.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dovck0665736o" +path="res://.godot/imported/climber-04.png-c5156773b4f40e8f7b38e07ac569fded.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-04.png" +dest_files=["res://.godot/imported/climber-04.png-c5156773b4f40e8f7b38e07ac569fded.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/Units/Assets/climber-05.png b/Units/Assets/climber-05.png Binary files differnew file mode 100644 index 0000000..f60737f --- /dev/null +++ b/Units/Assets/climber-05.png diff --git a/Units/Assets/climber-05.png.import b/Units/Assets/climber-05.png.import new file mode 100644 index 0000000..29d75cf --- /dev/null +++ b/Units/Assets/climber-05.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7dmkt62ov8q8" +path="res://.godot/imported/climber-05.png-87fa52958fc648771a893152f934d5d2.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-05.png" +dest_files=["res://.godot/imported/climber-05.png-87fa52958fc648771a893152f934d5d2.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/Units/Assets/climber-05.png~ b/Units/Assets/climber-05.png~ Binary files differnew file mode 100644 index 0000000..cbaeb58 --- /dev/null +++ b/Units/Assets/climber-05.png~ diff --git a/Units/Assets/climber-06.png b/Units/Assets/climber-06.png Binary files differnew file mode 100644 index 0000000..caad62e --- /dev/null +++ b/Units/Assets/climber-06.png diff --git a/Units/Assets/climber-06.png.import b/Units/Assets/climber-06.png.import new file mode 100644 index 0000000..693c019 --- /dev/null +++ b/Units/Assets/climber-06.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dmkohk2v4hnl7" +path="res://.godot/imported/climber-06.png-c99da8c17be4e29e601d53a1ba7e0dd1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-06.png" +dest_files=["res://.godot/imported/climber-06.png-c99da8c17be4e29e601d53a1ba7e0dd1.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/Units/Assets/climber-07.png b/Units/Assets/climber-07.png Binary files differnew file mode 100644 index 0000000..f374916 --- /dev/null +++ b/Units/Assets/climber-07.png diff --git a/Units/Assets/climber-07.png.import b/Units/Assets/climber-07.png.import new file mode 100644 index 0000000..9dfcc97 --- /dev/null +++ b/Units/Assets/climber-07.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://fdhhl72ba6pi" +path="res://.godot/imported/climber-07.png-1bd25343d7223e54da35d994f34366c9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-07.png" +dest_files=["res://.godot/imported/climber-07.png-1bd25343d7223e54da35d994f34366c9.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/Units/Assets/climber-08.png b/Units/Assets/climber-08.png Binary files differnew file mode 100644 index 0000000..194f2db --- /dev/null +++ b/Units/Assets/climber-08.png diff --git a/Units/Assets/climber-08.png.import b/Units/Assets/climber-08.png.import new file mode 100644 index 0000000..b25cfc8 --- /dev/null +++ b/Units/Assets/climber-08.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dgqy3df8b5hoy" +path="res://.godot/imported/climber-08.png-ec668b802f4417afd80903174a32682e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber-08.png" +dest_files=["res://.godot/imported/climber-08.png-ec668b802f4417afd80903174a32682e.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/Units/Assets/climber.png b/Units/Assets/climber.png Binary files differnew file mode 100644 index 0000000..bf39026 --- /dev/null +++ b/Units/Assets/climber.png diff --git a/Units/Assets/climber.png.import b/Units/Assets/climber.png.import new file mode 100644 index 0000000..55f9a88 --- /dev/null +++ b/Units/Assets/climber.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://clkex8nslghsc" +path="res://.godot/imported/climber.png-cbf3ea2f84bd4747e19c6bc71bdec63f.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Units/Assets/climber.png" +dest_files=["res://.godot/imported/climber.png-cbf3ea2f84bd4747e19c6bc71bdec63f.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/Units/Assets/climber.png~ b/Units/Assets/climber.png~ Binary files differnew file mode 100644 index 0000000..9958ad3 --- /dev/null +++ b/Units/Assets/climber.png~ diff --git a/Units/Basher.tscn b/Units/Basher.tscn new file mode 100644 index 0000000..ea61769 --- /dev/null +++ b/Units/Basher.tscn @@ -0,0 +1,147 @@ +[gd_scene load_steps=9 format=3 uid="uid://dwbiexhpxetyt"] + +[ext_resource type="Script" path="res://Units/basher.gd" id="1_c0y3p"] +[ext_resource type="PackedScene" uid="uid://bj8j72hwnt6mo" path="res://animated_sprite.tscn" id="2_no33r"] +[ext_resource type="SpriteFrames" uid="uid://diwyagjvsgq0i" path="res://Units/units_sprite_frames.tres" id="3_1bdrv"] +[ext_resource type="PackedScene" uid="uid://bi2ndv451jpww" path="res://animation_player.tscn" id="4_gdy6u"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_j6kqi"] +size = Vector2(3, 9) + +[sub_resource type="Animation" id="Animation_glqtg"] +resource_name = "mine" +length = 2.8 +loop_mode = 1 +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("AnimatedSprite:animation") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [&"bash"] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("AnimatedSprite:frame") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), +"update": 1, +"values": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Polygon:position") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [Vector2(-1, 0)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Polygon:rotation") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [0.785398] +} +tracks/4/type = "method" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath(".") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.5, 1, 1.5, 2, 2.5), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1), +"values": [{ +"args": [], +"method": &"mine" +}, { +"args": [], +"method": &"mine" +}, { +"args": [], +"method": &"mine" +}, { +"args": [], +"method": &"mine" +}, { +"args": [], +"method": &"mine" +}, { +"args": [], +"method": &"mine" +}] +} + +[sub_resource type="Animation" id="Animation_ei1wp"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("AnimatedSprite:frame") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [17] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_1jt7m"] +_data = { +"RESET": SubResource("Animation_ei1wp"), +"mine": SubResource("Animation_glqtg") +} + +[node name="Basher" type="CharacterBody2D"] +collision_mask = 256 +safe_margin = 0.2 +script = ExtResource("1_c0y3p") + +[node name="AnimatedSprite" parent="." instance=ExtResource("2_no33r")] +texture_filter = 1 +sprite_frames = ExtResource("3_1bdrv") +animation = &"bash" +frame = 17 +centered = false +offset = Vector2(-8, -4) + +[node name="NavigationShape" type="CollisionShape2D" parent="."] +position = Vector2(-1.5, 0.5) +shape = SubResource("RectangleShape2D_j6kqi") + +[node name="RayForward" type="RayCast2D" parent="."] +position = Vector2(0, 2) +target_position = Vector2(7, 0) +collision_mask = 256 + +[node name="AnimationPlayer" parent="." instance=ExtResource("4_gdy6u")] +deterministic = true +libraries = { +"": SubResource("AnimationLibrary_1jt7m") +} + +[node name="Polygon" type="Polygon2D" parent="."] +position = Vector2(-1, 0) +rotation = 0.785398 +color = Color(1, 1, 1, 0) +polygon = PackedVector2Array(-2.82843, -7.07107, 0, -4.24264, 2.82843, -1.41421, 5.65685, 1.41421, 8.48528, -1.41421, 4.94975, -4.94975, -2.38419e-07, -9.8995) diff --git a/Units/Blocker.tscn b/Units/Blocker.tscn index 4f3a47e..9706c7c 100644 --- a/Units/Blocker.tscn +++ b/Units/Blocker.tscn @@ -10,6 +10,7 @@ size = Vector2(8, 10) [node name="Blocker" type="CharacterBody2D"] collision_layer = 3 collision_mask = 256 +input_pickable = true script = ExtResource("1_2f26o") [node name="AnimatedSprite" parent="." instance=ExtResource("2_0lvg2")] @@ -21,3 +22,5 @@ offset = Vector2(-4, -5) [node name="NavigationShape" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_j6kqi") + +[connection signal="input_event" from="." to="." method="_on_input_event"] diff --git a/Units/Climber.tscn b/Units/Climber.tscn new file mode 100644 index 0000000..c33c517 --- /dev/null +++ b/Units/Climber.tscn @@ -0,0 +1,59 @@ +[gd_scene load_steps=5 format=3 uid="uid://vdtrjkwk22jm"] + +[ext_resource type="Script" path="res://Units/climber.gd" id="1_2em2d"] +[ext_resource type="PackedScene" uid="uid://bj8j72hwnt6mo" path="res://animated_sprite.tscn" id="2_qdfwn"] +[ext_resource type="SpriteFrames" uid="uid://diwyagjvsgq0i" path="res://Units/units_sprite_frames.tres" id="3_j38i2"] + +[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_p461f"] +radius = 2.0 +height = 9.0 + +[node name="Climber" type="CharacterBody2D"] +collision_mask = 258 +input_pickable = true +safe_margin = 0.01 +script = ExtResource("1_2em2d") + +[node name="AnimatedSprite" parent="." instance=ExtResource("2_qdfwn")] +texture_filter = 1 +sprite_frames = ExtResource("3_j38i2") +animation = &"climb" +frame_progress = 0.261887 +centered = false +offset = Vector2(-3, -5) + +[node name="NavigationShape" type="CollisionShape2D" parent="."] +position = Vector2(0, 0.5) +shape = SubResource("CapsuleShape2D_p461f") + +[node name="RayWallLeft" type="RayCast2D" parent="."] +position = Vector2(0, 3) +target_position = Vector2(-3, 0) +collision_mask = 258 + +[node name="RayHeadLeft" type="RayCast2D" parent="."] +position = Vector2(0, -3) +target_position = Vector2(-3, 0) +collision_mask = 258 + +[node name="RaySlopeLeft" type="RayCast2D" parent="."] +position = Vector2(0, 5) +target_position = Vector2(-3, 0) +collision_mask = 258 + +[node name="RayWallRight" type="RayCast2D" parent="."] +position = Vector2(0, 3) +target_position = Vector2(4, 0) +collision_mask = 258 + +[node name="RayHeadRight" type="RayCast2D" parent="."] +position = Vector2(0, -3) +target_position = Vector2(4, 0) +collision_mask = 258 + +[node name="RaySlopeRight" type="RayCast2D" parent="."] +position = Vector2(0, 5) +target_position = Vector2(4, 0) +collision_mask = 258 + +[connection signal="input_event" from="." to="." method="_on_input_event"] diff --git a/Units/Default.tscn b/Units/Default.tscn index 38bcc9c..38f7aa4 100644 --- a/Units/Default.tscn +++ b/Units/Default.tscn @@ -30,6 +30,11 @@ position = Vector2(0, 3) target_position = Vector2(-3, 0) collision_mask = 258 +[node name="RayHeadLeft" type="RayCast2D" parent="."] +position = Vector2(0, -3) +target_position = Vector2(-3, 0) +collision_mask = 258 + [node name="RaySlopeLeft" type="RayCast2D" parent="."] position = Vector2(0, 5) target_position = Vector2(-3, 0) @@ -40,6 +45,11 @@ position = Vector2(0, 3) target_position = Vector2(4, 0) collision_mask = 258 +[node name="RayHeadRight" type="RayCast2D" parent="."] +position = Vector2(0, -3) +target_position = Vector2(4, 0) +collision_mask = 258 + [node name="RaySlopeRight" type="RayCast2D" parent="."] position = Vector2(0, 5) target_position = Vector2(4, 0) diff --git a/Units/basher.gd b/Units/basher.gd new file mode 100644 index 0000000..7f92297 --- /dev/null +++ b/Units/basher.gd @@ -0,0 +1,53 @@ +extends Unit + + +var direction := Vector2.RIGHT + +var last_position: Vector2 + + +func _ready(): + $AnimationPlayer.play("mine") + scale = Vector2(direction.x, 1) + + $RayForward.force_raycast_update() + + +func _physics_process(delta: float) -> void: + if not is_on_floor(): + velocity += get_gravity() * delta * Game.speed + + velocity.x = direction.x * 100 * delta * Game.speed + + if not $RayForward.is_colliding(): + # TODO: erase step gerade aus + var default = load("res://Units/Default.tscn").instantiate() + default.global_position = global_position + default.direction = direction + get_tree().current_scene.add_child(default) + queue_free() + + last_position = global_position + move_and_slide() + + if last_position == global_position: # jumping over fraction pixel collisions, left over after mining + position.y -= 10 * delta * Game.speed + position.x += 10 * direction.x * delta * Game.speed + + +func mine() -> void: + var points = [] + for point: Vector2 in $Polygon.polygon: + points.append( + global_position + + ($Polygon.position * Vector2(direction.x, 1)) + + (point.rotated($Polygon.rotation) * Vector2(direction.x, 1)) + ) + + (func(): + Game.erase_map( + PackedVector2Array(points), + get_tree().current_scene.get_node("GroundCollision"), + get_tree().current_scene.get_node("Map") + ) + ).call_deferred() diff --git a/Units/blocker.gd b/Units/blocker.gd index 2702ae7..e9c09e0 100644 --- a/Units/blocker.gd +++ b/Units/blocker.gd @@ -3,3 +3,14 @@ extends Unit func _ready(): $AnimatedSprite.play("block") + + +func _on_input_event(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: + if event.is_action_pressed("select") and Game.selected_unit_type: + get_viewport().set_input_as_handled() + + var unit = Game.selected_unit_type.instantiate() + unit.position = global_position + + get_tree().current_scene.add_child(unit) + queue_free() diff --git a/Units/climber.gd b/Units/climber.gd new file mode 100644 index 0000000..5c1f0c2 --- /dev/null +++ b/Units/climber.gd @@ -0,0 +1,57 @@ +extends Unit + + +var speed := 1000.0 +var direction := Vector2.RIGHT + +var was_climbing := false +var post_climb_position_fix := 3 + + +func _physics_process(delta: float) -> void: + if $RayWallLeft.is_colliding() or $RayWallRight.is_colliding(): + process_climbing(delta) + elif was_climbing: + var default = load("res://Units/Default.tscn").instantiate() + default.global_position = global_position + (post_climb_position_fix * direction) + default.direction = direction + get_tree().current_scene.add_child(default) + queue_free() + else: + process_walking(delta) + + move_and_slide() + + +func process_walking(delta: float) -> void: + if not is_on_floor(): + velocity.x = 0 + velocity += get_gravity() * delta * Game.speed + if velocity.y > (get_gravity().y / 10): + $AnimatedSprite.play("fall") + + if is_on_floor(): + if $RayWallLeft.is_colliding() or $RayHeadLeft.is_colliding(): + direction = Vector2.RIGHT + elif $RayWallRight.is_colliding() or $RayHeadRight.is_colliding(): + direction = Vector2.LEFT + + if ( + ($RaySlopeLeft.is_colliding() and not $RayWallLeft.is_colliding()) or + ($RaySlopeRight.is_colliding() and not $RayWallRight.is_colliding()) + ): + position.y -= 10 * delta * Game.speed + position.x += 10 * direction.x * delta * Game.speed + + velocity.x = direction.x * speed * delta * Game.speed + + $AnimatedSprite.play("walk") + $AnimatedSprite.flip_h = direction.x < 0 + + +func process_climbing(delta: float) -> void: + was_climbing = true + + velocity.y = -((speed / 2) * delta * Game.speed) + + $AnimatedSprite.play("climb") diff --git a/Units/default.gd b/Units/default.gd index bd571a8..dd5c9f0 100644 --- a/Units/default.gd +++ b/Units/default.gd @@ -13,9 +13,9 @@ func _physics_process(delta: float) -> void: if velocity.y > (get_gravity().y / 10): $AnimatedSprite.play("fall") - if $RayWallLeft.is_colliding(): + if $RayWallLeft.is_colliding() or $RayHeadLeft.is_colliding(): direction = Vector2.RIGHT - elif $RayWallRight.is_colliding(): + elif $RayWallRight.is_colliding() or $RayHeadRight.is_colliding(): direction = Vector2.LEFT if is_on_floor(): diff --git a/Units/units_sprite_frames.tres b/Units/units_sprite_frames.tres index 680b88e..67126ce 100644 --- a/Units/units_sprite_frames.tres +++ b/Units/units_sprite_frames.tres @@ -1,5 +1,6 @@ -[gd_resource type="SpriteFrames" load_steps=61 format=3 uid="uid://diwyagjvsgq0i"] +[gd_resource type="SpriteFrames" load_steps=98 format=3 uid="uid://diwyagjvsgq0i"] +[ext_resource type="Texture2D" uid="uid://dt86q45n4goeq" path="res://Units/Assets/basher.png" id="1_2omi1"] [ext_resource type="Texture2D" uid="uid://b83lx3sg8gy3a" path="res://Units/Assets/block-01.png" id="1_r18gm"] [ext_resource type="Texture2D" uid="uid://b6lxu22gho4h6" path="res://Units/Assets/walk-01.png" id="1_rqt5u"] [ext_resource type="Texture2D" uid="uid://nsavsf7unbsd" path="res://Units/Assets/walk-02.png" id="2_ebwei"] @@ -15,21 +16,29 @@ [ext_resource type="Texture2D" uid="uid://g7md34mbwlxa" path="res://Units/Assets/digger-01.png" id="7_bplsh"] [ext_resource type="Texture2D" uid="uid://3th8lm5rb2pr" path="res://Units/Assets/walk-07.png" id="7_dahau"] [ext_resource type="Texture2D" uid="uid://de6ivhavxeakj" path="res://Units/Assets/digger-02.png" id="8_bqv3y"] +[ext_resource type="Texture2D" uid="uid://rdnsrxukh6ba" path="res://Units/Assets/climber-01.png" id="8_cemfw"] [ext_resource type="Texture2D" uid="uid://4jq5mhag1kan" path="res://Units/Assets/walk-08.png" id="8_mt6h7"] [ext_resource type="Texture2D" uid="uid://cakbdblkdtrlu" path="res://Units/Assets/fall-01.png" id="9_0mfdb"] +[ext_resource type="Texture2D" uid="uid://b1cq83xbsyilh" path="res://Units/Assets/climber-02.png" id="9_2oshh"] [ext_resource type="Texture2D" uid="uid://c068wiwg5r71d" path="res://Units/Assets/digger-03.png" id="9_w0xne"] +[ext_resource type="Texture2D" uid="uid://bh3hfiotx03kf" path="res://Units/Assets/climber-03.png" id="10_a7vqh"] [ext_resource type="Texture2D" uid="uid://duw1xurdh0kb3" path="res://Units/Assets/fall-02.png" id="10_i6j8i"] [ext_resource type="Texture2D" uid="uid://ccwecsoh6sdcp" path="res://Units/Assets/digger-04.png" id="10_pitel"] [ext_resource type="Texture2D" uid="uid://bacb365t8muhc" path="res://Units/Assets/digger-05.png" id="11_s2ucf"] [ext_resource type="Texture2D" uid="uid://m3tqofnq4v4y" path="res://Units/Assets/fall-03.png" id="11_s8ky8"] +[ext_resource type="Texture2D" uid="uid://dovck0665736o" path="res://Units/Assets/climber-04.png" id="11_vrgey"] +[ext_resource type="Texture2D" uid="uid://b7dmkt62ov8q8" path="res://Units/Assets/climber-05.png" id="12_dbmxq"] [ext_resource type="Texture2D" uid="uid://cnr47ro8mgj7p" path="res://Units/Assets/fall-04.png" id="12_dy00v"] [ext_resource type="Texture2D" uid="uid://cfygr478cs1u8" path="res://Units/Assets/digger-06.png" id="12_vkbma"] +[ext_resource type="Texture2D" uid="uid://dmkohk2v4hnl7" path="res://Units/Assets/climber-06.png" id="13_5wjt5"] [ext_resource type="Texture2D" uid="uid://cvbtm4k0h3e7l" path="res://Units/Assets/fall-05.png" id="13_26swr"] [ext_resource type="Texture2D" uid="uid://dgkjd088gwux4" path="res://Units/Assets/digger-07.png" id="13_v0c8j"] [ext_resource type="Texture2D" uid="uid://hxwnw8c2cj3b" path="res://Units/Assets/digger-08.png" id="14_773yh"] +[ext_resource type="Texture2D" uid="uid://fdhhl72ba6pi" path="res://Units/Assets/climber-07.png" id="14_b5rlp"] [ext_resource type="Texture2D" uid="uid://cd7sg6e6unjx5" path="res://Units/Assets/fall-06.png" id="14_go0m8"] [ext_resource type="Texture2D" uid="uid://rd244n0k3qb0" path="res://Units/Assets/digger-09.png" id="15_38qu4"] [ext_resource type="Texture2D" uid="uid://gkhoh22hglyf" path="res://Units/Assets/fall-07.png" id="15_e2r2v"] +[ext_resource type="Texture2D" uid="uid://dgqy3df8b5hoy" path="res://Units/Assets/climber-08.png" id="15_ywe6a"] [ext_resource type="Texture2D" uid="uid://yjym8h4wcsxq" path="res://Units/Assets/fall-08.png" id="16_6aakf"] [ext_resource type="Texture2D" uid="uid://5ytob6fb7xg1" path="res://Units/Assets/digger-10.png" id="16_mv4ra"] [ext_resource type="Texture2D" uid="uid://dgyaiolxqewej" path="res://Units/Assets/digger-11.png" id="17_8mltx"] @@ -43,6 +52,118 @@ [ext_resource type="Texture2D" uid="uid://b16d1f48vhjxe" path="res://Units/Assets/exit-07.png" id="25_ayva2"] [ext_resource type="Texture2D" uid="uid://bxhe4q74coogc" path="res://Units/Assets/miner.png" id="34_5sy4j"] +[sub_resource type="AtlasTexture" id="AtlasTexture_xgkgj"] +atlas = ExtResource("1_2omi1") +region = Rect2(0, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gu7uv"] +atlas = ExtResource("1_2omi1") +region = Rect2(12, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_itl3x"] +atlas = ExtResource("1_2omi1") +region = Rect2(24, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3tfm8"] +atlas = ExtResource("1_2omi1") +region = Rect2(36, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_hffoo"] +atlas = ExtResource("1_2omi1") +region = Rect2(48, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e08mf"] +atlas = ExtResource("1_2omi1") +region = Rect2(60, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_eabun"] +atlas = ExtResource("1_2omi1") +region = Rect2(72, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_xrdt0"] +atlas = ExtResource("1_2omi1") +region = Rect2(84, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pim5f"] +atlas = ExtResource("1_2omi1") +region = Rect2(96, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1aa7g"] +atlas = ExtResource("1_2omi1") +region = Rect2(108, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_rbi8x"] +atlas = ExtResource("1_2omi1") +region = Rect2(120, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_y44m5"] +atlas = ExtResource("1_2omi1") +region = Rect2(132, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_5nm1w"] +atlas = ExtResource("1_2omi1") +region = Rect2(144, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_iyjt2"] +atlas = ExtResource("1_2omi1") +region = Rect2(156, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_8j3u0"] +atlas = ExtResource("1_2omi1") +region = Rect2(168, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ce52o"] +atlas = ExtResource("1_2omi1") +region = Rect2(180, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4wy63"] +atlas = ExtResource("1_2omi1") +region = Rect2(192, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_aar5b"] +atlas = ExtResource("1_2omi1") +region = Rect2(204, 0, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_4xo0q"] +atlas = ExtResource("1_2omi1") +region = Rect2(0, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_e1ovd"] +atlas = ExtResource("1_2omi1") +region = Rect2(12, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_uqwu1"] +atlas = ExtResource("1_2omi1") +region = Rect2(24, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u2r15"] +atlas = ExtResource("1_2omi1") +region = Rect2(36, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ak4y0"] +atlas = ExtResource("1_2omi1") +region = Rect2(48, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u42x1"] +atlas = ExtResource("1_2omi1") +region = Rect2(60, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_kl4oo"] +atlas = ExtResource("1_2omi1") +region = Rect2(72, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_u6lqg"] +atlas = ExtResource("1_2omi1") +region = Rect2(84, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_qe4cm"] +atlas = ExtResource("1_2omi1") +region = Rect2(96, 20, 12, 9) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ka487"] +atlas = ExtResource("1_2omi1") +region = Rect2(108, 20, 12, 9) + [sub_resource type="AtlasTexture" id="AtlasTexture_tpeqv"] atlas = ExtResource("34_5sy4j") region = Rect2(0, 0, 12, 13) @@ -119,6 +240,95 @@ region = Rect2(204, 0, 12, 13) animations = [{ "frames": [{ "duration": 1.0, +"texture": SubResource("AtlasTexture_xgkgj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_gu7uv") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_itl3x") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3tfm8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_hffoo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e08mf") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_eabun") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_xrdt0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pim5f") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1aa7g") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_rbi8x") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_y44m5") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_5nm1w") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_iyjt2") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_8j3u0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ce52o") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4wy63") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_aar5b") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_4xo0q") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_e1ovd") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_uqwu1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u2r15") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ak4y0") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u42x1") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_kl4oo") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_u6lqg") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qe4cm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ka487") +}], +"loop": true, +"name": &"bash", +"speed": 10.0 +}, { +"frames": [{ +"duration": 1.0, "texture": ExtResource("1_r18gm") }, { "duration": 1.0, @@ -142,6 +352,53 @@ animations = [{ }, { "frames": [{ "duration": 1.0, +"texture": ExtResource("8_cemfw") +}, { +"duration": 1.0, +"texture": ExtResource("9_2oshh") +}, { +"duration": 1.0, +"texture": ExtResource("10_a7vqh") +}, { +"duration": 1.0, +"texture": ExtResource("11_vrgey") +}, { +"duration": 1.0, +"texture": ExtResource("12_dbmxq") +}, { +"duration": 1.0, +"texture": ExtResource("13_5wjt5") +}, { +"duration": 1.0, +"texture": ExtResource("14_b5rlp") +}, { +"duration": 1.0, +"texture": ExtResource("15_ywe6a") +}, { +"duration": 1.0, +"texture": ExtResource("14_b5rlp") +}, { +"duration": 1.0, +"texture": ExtResource("13_5wjt5") +}, { +"duration": 1.0, +"texture": ExtResource("12_dbmxq") +}, { +"duration": 1.0, +"texture": ExtResource("11_vrgey") +}, { +"duration": 1.0, +"texture": ExtResource("10_a7vqh") +}, { +"duration": 1.0, +"texture": ExtResource("9_2oshh") +}], +"loop": true, +"name": &"climb", +"speed": 10.0 +}, { +"frames": [{ +"duration": 1.0, "texture": ExtResource("7_bplsh") }, { "duration": 1.0, |