From 9fe787ed8a6d23cf9ab1767392951e6af39ea8ae Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 6 Oct 2024 12:31:04 +0200 Subject: next commit --- Stages/TileMapLayer.tscn | 6 +++- Stages/world_01.tscn | 6 ++-- UI/HUD.tscn | 84 ++++++++++++++++++++++++++++++++++++------------ UI/hud.gd | 49 ++++++++++++++++++++++++++++ UI/theme.tres | 12 ++++++- Units/Basher.tscn | 30 ++++++++--------- export_presets.cfg | 64 ++++++++++++++++++++++++++++++++++++ 7 files changed, 211 insertions(+), 40 deletions(-) create mode 100644 export_presets.cfg diff --git a/Stages/TileMapLayer.tscn b/Stages/TileMapLayer.tscn index c97d090..38908c7 100644 --- a/Stages/TileMapLayer.tscn +++ b/Stages/TileMapLayer.tscn @@ -5,13 +5,17 @@ [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_gdad0"] texture = ExtResource("1_qdkqn") 0:0/0 = 0 +0:0/0/custom_data_0 = Color(0.4, 0.286275, 0.203922, 1) 1:0/0 = 0 +1:0/0/custom_data_0 = Color(0.286275, 0.588235, 0.109804, 1) [sub_resource type="TileSet" id="TileSet_lqeiq"] physics_layer_0/collision_layer = 0 physics_layer_0/collision_mask = 0 +custom_data_layer_0/name = "color" +custom_data_layer_0/type = 20 sources/2 = SubResource("TileSetAtlasSource_gdad0") tile_proxies/coords_level = [[0, Vector2i(0, 0)], [2, Vector2i(0, 0)], [1, Vector2i(0, 0)], [2, Vector2i(1, 0)]] -[node name="TileMapLayer" type="TileMapLayer"] +[node name="TileMapLayer" type="TileMapLayer" groups=["map"]] tile_set = SubResource("TileSet_lqeiq") diff --git a/Stages/world_01.tscn b/Stages/world_01.tscn index 26410bb..2d61065 100644 --- a/Stages/world_01.tscn +++ b/Stages/world_01.tscn @@ -15,7 +15,7 @@ clip_children = 1 [node name="TileMapLayer" parent="Map/Polygon2D" instance=ExtResource("1_fpnly")] -tile_map_data = PackedByteArray("AAABAAYAAgAAAAAAAAACAAYAAgABAAAAAAADAAYAAgABAAAAAAAEAAYAAgABAAAAAAAFAAYAAgABAAAAAAAGAAYAAgABAAAAAAAHAAYAAgABAAAAAAAIAAYAAgABAAAAAAAJAAYAAgABAAAAAAAKAAYAAgABAAAAAAALAAYAAgABAAAAAAAMAAYAAgABAAAAAAANAAYAAgABAAAAAAAOAAYAAgABAAAAAAAPAAYAAgABAAAAAAAQAAYAAgABAAAAAAABAAQAAgAAAAAAAAABAAUAAgAAAAAAAAARAAQAAgAAAAAAAAARAAUAAgAAAAAAAAARAAYAAgAAAAAAAAA=") +tile_map_data = PackedByteArray("AAABAAYAAgAAAAAAAAACAAYAAgABAAAAAAADAAYAAgABAAAAAAAEAAYAAgABAAAAAAAFAAYAAgABAAAAAAAGAAYAAgABAAAAAAAHAAYAAgABAAAAAAAIAAYAAgABAAAAAAAJAAYAAgABAAAAAAAKAAYAAgABAAAAAAALAAYAAgABAAAAAAAMAAYAAgABAAAAAAANAAYAAgABAAAAAAAOAAYAAgABAAAAAAAPAAYAAgABAAAAAAAQAAYAAgABAAAAAAABAAQAAgAAAAAAAAABAAUAAgAAAAAAAAARAAQAAgAAAAAAAAARAAUAAgAAAAAAAAARAAYAAgAAAAAAAAABAAcAAgAAAAAAAAACAAcAAgAAAAAAAAADAAcAAgAAAAAAAAAEAAcAAgAAAAAAAAAFAAcAAgAAAAAAAAAGAAcAAgAAAAAAAAAHAAcAAgAAAAAAAAAIAAcAAgAAAAAAAAAJAAcAAgAAAAAAAAAKAAcAAgAAAAAAAAALAAcAAgAAAAAAAAAMAAcAAgAAAAAAAAANAAcAAgAAAAAAAAAOAAcAAgAAAAAAAAAPAAcAAgAAAAAAAAAQAAcAAgAAAAAAAAARAAcAAgAAAAAAAAA=") [node name="Polygon2D2" type="Polygon2D" parent="Map"] clip_children = 1 @@ -25,7 +25,7 @@ tile_map_data = PackedByteArray("AAABAAwAAgAAAAAAAAACAAwAAgABAAAAAAADAAwAAgABAAA [node name="Spawn" parent="." instance=ExtResource("2_r2f03")] position = Vector2(32, 16) -spawn_count = 5000 +spawn_count = 50 spawn_frequency = 1.0 [node name="GroundCollision" type="StaticBody2D" parent="."] @@ -33,7 +33,7 @@ collision_layer = 256 collision_mask = 0 [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="GroundCollision"] -polygon = PackedVector2Array(16, 64, 16, 112, 32, 112, 288, 112, 288, 64, 272, 64, 272, 96, 32, 96, 32, 64) +polygon = PackedVector2Array(16, 64, 16, 128, 288, 128, 288, 64, 272, 64, 272, 96, 32, 96, 32, 64) [node name="CollisionPolygon2D2" type="CollisionPolygon2D" parent="GroundCollision"] polygon = PackedVector2Array(16, 176, 16, 208, 288, 208, 288, 176, 272, 176, 272, 192, 32, 192, 32, 176) diff --git a/UI/HUD.tscn b/UI/HUD.tscn index 5ef4b02..68c330e 100644 --- a/UI/HUD.tscn +++ b/UI/HUD.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=22 format=3 uid="uid://d0mlxe0gcctle"] +[gd_scene load_steps=23 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"] @@ -49,6 +49,13 @@ shader_parameter/adjust = 0.0 shader = ExtResource("3_v2jeg") shader_parameter/adjust = 0.0 +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8x67q"] +content_margin_left = 1.0 +content_margin_top = 1.0 +content_margin_right = 1.0 +content_margin_bottom = 1.0 +bg_color = Color(1, 1, 1, 1) + [node name="HUD" type="CanvasLayer"] script = ExtResource("1_rpghv") @@ -75,112 +82,149 @@ offset_bottom = 14.0 grow_horizontal = 0 theme = ExtResource("2_he3is") -[node name="HBoxContainer" type="HBoxContainer" parent="."] +[node name="HBoxContainer2" type="HBoxContainer" parent="."] anchors_preset = 12 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 +offset_top = -16.0 grow_horizontal = 2 grow_vertical = 0 theme = ExtResource("2_he3is") + +[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 8 +size_flags_stretch_ratio = 2.0 theme_override_constants/separation = 0 -[node name="ButtonBlocker" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonBlocker" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_tsgkc") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Blocker" mouse_default_cursor_shape = 2 texture = ExtResource("2_6o4l1") stretch_mode = 5 -[node name="ButtonDigger" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonDigger" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_vfiay") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Digger" mouse_default_cursor_shape = 2 texture = ExtResource("3_585t4") stretch_mode = 5 -[node name="ButtonMiner" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonMiner" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_22xig") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Miner" mouse_default_cursor_shape = 2 texture = ExtResource("5_5j5y4") stretch_mode = 5 -[node name="ButtonBasher" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonBasher" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_sotrm") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Basher" mouse_default_cursor_shape = 2 texture = ExtResource("6_p3ffi") stretch_mode = 5 -[node name="ButtonFloater" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonFloater" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_ekuuk") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Floater (not implemented)" mouse_default_cursor_shape = 2 texture = ExtResource("6_qnbw6") stretch_mode = 5 -[node name="ButtonBuilder" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonBuilder" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_gowx5") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Builder (not implemented)" mouse_default_cursor_shape = 2 texture = ExtResource("8_wjtr6") stretch_mode = 5 -[node name="ButtonClimber" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonClimber" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_soqe0") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Climber" mouse_default_cursor_shape = 2 texture = ExtResource("9_tcs2a") stretch_mode = 5 -[node name="ButtonPlus" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonPlus" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_ywy56") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Speed +" mouse_default_cursor_shape = 2 texture = ExtResource("4_dku02") stretch_mode = 5 -[node name="ButtonMinus" type="TextureRect" parent="HBoxContainer"] +[node name="ButtonMinus" type="TextureRect" parent="HBoxContainer2/HBoxContainer"] unique_name_in_owner = true texture_filter = 1 material = SubResource("ShaderMaterial_ascmt") custom_minimum_size = Vector2(16, 16) layout_mode = 2 +tooltip_text = "Speed -" mouse_default_cursor_shape = 2 texture = ExtResource("5_ybavg") 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_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"] +[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer2/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 2 + +[node name="CurrentButton" type="Label" parent="HBoxContainer2/HBoxContainer/MarginContainer"] +unique_name_in_owner = true +layout_mode = 2 +clip_text = true + +[node name="PanelContainer" type="PanelContainer" parent="HBoxContainer2"] +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxFlat_8x67q") + +[node name="Minimap" type="TextureRect" parent="HBoxContainer2/PanelContainer"] +unique_name_in_owner = true +custom_minimum_size = Vector2(64, 32) +layout_mode = 2 +size_flags_horizontal = 8 + +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonBlocker" to="." method="_on_button_blocker_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonDigger" to="." method="_on_button_digger_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonMiner" to="." method="_on_button_miner_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonBasher" to="." method="_on_button_basher_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonFloater" to="." method="_on_button_floater_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonBuilder" to="." method="_on_button_builder_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonClimber" to="." method="_on_button_climber_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonPlus" to="." method="_on_button_plus_gui_input"] +[connection signal="gui_input" from="HBoxContainer2/HBoxContainer/ButtonMinus" to="." method="_on_button_minus_gui_input"] diff --git a/UI/hud.gd b/UI/hud.gd index 21bd2bc..d886a73 100644 --- a/UI/hud.gd +++ b/UI/hud.gd @@ -8,6 +8,7 @@ var selected_button: TextureRect : selected_button = value (selected_button.material as ShaderMaterial).set_shader_parameter("adjust", -1.0) + %CurrentButton.text = selected_button.tooltip_text func _ready() -> void: @@ -18,6 +19,54 @@ func _ready() -> void: Game.speed_changed.connect(func(): %Speed.text = str(Game.speed).pad_decimals(1) + "x" ) + + create_minimap() + + +func create_minimap(): + var maps := get_tree().get_nodes_in_group("map") + var image := Image.create_empty(%Minimap.size.x, $"%Minimap".size.y, false, Image.FORMAT_RGB8) + var minimap_scale = Vector2(image.get_size()) / get_viewport().get_visible_rect().size + + for map: TileMapLayer in maps: + for cell_coords in map.get_used_cells(): + var tile = map.get_cell_tile_data(cell_coords) + var tile_scale = minimap_scale * Vector2(map.tile_set.tile_size) + image.fill_rect( + Rect2(Vector2(cell_coords) * tile_scale, (tile_scale + Vector2(1,1)).max(Vector2(1, 1))), + tile.get_custom_data("color") + ) + + %Minimap.texture = ImageTexture.create_from_image(image) + + var markers := {} + var timer = Timer.new() + timer.wait_time = 0.5 + timer.one_shot = false + timer.autostart = true + timer.timeout.connect(func(): + for node in markers.keys(): + if is_instance_valid(node): + markers[node].position = ( + node.global_position * minimap_scale + ) + ) + %Minimap.add_child(timer) + get_tree().current_scene.child_entered_tree.connect(func(node: Node): + if node is Unit: + var texture = Image.create_empty(1, 1, false, Image.FORMAT_RGB8) + texture.set_pixel(0, 0, Color("#fff")) + var sprite = Sprite2D.new() + sprite.texture = ImageTexture.create_from_image(texture) + sprite.position = Vector2.ZERO + %Minimap.add_child(sprite) + markers[node] = sprite + + node.tree_exiting.connect(func(): + markers.erase(node) + sprite.queue_free() + ) + ) func _on_button_blocker_gui_input(event: InputEvent) -> void: diff --git a/UI/theme.tres b/UI/theme.tres index 151ae16..5acc738 100644 --- a/UI/theme.tres +++ b/UI/theme.tres @@ -1,7 +1,17 @@ -[gd_resource type="Theme" load_steps=2 format=3 uid="uid://lpvaxe35v64b"] +[gd_resource type="Theme" load_steps=3 format=3 uid="uid://lpvaxe35v64b"] [ext_resource type="FontFile" uid="uid://deqwl54q7v6ss" path="res://UI/Assets/Minimal5x7.ttf" id="1_vykgj"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jv7v8"] +content_margin_left = 2.0 +content_margin_top = 2.0 +content_margin_right = 2.0 +content_margin_bottom = 2.0 +bg_color = Color(0.165656, 0.165656, 0.165656, 1) + [resource] Label/font_sizes/font_size = 16 Label/fonts/font = ExtResource("1_vykgj") +TooltipLabel/font_sizes/font_size = 16 +TooltipLabel/fonts/font = ExtResource("1_vykgj") +TooltipPanel/styles/panel = SubResource("StyleBoxFlat_jv7v8") diff --git a/Units/Basher.tscn b/Units/Basher.tscn index ea61769..3e93601 100644 --- a/Units/Basher.tscn +++ b/Units/Basher.tscn @@ -8,6 +8,21 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_j6kqi"] size = Vector2(3, 9) +[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="Animation" id="Animation_glqtg"] resource_name = "mine" length = 2.8 @@ -91,21 +106,6 @@ tracks/4/keys = { }] } -[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"), diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..5b334bd --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,64 @@ +[preset.0] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="../../../../Applications/Godot/Exports/Lemmings.exe" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=0 +binary_format/embed_pck=false +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +application/export_d3d12=0 +application/d3d12_agility_sdk_multiarch=true +ssh_remote_deploy/enabled=false +ssh_remote_deploy/host="user@host_ip" +ssh_remote_deploy/port="22" +ssh_remote_deploy/extra_args_ssh="" +ssh_remote_deploy/extra_args_scp="" +ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue +Remove-Item -Recurse -Force '{temp_dir}'" -- cgit v1.2.3