diff --git a/Data/Buildings.json b/Data/Buildings.json index cdce126..90ed7f5 100644 --- a/Data/Buildings.json +++ b/Data/Buildings.json @@ -18,7 +18,8 @@ "durability": 200, "buildTime": 3.0, "allowedRotations": [0], - "layer": 1 + "layer": 1, + "size": [3, 3] }, "ground": { "scene": "res://Scenes/Tiles/GroundTile.tscn", diff --git a/Scenes/Tiles/GroundTile.tscn b/Scenes/Tiles/GroundTile.tscn index 62eac69..1636e8c 100644 --- a/Scenes/Tiles/GroundTile.tscn +++ b/Scenes/Tiles/GroundTile.tscn @@ -23,3 +23,4 @@ offset_left = -27.0 offset_top = -27.0 offset_right = 27.0 offset_bottom = 27.0 +metadata/_edit_use_anchors_ = true diff --git a/Scenes/Tiles/MinerTile.png b/Scenes/Tiles/MinerTile.png index 475f585..8bf83a2 100644 Binary files a/Scenes/Tiles/MinerTile.png and b/Scenes/Tiles/MinerTile.png differ diff --git a/Scenes/Tiles/MinerTile.png.import b/Scenes/Tiles/MinerTile.png.import index 25cf464..dc67dab 100644 --- a/Scenes/Tiles/MinerTile.png.import +++ b/Scenes/Tiles/MinerTile.png.import @@ -2,7 +2,7 @@ importer="texture" type="CompressedTexture2D" -uid="uid://bn80thu20eaia" +uid="uid://bt6xmcgrbb078" path="res://.godot/imported/MinerTile.png-a6c5eba73cdda5685afda8ced0234fec.ctex" metadata={ "vram_texture": false diff --git a/Scenes/Tiles/MinerTile.tscn b/Scenes/Tiles/MinerTile.tscn index 95a18cb..f633e13 100644 --- a/Scenes/Tiles/MinerTile.tscn +++ b/Scenes/Tiles/MinerTile.tscn @@ -1,12 +1,13 @@ [gd_scene load_steps=4 format=3 uid="uid://cbu81slklwq3u"] [ext_resource type="Script" uid="uid://dyubkyqtpcg3a" path="res://Scripts/Tiles/MinerTile.cs" id="1_mecoy"] -[ext_resource type="Texture2D" uid="uid://bn80thu20eaia" path="res://Scenes/Tiles/MinerTile.png" id="2_mecoy"] +[ext_resource type="Texture2D" uid="uid://bt6xmcgrbb078" path="res://Scenes/Tiles/MinerTile.png" id="2_mecoy"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_8o613"] size = Vector2(54, 54) [node name="MinerTile" type="StaticBody2D"] +scale = Vector2(3, 3) script = ExtResource("1_mecoy") TileId = "miner" diff --git a/Scripts/System/PlacementManager.cs b/Scripts/System/PlacementManager.cs index 980ecf5..c7a2f8b 100644 --- a/Scripts/System/PlacementManager.cs +++ b/Scripts/System/PlacementManager.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using AceFieldNewHorizon.Scripts.Tiles; using Godot; using System.Linq; @@ -10,6 +11,8 @@ public partial class PlacementManager : Node2D [Export] public GridManager Grid { get; set; } [Export] public BuildingRegistry Registry { get; set; } + private static readonly List BuildableTiles = ["wall", "miner"]; + private string _currentBuildingId = "wall"; private Vector2I _hoveredCell; private BaseTile _ghostBuilding; @@ -144,6 +147,13 @@ public partial class PlacementManager : Node2D building.QueueFree(); Grid.FreeArea(buildingInfo.Value.Position, buildingInfo.Value.Size, buildingInfo.Value.Rotation); } + + if (Input.IsActionJustPressed("switch_tile")) + { + var currentIdx = BuildableTiles.IndexOf(_currentBuildingId); + var nextIdx = (currentIdx + 1) % BuildableTiles.Count; + SetCurrentBuilding(BuildableTiles[nextIdx]); + } } private bool CanPlaceBuilding() diff --git a/project.godot b/project.godot index 210c7f7..90957f0 100644 --- a/project.godot +++ b/project.godot @@ -70,18 +70,13 @@ move_sprint={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } -camera_zoom_in={ +switch_tile={ "deadzone": 0.2, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":8,"position":Vector2(437, 34),"global_position":Vector2(456, 130),"factor":0.0300018,"button_index":4,"canceled":false,"pressed":true,"double_click":false,"script":null) -] -} -camera_zoom_out={ -"deadzone": 0.2, -"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(583, 50),"global_position":Vector2(602, 146),"factor":0.437677,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":93,"key_label":0,"unicode":93,"location":0,"echo":false,"script":null) ] } [rendering] -renderer/rendering_method="gl_compatibility" -renderer/rendering_method.mobile="gl_compatibility" +anti_aliasing/quality/msaa_2d=3 +anti_aliasing/quality/use_taa=true