Compare commits
10 Commits
4f92df9865
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
4ab6271e16 | ||
|
359e1532d2 | ||
|
3fd655a3e5 | ||
|
d3b19aa104 | ||
|
e54215423d | ||
|
84b908ef51 | ||
|
c078204e60 | ||
|
e9b070ff35 | ||
|
3d11cecd5e | ||
|
6f2969d880 |
@@ -1,5 +1,47 @@
|
|||||||
{
|
{
|
||||||
"wall": "res://Scenes/Tiles/WallTile.tscn",
|
"wall": {
|
||||||
"farm": "res://Scenes/Tiles/FarmTile.tscn",
|
"scene": "res://Scenes/Tiles/WallTile.tscn",
|
||||||
"tower": "res://Scenes/Tiles/TowerTile.tscn"
|
"cost": {
|
||||||
|
"stone": 5
|
||||||
|
},
|
||||||
|
"durability": 100,
|
||||||
|
"buildTime": 1.5,
|
||||||
|
"allowedRotations": [0],
|
||||||
|
"layer": 1
|
||||||
|
},
|
||||||
|
"miner": {
|
||||||
|
"scene": "res://Scenes/Tiles/MinerTile.tscn",
|
||||||
|
"cost": {
|
||||||
|
"wood": 10,
|
||||||
|
"stone": 3
|
||||||
|
},
|
||||||
|
"durability": 200,
|
||||||
|
"buildTime": 3.0,
|
||||||
|
"allowedRotations": [0],
|
||||||
|
"layer": 1
|
||||||
|
},
|
||||||
|
"ground": {
|
||||||
|
"scene": "res://Scenes/Tiles/GroundTile.tscn",
|
||||||
|
"cost": {},
|
||||||
|
"durability": 200,
|
||||||
|
"buildTime": 0.0,
|
||||||
|
"allowedRotations": [0],
|
||||||
|
"layer": 0
|
||||||
|
},
|
||||||
|
"stone": {
|
||||||
|
"scene": "res://Scenes/Tiles/StoneTile.tscn",
|
||||||
|
"cost": {},
|
||||||
|
"durability": 200,
|
||||||
|
"buildTime": 0.0,
|
||||||
|
"allowedRotations": [0],
|
||||||
|
"layer": 0
|
||||||
|
},
|
||||||
|
"stone_iron": {
|
||||||
|
"scene": "res://Scenes/Tiles/StoneIronTile.tscn",
|
||||||
|
"cost": {},
|
||||||
|
"durability": 200,
|
||||||
|
"buildTime": 0.0,
|
||||||
|
"allowedRotations": [0],
|
||||||
|
"layer": 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,11 +7,13 @@
|
|||||||
script = ExtResource("1_08t41")
|
script = ExtResource("1_08t41")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
rotation = 1.5708
|
||||||
scale = Vector2(0.1, 0.1)
|
scale = Vector2(0.1, 0.1)
|
||||||
texture = ExtResource("1_ucweq")
|
texture = ExtResource("1_ucweq")
|
||||||
|
|
||||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||||
position = Vector2(1, 2.5)
|
position = Vector2(1, 2.5)
|
||||||
|
rotation = 1.5708
|
||||||
polygon = PackedVector2Array(54, 87.5, 62, 76.5, 7, -89.5, -1, -92.5, -10, -89.5, -64, 76.5, -55, 87.5)
|
polygon = PackedVector2Array(54, 87.5, 62, 76.5, 7, -89.5, -1, -92.5, -10, -89.5, -64, 76.5, -55, 87.5)
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=5 format=3 uid="uid://c22aprj452aha"]
|
[gd_scene load_steps=6 format=3 uid="uid://c22aprj452aha"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cudpc3w17mbsw" path="res://Scripts/System/GridManager.cs" id="1_knkkn"]
|
[ext_resource type="Script" uid="uid://cudpc3w17mbsw" path="res://Scripts/System/GridManager.cs" id="1_knkkn"]
|
||||||
[ext_resource type="Script" uid="uid://cfbj72nm0eovg" path="res://Scripts/System/BuildingRegistry.cs" id="1_sxhdm"]
|
[ext_resource type="Script" uid="uid://cfbj72nm0eovg" path="res://Scripts/System/BuildingRegistry.cs" id="1_sxhdm"]
|
||||||
|
[ext_resource type="Script" uid="uid://cugfbvw70clgd" path="res://Scripts/System/NaturalResourceGenerator.cs" id="2_oss8w"]
|
||||||
[ext_resource type="Script" uid="uid://bx1wj7gn6vrqe" path="res://Scripts/System/PlacementManager.cs" id="2_sxhdm"]
|
[ext_resource type="Script" uid="uid://bx1wj7gn6vrqe" path="res://Scripts/System/PlacementManager.cs" id="2_sxhdm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://doxy60afddg1m" path="res://Scenes/Entities/Player.tscn" id="3_oss8w"]
|
[ext_resource type="PackedScene" uid="uid://doxy60afddg1m" path="res://Scenes/Entities/Player.tscn" id="3_oss8w"]
|
||||||
|
|
||||||
@@ -10,6 +11,11 @@
|
|||||||
[node name="BuildingRegistry" type="Node" parent="."]
|
[node name="BuildingRegistry" type="Node" parent="."]
|
||||||
script = ExtResource("1_sxhdm")
|
script = ExtResource("1_sxhdm")
|
||||||
|
|
||||||
|
[node name="NaturalResourceGenerator" type="Node2D" parent="." node_paths=PackedStringArray("Grid", "Registry")]
|
||||||
|
script = ExtResource("2_oss8w")
|
||||||
|
Grid = NodePath("../GridSystem")
|
||||||
|
Registry = NodePath("../BuildingRegistry")
|
||||||
|
|
||||||
[node name="GridSystem" type="Node2D" parent="."]
|
[node name="GridSystem" type="Node2D" parent="."]
|
||||||
script = ExtResource("1_knkkn")
|
script = ExtResource("1_knkkn")
|
||||||
|
|
||||||
@@ -19,5 +25,4 @@ Grid = NodePath("../GridSystem")
|
|||||||
Registry = NodePath("../BuildingRegistry")
|
Registry = NodePath("../BuildingRegistry")
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("3_oss8w")]
|
[node name="Player" parent="." instance=ExtResource("3_oss8w")]
|
||||||
position = Vector2(602, 324)
|
|
||||||
scale = Vector2(0.35, 0.35)
|
scale = Vector2(0.35, 0.35)
|
||||||
|
BIN
Scenes/Tiles/GroundTile.png
Normal file
BIN
Scenes/Tiles/GroundTile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 486 KiB |
34
Scenes/Tiles/GroundTile.png.import
Normal file
34
Scenes/Tiles/GroundTile.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://cww1edmqcmb8b"
|
||||||
|
path="res://.godot/imported/GroundTile.png-b193d222fbf869e7606f01318fb918f7.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Scenes/Tiles/GroundTile.png"
|
||||||
|
dest_files=["res://.godot/imported/GroundTile.png-b193d222fbf869e7606f01318fb918f7.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
|
24
Scenes/Tiles/GroundTile.tscn
Normal file
24
Scenes/Tiles/GroundTile.tscn
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://7735luf8htft"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dh0jdeplrigxu" path="res://Scripts/Tiles/GroundTile.cs" id="1_mqsaf"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cww1edmqcmb8b" path="res://Scenes/Tiles/GroundTile.png" id="2_tow7r"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8o613"]
|
||||||
|
size = Vector2(54, 54)
|
||||||
|
|
||||||
|
[node name="GroundTile" type="StaticBody2D"]
|
||||||
|
collision_layer = 0
|
||||||
|
script = ExtResource("1_mqsaf")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.1, 0.1)
|
||||||
|
texture = ExtResource("2_tow7r")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_8o613")
|
||||||
|
|
||||||
|
[node name="ProgressOverlay" type="ColorRect" parent="."]
|
||||||
|
offset_left = -27.0
|
||||||
|
offset_top = -27.0
|
||||||
|
offset_right = 27.0
|
||||||
|
offset_bottom = 27.0
|
BIN
Scenes/Tiles/MinerTile.png
Normal file
BIN
Scenes/Tiles/MinerTile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 438 KiB |
34
Scenes/Tiles/MinerTile.png.import
Normal file
34
Scenes/Tiles/MinerTile.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bn80thu20eaia"
|
||||||
|
path="res://.godot/imported/MinerTile.png-a6c5eba73cdda5685afda8ced0234fec.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Scenes/Tiles/MinerTile.png"
|
||||||
|
dest_files=["res://.godot/imported/MinerTile.png-a6c5eba73cdda5685afda8ced0234fec.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
|
23
Scenes/Tiles/MinerTile.tscn
Normal file
23
Scenes/Tiles/MinerTile.tscn
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
[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"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8o613"]
|
||||||
|
size = Vector2(54, 54)
|
||||||
|
|
||||||
|
[node name="MinerTile" type="StaticBody2D"]
|
||||||
|
script = ExtResource("1_mecoy")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.1, 0.1)
|
||||||
|
texture = ExtResource("2_mecoy")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_8o613")
|
||||||
|
|
||||||
|
[node name="ProgressOverlay" type="ColorRect" parent="."]
|
||||||
|
offset_left = -27.0
|
||||||
|
offset_top = -27.0
|
||||||
|
offset_right = 27.0
|
||||||
|
offset_bottom = 27.0
|
BIN
Scenes/Tiles/StoneIronTile.png
Normal file
BIN
Scenes/Tiles/StoneIronTile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 474 KiB |
34
Scenes/Tiles/StoneIronTile.png.import
Normal file
34
Scenes/Tiles/StoneIronTile.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://c3qdue55e6blv"
|
||||||
|
path="res://.godot/imported/StoneIronTile.png-a3d6be6bb8b8b8a0f32242e23f1c00ca.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Scenes/Tiles/StoneIronTile.png"
|
||||||
|
dest_files=["res://.godot/imported/StoneIronTile.png-a3d6be6bb8b8b8a0f32242e23f1c00ca.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
|
24
Scenes/Tiles/StoneIronTile.tscn
Normal file
24
Scenes/Tiles/StoneIronTile.tscn
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://dnkcl5ucmip40"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dh0jdeplrigxu" path="res://Scripts/Tiles/GroundTile.cs" id="1_ewklp"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c3qdue55e6blv" path="res://Scenes/Tiles/StoneIronTile.png" id="2_ewklp"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8o613"]
|
||||||
|
size = Vector2(54, 54)
|
||||||
|
|
||||||
|
[node name="StoneIronTile" type="StaticBody2D"]
|
||||||
|
collision_layer = 0
|
||||||
|
script = ExtResource("1_ewklp")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.1, 0.1)
|
||||||
|
texture = ExtResource("2_ewklp")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_8o613")
|
||||||
|
|
||||||
|
[node name="ProgressOverlay" type="ColorRect" parent="."]
|
||||||
|
offset_left = -27.0
|
||||||
|
offset_top = -27.0
|
||||||
|
offset_right = 27.0
|
||||||
|
offset_bottom = 27.0
|
BIN
Scenes/Tiles/StoneTile.png
Normal file
BIN
Scenes/Tiles/StoneTile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 590 KiB |
34
Scenes/Tiles/StoneTile.png.import
Normal file
34
Scenes/Tiles/StoneTile.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://ca0qwr6hngho2"
|
||||||
|
path="res://.godot/imported/StoneTile.png-20e063912018fbf7fd000e734fc2097f.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Scenes/Tiles/StoneTile.png"
|
||||||
|
dest_files=["res://.godot/imported/StoneTile.png-20e063912018fbf7fd000e734fc2097f.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
|
24
Scenes/Tiles/StoneTile.tscn
Normal file
24
Scenes/Tiles/StoneTile.tscn
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://bafvcatjix3mx"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dh0jdeplrigxu" path="res://Scripts/Tiles/GroundTile.cs" id="1_rndy8"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://ca0qwr6hngho2" path="res://Scenes/Tiles/StoneTile.png" id="2_rndy8"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_8o613"]
|
||||||
|
size = Vector2(54, 54)
|
||||||
|
|
||||||
|
[node name="StoneTile" type="StaticBody2D"]
|
||||||
|
collision_layer = 0
|
||||||
|
script = ExtResource("1_rndy8")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.1, 0.1)
|
||||||
|
texture = ExtResource("2_rndy8")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("RectangleShape2D_8o613")
|
||||||
|
|
||||||
|
[node name="ProgressOverlay" type="ColorRect" parent="."]
|
||||||
|
offset_left = -27.0
|
||||||
|
offset_top = -27.0
|
||||||
|
offset_right = 27.0
|
||||||
|
offset_bottom = 27.0
|
@@ -15,3 +15,9 @@ texture = ExtResource("1_8o613")
|
|||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
shape = SubResource("RectangleShape2D_8o613")
|
shape = SubResource("RectangleShape2D_8o613")
|
||||||
|
|
||||||
|
[node name="ProgressOverlay" type="ColorRect" parent="."]
|
||||||
|
offset_left = -27.0
|
||||||
|
offset_top = -27.0
|
||||||
|
offset_right = 27.0
|
||||||
|
offset_bottom = 27.0
|
||||||
|
@@ -5,22 +5,134 @@ namespace AceFieldNewHorizon.Scripts.Entities;
|
|||||||
|
|
||||||
public partial class Player : CharacterBody2D
|
public partial class Player : CharacterBody2D
|
||||||
{
|
{
|
||||||
[Export] public float Speed = 400.0f;
|
[Export] public float MaxSpeed = 400.0f;
|
||||||
|
[Export] public float SprintMultiplier = 1.8f; // 80% faster when sprinting
|
||||||
|
[Export] public float Acceleration = 1500.0f;
|
||||||
|
[Export] public float SprintAcceleration = 1800.0f; // Slightly faster acceleration when sprinting
|
||||||
|
[Export] public float Deceleration = 1200.0f;
|
||||||
|
[Export] public float RotationSpeed = 3.0f;
|
||||||
|
[Export] public float MinZoom = 0.5f;
|
||||||
|
[Export] public float MaxZoom = 2.0f;
|
||||||
|
[Export] public float BaseZoomSpeed = 0.1f;
|
||||||
|
[Export] public float MaxZoomSpeed = 0.5f;
|
||||||
|
[Export] public float ZoomAcceleration = 0.05f;
|
||||||
|
[Export] public float ZoomDecay = 0.9f;
|
||||||
|
[Export] public float ZoomSmoothing = 10.0f;
|
||||||
|
|
||||||
|
private Camera2D _camera;
|
||||||
|
private Vector2 _cameraTargetZoom = Vector2.One;
|
||||||
|
private float _currentZoomSpeed;
|
||||||
|
private int _lastZoomDirection;
|
||||||
|
private double _lastZoomTime;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_camera = GetNode<Camera2D>("Camera2D");
|
||||||
|
_cameraTargetZoom = _camera.Zoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Input(InputEvent @event)
|
||||||
|
{
|
||||||
|
// Handle mouse wheel zoom
|
||||||
|
if (@event is InputEventMouseButton mouseEvent)
|
||||||
|
{
|
||||||
|
switch (mouseEvent.ButtonIndex)
|
||||||
|
{
|
||||||
|
case MouseButton.WheelDown when mouseEvent.Pressed:
|
||||||
|
HandleZoomInput(1);
|
||||||
|
break;
|
||||||
|
case MouseButton.WheelUp when mouseEvent.Pressed:
|
||||||
|
HandleZoomInput(-1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleZoomInput(int direction)
|
||||||
|
{
|
||||||
|
var currentTime = Time.GetTicksMsec();
|
||||||
|
|
||||||
|
// If same direction as last time, accelerate
|
||||||
|
if (direction == _lastZoomDirection && (currentTime - _lastZoomTime) < 300)
|
||||||
|
{
|
||||||
|
_currentZoomSpeed = Mathf.Min(_currentZoomSpeed + ZoomAcceleration, MaxZoomSpeed);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_currentZoomSpeed = BaseZoomSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastZoomDirection = direction;
|
||||||
|
_lastZoomTime = currentTime;
|
||||||
|
|
||||||
|
// Apply zoom with current speed
|
||||||
|
var zoomFactor = 1.0f + (_currentZoomSpeed * -direction);
|
||||||
|
_cameraTargetZoom = _camera.Zoom * zoomFactor;
|
||||||
|
|
||||||
|
// Clamp target zoom
|
||||||
|
_cameraTargetZoom.X = Mathf.Clamp(_cameraTargetZoom.X, MinZoom, MaxZoom);
|
||||||
|
_cameraTargetZoom.Y = Mathf.Clamp(_cameraTargetZoom.Y, MinZoom, MaxZoom);
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
// Get direction to mouse and calculate angle
|
// Get direction to mouse and calculate angle
|
||||||
var mousePos = GetGlobalMousePosition();
|
var mousePos = GetGlobalMousePosition();
|
||||||
var direction = GlobalPosition.DirectionTo(mousePos);
|
var direction = GlobalPosition.DirectionTo(mousePos);
|
||||||
Rotation = direction.Angle() + (float)Math.PI / 2;
|
Rotation = direction.Angle();
|
||||||
|
|
||||||
|
// Smoothly interpolate to target zoom
|
||||||
|
var deltaF = (float)delta;
|
||||||
|
_camera.Zoom = _camera.Zoom.Lerp(_cameraTargetZoom, ZoomSmoothing * deltaF);
|
||||||
|
|
||||||
|
// Decay zoom speed when not zooming
|
||||||
|
if ((Time.GetTicksMsec() - _lastZoomTime) > 300)
|
||||||
|
{
|
||||||
|
_currentZoomSpeed = Mathf.Max(_currentZoomSpeed * ZoomDecay, BaseZoomSpeed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
public override void _PhysicsProcess(double delta)
|
||||||
{
|
{
|
||||||
// Get movement input
|
// Get movement input
|
||||||
var inputDirection = Input.GetVector("move_left", "move_right", "move_up", "move_down");
|
var moveForward = Input.GetActionStrength("move_up") - Input.GetActionStrength("move_down");
|
||||||
Velocity = inputDirection * Speed;
|
var moveHorizontal = Input.GetActionStrength("move_right") - Input.GetActionStrength("move_left");
|
||||||
|
var isSprinting = Input.IsActionPressed("move_sprint");
|
||||||
|
|
||||||
|
// Calculate movement parameters based on sprint state
|
||||||
|
var currentMaxSpeed = isSprinting ? MaxSpeed * SprintMultiplier : MaxSpeed;
|
||||||
|
var currentAcceleration = isSprinting ? SprintAcceleration : Acceleration;
|
||||||
|
|
||||||
|
// Calculate desired movement direction
|
||||||
|
var forwardVector = Vector2.Right.Rotated(Rotation);
|
||||||
|
var rightVector = new Vector2(-forwardVector.Y, forwardVector.X);
|
||||||
|
|
||||||
|
// Calculate target velocity based on input
|
||||||
|
var targetVelocity = (forwardVector * moveForward + rightVector * moveHorizontal).Normalized() * currentMaxSpeed;
|
||||||
|
|
||||||
|
// Apply acceleration or deceleration
|
||||||
|
var currentSpeed = Velocity.Length();
|
||||||
|
var isAccelerating = targetVelocity != Vector2.Zero;
|
||||||
|
|
||||||
|
if (isAccelerating)
|
||||||
|
{
|
||||||
|
// Accelerate towards target velocity
|
||||||
|
Velocity = Velocity.MoveToward(targetVelocity, (float)(currentAcceleration * delta));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Apply deceleration when no input
|
||||||
|
if (currentSpeed > 0)
|
||||||
|
{
|
||||||
|
var decelAmount = (float)(Deceleration * delta);
|
||||||
|
if (currentSpeed <= decelAmount)
|
||||||
|
Velocity = Vector2.Zero;
|
||||||
|
else
|
||||||
|
Velocity = Velocity.Normalized() * (currentSpeed - decelAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply the movement
|
||||||
MoveAndSlide();
|
MoveAndSlide();
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,11 +1,47 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace AceFieldNewHorizon.Scripts.System;
|
namespace AceFieldNewHorizon.Scripts.System;
|
||||||
|
|
||||||
|
public enum RotationDirection
|
||||||
|
{
|
||||||
|
Up, // 0 degrees
|
||||||
|
Right, // 90 degrees
|
||||||
|
Down, // 180 degrees
|
||||||
|
Left // 270 degrees
|
||||||
|
}
|
||||||
|
|
||||||
|
public record BuildingData(
|
||||||
|
PackedScene Scene,
|
||||||
|
Dictionary<string, int> Cost,
|
||||||
|
int Durability,
|
||||||
|
GridLayer Layer,
|
||||||
|
float BuildTime,
|
||||||
|
Vector2I Size = default,
|
||||||
|
RotationDirection[] AllowedRotations = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
public Vector2I Size { get; } = Size == default ? Vector2I.One : Size;
|
||||||
|
public RotationDirection[] AllowedRotations { get; } =
|
||||||
|
AllowedRotations ?? [RotationDirection.Up, RotationDirection.Right, RotationDirection.Down, RotationDirection.Left
|
||||||
|
];
|
||||||
|
|
||||||
|
public bool IsRotationAllowed(float degrees)
|
||||||
|
{
|
||||||
|
var direction = (RotationDirection)((Mathf.RoundToInt(degrees / 90f) % 4 + 4) % 4);
|
||||||
|
return AllowedRotations.Contains(direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector2I GetRotatedSize(float degrees)
|
||||||
|
{
|
||||||
|
return (Mathf.RoundToInt(degrees / 90f) % 2) == 0 ? Size : new Vector2I(Size.Y, Size.X);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public partial class BuildingRegistry : Node
|
public partial class BuildingRegistry : Node
|
||||||
{
|
{
|
||||||
private Dictionary<string, PackedScene> _registry = new();
|
private Dictionary<string, BuildingData> _registry = new();
|
||||||
|
|
||||||
[Export] public string JsonPath { get; set; } = "res://Data/Buildings.json";
|
[Export] public string JsonPath { get; set; } = "res://Data/Buildings.json";
|
||||||
|
|
||||||
@@ -38,26 +74,116 @@ public partial class BuildingRegistry : Node
|
|||||||
|
|
||||||
foreach (string key in dict.Keys)
|
foreach (string key in dict.Keys)
|
||||||
{
|
{
|
||||||
var scenePath = dict[key].AsString();
|
// Each entry is a Dictionary with keys: "scene", "cost", "durability", "buildTime", "size", "allowedRotations"
|
||||||
var scene = GD.Load<PackedScene>(scenePath);
|
var buildingDict = dict[key].AsGodotDictionary();
|
||||||
|
|
||||||
if (scene != null)
|
// Parse scene
|
||||||
|
var scenePath = buildingDict.ContainsKey("scene") ? buildingDict["scene"].AsString() : null;
|
||||||
|
if (string.IsNullOrEmpty(scenePath))
|
||||||
{
|
{
|
||||||
_registry[key] = scene;
|
GD.PrintErr($"[BuildingRegistry] No scene path for '{key}'");
|
||||||
GD.Print($"[BuildingRegistry] Loaded building '{key}' from {scenePath}");
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
var scene = GD.Load<PackedScene>(scenePath);
|
||||||
|
if (scene == null)
|
||||||
{
|
{
|
||||||
GD.PrintErr($"[BuildingRegistry] Failed to load scene for '{key}' at {scenePath}");
|
GD.PrintErr($"[BuildingRegistry] Failed to load scene for '{key}' at {scenePath}");
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse cost
|
||||||
|
Dictionary<string, int> cost = new();
|
||||||
|
if (buildingDict.TryGetValue("cost", out var value))
|
||||||
|
{
|
||||||
|
var costDict = value.AsGodotDictionary();
|
||||||
|
foreach (string mat in costDict.Keys)
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
var obj = costDict[mat];
|
||||||
|
if (obj.VariantType == Variant.Type.PackedInt64Array)
|
||||||
|
val = (int)obj.AsInt64();
|
||||||
|
else if (obj.VariantType == Variant.Type.PackedInt32Array)
|
||||||
|
val = obj.AsInt32();
|
||||||
|
else
|
||||||
|
int.TryParse(obj.ToString(), out val);
|
||||||
|
cost[mat] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse durability
|
||||||
|
var durability = 0;
|
||||||
|
if (buildingDict.TryGetValue("durability", out var dObj))
|
||||||
|
{
|
||||||
|
if (dObj.VariantType == Variant.Type.PackedInt64Array)
|
||||||
|
durability = (int)dObj.AsInt64();
|
||||||
|
else if (dObj.VariantType == Variant.Type.PackedInt32Array)
|
||||||
|
durability = dObj.AsInt32();
|
||||||
|
else
|
||||||
|
int.TryParse(dObj.ToString(), out durability);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse buildTime
|
||||||
|
var buildTime = 0f;
|
||||||
|
if (buildingDict.TryGetValue("buildTime", out var bObj))
|
||||||
|
{
|
||||||
|
switch (bObj.VariantType)
|
||||||
|
{
|
||||||
|
case Variant.Type.PackedFloat32Array or Variant.Type.PackedFloat64Array:
|
||||||
|
buildTime = (float)bObj.AsDouble();
|
||||||
|
break;
|
||||||
|
case Variant.Type.PackedInt64Array:
|
||||||
|
buildTime = bObj.AsInt64();
|
||||||
|
break;
|
||||||
|
case Variant.Type.PackedInt32Array:
|
||||||
|
buildTime = bObj.AsInt32();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
float.TryParse(bObj.ToString(), out buildTime);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse size
|
||||||
|
var size = Vector2I.One;
|
||||||
|
if (buildingDict.TryGetValue("size", out var sObj))
|
||||||
|
{
|
||||||
|
var sizeArray = sObj.AsGodotArray();
|
||||||
|
if (sizeArray.Count == 2)
|
||||||
|
{
|
||||||
|
size = new Vector2I((int)sizeArray[0].AsInt64(), (int)sizeArray[1].AsInt64());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse allowedRotations
|
||||||
|
RotationDirection[] allowedRotations = null;
|
||||||
|
if (buildingDict.TryGetValue("allowedRotations", out var arObj))
|
||||||
|
{
|
||||||
|
var arArray = arObj.AsGodotArray();
|
||||||
|
allowedRotations = new RotationDirection[arArray.Count];
|
||||||
|
for (var i = 0; i < arArray.Count; i++)
|
||||||
|
{
|
||||||
|
allowedRotations[i] = (RotationDirection)arArray[i].AsInt32();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var layer = GridLayer.Building;
|
||||||
|
if (buildingDict.TryGetValue("layer", out var lObj))
|
||||||
|
{
|
||||||
|
layer = (GridLayer)lObj.AsInt32();
|
||||||
|
}
|
||||||
|
|
||||||
|
var buildingData = new BuildingData(scene, cost, durability, layer, buildTime, size, allowedRotations);
|
||||||
|
_registry[key] = buildingData;
|
||||||
|
GD.Print($"[BuildingRegistry] Loaded building '{key}' from {scenePath}");
|
||||||
}
|
}
|
||||||
|
|
||||||
GD.Print($"[BuildingRegistry] Loaded {_registry.Count} buildings");
|
GD.Print($"[BuildingRegistry] Loaded {_registry.Count} buildings");
|
||||||
}
|
}
|
||||||
|
|
||||||
public PackedScene GetScene(string id)
|
public BuildingData GetBuilding(string id)
|
||||||
{
|
{
|
||||||
_registry.TryGetValue(id, out var scene);
|
_registry.TryGetValue(id, out var data);
|
||||||
return scene;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,31 +1,107 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace AceFieldNewHorizon.Scripts.System;
|
namespace AceFieldNewHorizon.Scripts.System;
|
||||||
|
|
||||||
|
public enum GridLayer
|
||||||
|
{
|
||||||
|
Ground, // Base layer (e.g., terrain, floors)
|
||||||
|
Building, // Main building layer
|
||||||
|
Decoration // Additional layer for decorations, effects, etc.
|
||||||
|
}
|
||||||
|
|
||||||
public partial class GridManager : Node
|
public partial class GridManager : Node
|
||||||
{
|
{
|
||||||
private Dictionary<Vector2I, Node2D> _grid = new();
|
private Dictionary<GridLayer, Dictionary<Vector2I, (Node2D Building, Vector2I Size, float Rotation)>> _layers =
|
||||||
|
new();
|
||||||
|
|
||||||
public bool IsCellFree(Vector2I cell)
|
public GridManager()
|
||||||
{
|
{
|
||||||
return !_grid.ContainsKey(cell);
|
// Initialize all layers
|
||||||
|
foreach (GridLayer layer in Enum.GetValues(typeof(GridLayer)))
|
||||||
|
_layers[layer] = new Dictionary<Vector2I, (Node2D, Vector2I, float)>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OccupyCell(Vector2I cell, Node2D building)
|
public bool IsAreaFree(Vector2I topLeft, Vector2I size, float rotation, GridLayer layer = GridLayer.Building)
|
||||||
{
|
{
|
||||||
_grid[cell] = building;
|
var occupiedCells = GridUtils.GetOccupiedCells(topLeft, size, rotation);
|
||||||
|
return occupiedCells.All(cell => !_layers[layer].ContainsKey(cell));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FreeCell(Vector2I cell)
|
public void OccupyArea(Vector2I topLeft, Node2D building, Vector2I size, float rotation,
|
||||||
|
GridLayer layer = GridLayer.Building)
|
||||||
{
|
{
|
||||||
_grid.Remove(cell);
|
var occupiedCells = GridUtils.GetOccupiedCells(topLeft, size, rotation);
|
||||||
|
foreach (var cell in occupiedCells)
|
||||||
|
{
|
||||||
|
_layers[layer][cell] = (building, size, rotation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Node2D? GetBuildingAtCell(Vector2I cell)
|
public void FreeArea(Vector2I topLeft, Vector2I size, float rotation, GridLayer layer = GridLayer.Building)
|
||||||
{
|
{
|
||||||
return _grid.GetValueOrDefault(cell);
|
var occupiedCells = GridUtils.GetOccupiedCells(topLeft, size, rotation);
|
||||||
|
foreach (var cell in occupiedCells)
|
||||||
|
{
|
||||||
|
if (_layers[layer].ContainsKey(cell))
|
||||||
|
_layers[layer].Remove(cell);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Node2D? GetBuildingAtCell(Vector2I cell, GridLayer layer = GridLayer.Building)
|
||||||
|
{
|
||||||
|
return _layers[layer].TryGetValue(cell, out var data) ? data.Building : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsAnyCellOccupied(Vector2I cell, params GridLayer[] layers)
|
||||||
|
{
|
||||||
|
if (layers.Length == 0)
|
||||||
|
{
|
||||||
|
// Check all layers if none specified
|
||||||
|
foreach (var layer in _layers.Values)
|
||||||
|
{
|
||||||
|
if (layer.ContainsKey(cell)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var layer in layers)
|
||||||
|
{
|
||||||
|
if (_layers[layer].ContainsKey(cell)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsAreaOccupied(Vector2I topLeft, Vector2I size, float rotation, params GridLayer[] layers)
|
||||||
|
{
|
||||||
|
var occupiedCells = GridUtils.GetOccupiedCells(topLeft, size, rotation);
|
||||||
|
|
||||||
|
if (layers.Length == 0)
|
||||||
|
{
|
||||||
|
// Check all layers if none specified
|
||||||
|
foreach (var cell in occupiedCells)
|
||||||
|
{
|
||||||
|
foreach (var layer in _layers.Values)
|
||||||
|
if (layer.ContainsKey(cell))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var cell in occupiedCells)
|
||||||
|
{
|
||||||
|
foreach (var layer in layers)
|
||||||
|
if (_layers[layer].ContainsKey(cell))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,4 +124,26 @@ public static class GridUtils
|
|||||||
cell.Y * TileSize
|
cell.Y * TileSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector2 GetCenterOffset(Vector2I size, float rotation)
|
||||||
|
{
|
||||||
|
var rotatedSize = (Mathf.RoundToInt(rotation / 90f) % 2) == 0 ? size : new Vector2I(size.Y, size.X);
|
||||||
|
return new Vector2(rotatedSize.X * TileSize / 2f, rotatedSize.Y * TileSize / 2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Vector2I> GetOccupiedCells(Vector2I topLeft, Vector2I size, float rotation)
|
||||||
|
{
|
||||||
|
var occupiedCells = new List<Vector2I>();
|
||||||
|
var rotatedSize = (Mathf.RoundToInt(rotation / 90f) % 2) == 0 ? size : new Vector2I(size.Y, size.X);
|
||||||
|
|
||||||
|
for (int x = 0; x < rotatedSize.X; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < rotatedSize.Y; y++)
|
||||||
|
{
|
||||||
|
occupiedCells.Add(new Vector2I(topLeft.X + x, topLeft.Y + y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return occupiedCells;
|
||||||
|
}
|
||||||
}
|
}
|
153
Scripts/System/NaturalResourceGenerator.cs
Normal file
153
Scripts/System/NaturalResourceGenerator.cs
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
using Godot;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using AceFieldNewHorizon.Scripts.Tiles;
|
||||||
|
|
||||||
|
namespace AceFieldNewHorizon.Scripts.System;
|
||||||
|
|
||||||
|
public partial class NaturalResourceGenerator : Node2D
|
||||||
|
{
|
||||||
|
[Export] public GridManager Grid { get; set; }
|
||||||
|
[Export] public BuildingRegistry Registry { get; set; }
|
||||||
|
|
||||||
|
[Export] public int MapWidth = 100;
|
||||||
|
[Export] public int MapHeight = 100;
|
||||||
|
[Export] public float StoneDensity = 0.1f; // 10% chance for stone
|
||||||
|
[Export] public float IronDensity = 0.03f; // 3% chance for iron (within stone)
|
||||||
|
[Export] public int MinStoneVeinSize = 1;
|
||||||
|
[Export] public int MaxStoneVeinSize = 5;
|
||||||
|
[Export] public int MinIronVeinSize = 1;
|
||||||
|
[Export] public int MaxIronVeinSize = 3;
|
||||||
|
[Export] public int Seed;
|
||||||
|
|
||||||
|
private RandomNumberGenerator _rng;
|
||||||
|
private readonly List<Vector2I> _groundTiles = [];
|
||||||
|
private readonly List<Vector2I> _stoneTiles = [];
|
||||||
|
private readonly List<Vector2I> _ironTiles = [];
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_rng = new RandomNumberGenerator();
|
||||||
|
_rng.Seed = (ulong)(Seed != 0 ? Seed : (int)GD.Randi());
|
||||||
|
|
||||||
|
GenerateTerrain();
|
||||||
|
PlaceResources();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GenerateTerrain()
|
||||||
|
{
|
||||||
|
// First pass: Generate base ground tiles
|
||||||
|
for (int x = 0; x < MapWidth; x++)
|
||||||
|
{
|
||||||
|
for (int y = 0; y < MapHeight; y++)
|
||||||
|
{
|
||||||
|
var cell = new Vector2I(x, y);
|
||||||
|
_groundTiles.Add(cell);
|
||||||
|
PlaceTile("ground", cell);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlaceResources()
|
||||||
|
{
|
||||||
|
// Create a copy of ground tiles for iteration
|
||||||
|
var groundTilesToProcess = new List<Vector2I>(_groundTiles);
|
||||||
|
|
||||||
|
// Place stone veins
|
||||||
|
foreach (var cell in groundTilesToProcess)
|
||||||
|
{
|
||||||
|
if (_rng.Randf() < StoneDensity)
|
||||||
|
{
|
||||||
|
var veinSize = _rng.RandiRange(MinStoneVeinSize, MaxStoneVeinSize);
|
||||||
|
PlaceVein(cell, "stone", veinSize, _stoneTiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a copy of stone tiles for iteration
|
||||||
|
var stoneTilesToProcess = new List<Vector2I>(_stoneTiles);
|
||||||
|
|
||||||
|
// Place iron veins within stone
|
||||||
|
foreach (var stoneCell in stoneTilesToProcess)
|
||||||
|
{
|
||||||
|
if (_rng.Randf() < IronDensity)
|
||||||
|
{
|
||||||
|
var veinSize = _rng.RandiRange(MinIronVeinSize, MaxIronVeinSize);
|
||||||
|
PlaceVein(stoneCell, "stone_iron", veinSize, _ironTiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlaceVein(Vector2I startCell, string tileType, int maxVeinSize, ICollection<Vector2I> tileList)
|
||||||
|
{
|
||||||
|
var queue = new Queue<Vector2I>();
|
||||||
|
var placed = new HashSet<Vector2I>();
|
||||||
|
queue.Enqueue(startCell);
|
||||||
|
|
||||||
|
int placedCount = 0;
|
||||||
|
|
||||||
|
while (queue.Count > 0 && placedCount < maxVeinSize)
|
||||||
|
{
|
||||||
|
var cell = queue.Dequeue();
|
||||||
|
if (placed.Contains(cell)) continue;
|
||||||
|
if (!IsInBounds(cell)) continue;
|
||||||
|
|
||||||
|
switch (tileType)
|
||||||
|
{
|
||||||
|
// For iron, make sure we're placing on stone
|
||||||
|
case "stone_iron" when !_stoneTiles.Contains(cell):
|
||||||
|
continue;
|
||||||
|
// Remove from previous layer if needed
|
||||||
|
case "stone_iron" when _stoneTiles.Contains(cell):
|
||||||
|
_stoneTiles.Remove(cell);
|
||||||
|
break;
|
||||||
|
case "stone" when _groundTiles.Contains(cell):
|
||||||
|
_groundTiles.Remove(cell);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlaceTile(tileType, cell);
|
||||||
|
tileList.Add(cell);
|
||||||
|
placed.Add(cell);
|
||||||
|
placedCount++;
|
||||||
|
|
||||||
|
// Add adjacent cells to queue
|
||||||
|
for (var dx = -1; dx <= 1; dx++)
|
||||||
|
{
|
||||||
|
for (var dy = -1; dy <= 1; dy++)
|
||||||
|
{
|
||||||
|
if (dx == 0 && dy == 0) continue; // Skip self
|
||||||
|
var neighbor = new Vector2I(cell.X + dx, cell.Y + dy);
|
||||||
|
if (!placed.Contains(neighbor) && IsInBounds(neighbor))
|
||||||
|
{
|
||||||
|
queue.Enqueue(neighbor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsInBounds(Vector2I cell)
|
||||||
|
{
|
||||||
|
return cell.X >= 0 && cell.X < MapWidth &&
|
||||||
|
cell.Y >= 0 && cell.Y < MapHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlaceTile(string tileType, Vector2I cell)
|
||||||
|
{
|
||||||
|
var building = Registry.GetBuilding(tileType);
|
||||||
|
if (building == null) return;
|
||||||
|
|
||||||
|
var scene = building.Scene;
|
||||||
|
var instance = (BaseTile)scene.Instantiate();
|
||||||
|
|
||||||
|
// Match PlacementManager's positioning logic
|
||||||
|
var rotatedSize = building.GetRotatedSize(0f);
|
||||||
|
var offset = GridUtils.GetCenterOffset(rotatedSize, 0f);
|
||||||
|
instance.Position = GridUtils.GridToWorld(cell) + offset;
|
||||||
|
|
||||||
|
instance.ZIndex = (int)building.Layer;
|
||||||
|
AddChild(instance);
|
||||||
|
|
||||||
|
// Make sure to use the building's size from the registry
|
||||||
|
Grid.OccupyArea(cell, instance, building.Size, 0f, building.Layer);
|
||||||
|
}
|
||||||
|
}
|
1
Scripts/System/NaturalResourceGenerator.cs.uid
Normal file
1
Scripts/System/NaturalResourceGenerator.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cugfbvw70clgd
|
@@ -1,5 +1,7 @@
|
|||||||
|
using System;
|
||||||
using AceFieldNewHorizon.Scripts.Tiles;
|
using AceFieldNewHorizon.Scripts.Tiles;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace AceFieldNewHorizon.Scripts.System;
|
namespace AceFieldNewHorizon.Scripts.System;
|
||||||
|
|
||||||
@@ -9,76 +11,201 @@ public partial class PlacementManager : Node2D
|
|||||||
[Export] public BuildingRegistry Registry { get; set; }
|
[Export] public BuildingRegistry Registry { get; set; }
|
||||||
|
|
||||||
private string _currentBuildingId = "wall";
|
private string _currentBuildingId = "wall";
|
||||||
|
|
||||||
private Vector2I _hoveredCell;
|
private Vector2I _hoveredCell;
|
||||||
private BaseTile _ghostBuilding;
|
private BaseTile _ghostBuilding;
|
||||||
|
private float _currentRotation;
|
||||||
|
private Vector2I _currentBuildingSize = Vector2I.One;
|
||||||
|
|
||||||
public void SetCurrentBuilding(string buildingId)
|
public void SetCurrentBuilding(string buildingId)
|
||||||
{
|
{
|
||||||
_currentBuildingId = buildingId;
|
_currentBuildingId = buildingId;
|
||||||
|
var buildingData = Registry.GetBuilding(buildingId);
|
||||||
|
if (buildingData != null)
|
||||||
|
{
|
||||||
|
_currentBuildingSize = buildingData.Size;
|
||||||
|
// Reset rotation to nearest allowed rotation
|
||||||
|
if (!buildingData.IsRotationAllowed(_currentRotation))
|
||||||
|
{
|
||||||
|
_currentRotation = (int)buildingData.AllowedRotations[0] * 90f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Replace ghost immediately
|
// Replace ghost immediately
|
||||||
if (_ghostBuilding == null) return;
|
if (_ghostBuilding != null)
|
||||||
|
{
|
||||||
_ghostBuilding.QueueFree();
|
_ghostBuilding.QueueFree();
|
||||||
_ghostBuilding = null;
|
_ghostBuilding = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RotateGhost(bool reverse = false)
|
||||||
|
{
|
||||||
|
if (_ghostBuilding == null) return;
|
||||||
|
|
||||||
|
var buildingData = Registry.GetBuilding(_currentBuildingId);
|
||||||
|
if (buildingData == null) return;
|
||||||
|
|
||||||
|
// Calculate next rotation
|
||||||
|
var currentDirection = (RotationDirection)((Mathf.RoundToInt(_currentRotation / 90f) % 4 + 4) % 4);
|
||||||
|
var currentIndex = Array.IndexOf(buildingData.AllowedRotations.ToArray(), currentDirection);
|
||||||
|
|
||||||
|
if (reverse)
|
||||||
|
currentIndex = (currentIndex - 1 + buildingData.AllowedRotations.Length) %
|
||||||
|
buildingData.AllowedRotations.Length;
|
||||||
|
else
|
||||||
|
currentIndex = (currentIndex + 1) % buildingData.AllowedRotations.Length;
|
||||||
|
|
||||||
|
_currentRotation = (int)buildingData.AllowedRotations[currentIndex] * 90f;
|
||||||
|
_ghostBuilding.RotationDegrees = _currentRotation;
|
||||||
|
|
||||||
|
// Update ghost position to keep the same cell under cursor
|
||||||
|
UpdateGhostPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateGhostPosition()
|
||||||
|
{
|
||||||
|
if (_ghostBuilding == null) return;
|
||||||
|
|
||||||
|
var buildingData = Registry.GetBuilding(_currentBuildingId);
|
||||||
|
if (buildingData == null) return;
|
||||||
|
|
||||||
|
var rotatedSize = buildingData.GetRotatedSize(_currentRotation);
|
||||||
|
var offset = GridUtils.GetCenterOffset(rotatedSize, _currentRotation);
|
||||||
|
_ghostBuilding.Position = GridUtils.GridToWorld(_hoveredCell) + offset;
|
||||||
|
|
||||||
|
// Update occupied cells
|
||||||
|
GridUtils.GetOccupiedCells(_hoveredCell, rotatedSize, _currentRotation);
|
||||||
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
// Snap mouse to grid
|
// Snap mouse to grid
|
||||||
var mousePos = GetGlobalMousePosition();
|
var mousePos = GetGlobalMousePosition();
|
||||||
_hoveredCell = GridUtils.WorldToGrid(mousePos);
|
var newHoveredCell = GridUtils.WorldToGrid(mousePos);
|
||||||
|
|
||||||
|
// Only update if cell changed
|
||||||
|
if (newHoveredCell != _hoveredCell)
|
||||||
|
{
|
||||||
|
_hoveredCell = newHoveredCell;
|
||||||
|
UpdateGhostPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Input.IsActionJustPressed("rotate_tile_reverse"))
|
||||||
|
RotateGhost(reverse: true);
|
||||||
|
else if (Input.IsActionJustPressed("rotate_tile"))
|
||||||
|
RotateGhost();
|
||||||
|
|
||||||
if (_ghostBuilding == null)
|
if (_ghostBuilding == null)
|
||||||
{
|
{
|
||||||
var scene = Registry.GetScene(_currentBuildingId);
|
var building = Registry.GetBuilding(_currentBuildingId);
|
||||||
if (scene == null) return;
|
if (building == null) return;
|
||||||
|
var scene = building.Scene;
|
||||||
|
|
||||||
_ghostBuilding = (BaseTile)scene.Instantiate();
|
_ghostBuilding = (BaseTile)scene.Instantiate();
|
||||||
_ghostBuilding.SetGhostMode(true);
|
_ghostBuilding.SetGhostMode(true);
|
||||||
|
_ghostBuilding.RotationDegrees = _currentRotation;
|
||||||
|
_ghostBuilding.ZAsRelative = false;
|
||||||
|
_ghostBuilding.ZIndex = (int)building.Layer;
|
||||||
|
UpdateGhostPosition();
|
||||||
AddChild(_ghostBuilding);
|
AddChild(_ghostBuilding);
|
||||||
}
|
}
|
||||||
|
|
||||||
var placementPos = GridUtils.GridToWorld(_hoveredCell);
|
var canPlace = CanPlaceBuilding();
|
||||||
var spaceState = GetWorld2D().DirectSpaceState;
|
|
||||||
var centerPos = placementPos + new Vector2(GridUtils.TileSize / 2f, GridUtils.TileSize / 2f);
|
|
||||||
|
|
||||||
var query = new PhysicsPointQueryParameters2D
|
|
||||||
{
|
|
||||||
Position = centerPos,
|
|
||||||
CollideWithBodies = true,
|
|
||||||
CollideWithAreas = true,
|
|
||||||
CollisionMask = uint.MaxValue // check against all layers/masks
|
|
||||||
// Exclude = new Godot.Collections.Array<Rid>() // optional, see below
|
|
||||||
};
|
|
||||||
|
|
||||||
var collision = spaceState.IntersectPoint(query, 8);
|
|
||||||
var canPlace = Grid.IsCellFree(_hoveredCell) && collision.Count == 0;
|
|
||||||
|
|
||||||
_ghostBuilding.Position = placementPos;
|
|
||||||
_ghostBuilding.SetGhostMode(canPlace);
|
_ghostBuilding.SetGhostMode(canPlace);
|
||||||
|
|
||||||
// Left click to place
|
// Left click to place
|
||||||
if (Input.IsActionPressed("build_tile") && canPlace)
|
if (Input.IsActionPressed("build_tile") && canPlace)
|
||||||
{
|
{
|
||||||
var scene = Registry.GetScene(_currentBuildingId);
|
var building = Registry.GetBuilding(_currentBuildingId);
|
||||||
if (scene == null) return;
|
if (building == null) return;
|
||||||
|
|
||||||
_ghostBuilding.FinalizePlacement();
|
var scene = building.Scene;
|
||||||
Grid.OccupyCell(_hoveredCell, _ghostBuilding);
|
var buildingInstance = (BaseTile)scene.Instantiate();
|
||||||
|
buildingInstance.RotationDegrees = _currentRotation;
|
||||||
|
buildingInstance.ZIndex = (int)building.Layer;
|
||||||
|
buildingInstance.Position = _ghostBuilding.Position;
|
||||||
|
AddChild(buildingInstance);
|
||||||
|
|
||||||
_ghostBuilding = (BaseTile)scene.Instantiate();
|
Grid.OccupyArea(_hoveredCell, buildingInstance, building.Size, _currentRotation, building.Layer);
|
||||||
_ghostBuilding.SetGhostMode(true);
|
|
||||||
AddChild(_ghostBuilding);
|
if (building.BuildTime > 0f)
|
||||||
|
buildingInstance.StartConstruction(building.BuildTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.IsActionPressed("destroy_tile") && !Grid.IsCellFree(_hoveredCell))
|
if (Input.IsActionPressed("destroy_tile") &&
|
||||||
|
!Grid.IsAreaFree(_hoveredCell, Vector2I.One, 0f))
|
||||||
{
|
{
|
||||||
// Right click to destroy
|
// Right click to destroy from current layer
|
||||||
var building = Grid.GetBuildingAtCell(_hoveredCell);
|
var building = Grid.GetBuildingAtCell(_hoveredCell);
|
||||||
if (building == null) return;
|
if (building == null) return;
|
||||||
|
// Find all cells occupied by this building
|
||||||
|
var buildingInfo = Grid.GetBuildingInfoAtCell(_hoveredCell, GridLayer.Building);
|
||||||
|
if (buildingInfo == null) return;
|
||||||
building.QueueFree();
|
building.QueueFree();
|
||||||
Grid.FreeCell(_hoveredCell);
|
Grid.FreeArea(buildingInfo.Value.Position, buildingInfo.Value.Size, buildingInfo.Value.Rotation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanPlaceBuilding()
|
||||||
|
{
|
||||||
|
var buildingData = Registry.GetBuilding(_currentBuildingId);
|
||||||
|
if (buildingData == null) return false;
|
||||||
|
|
||||||
|
// Check if rotation is allowed
|
||||||
|
if (!buildingData.IsRotationAllowed(_currentRotation))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Check if area is free
|
||||||
|
var rotatedSize = buildingData.GetRotatedSize(_currentRotation);
|
||||||
|
return !Grid.IsAreaOccupied(_hoveredCell, rotatedSize, _currentRotation, GetBlockingLayers(buildingData.Layer));
|
||||||
|
}
|
||||||
|
|
||||||
|
private GridLayer[] GetBlockingLayers(GridLayer layer)
|
||||||
|
{
|
||||||
|
return layer switch
|
||||||
|
{
|
||||||
|
GridLayer.Ground => [GridLayer.Ground],
|
||||||
|
GridLayer.Building => [GridLayer.Building],
|
||||||
|
GridLayer.Decoration => [GridLayer.Decoration],
|
||||||
|
_ => []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GridManagerExtensions
|
||||||
|
{
|
||||||
|
public static (Vector2I Position, Vector2I Size, float Rotation)? GetBuildingInfoAtCell(this GridManager grid,
|
||||||
|
Vector2I cell, GridLayer layer)
|
||||||
|
{
|
||||||
|
if (grid.GetBuildingAtCell(cell, layer) is { } building)
|
||||||
|
{
|
||||||
|
// Find the top-left position of the building
|
||||||
|
for (int x = 0; x < 100; x++) // Arbitrary max size
|
||||||
|
{
|
||||||
|
for (int y = 0; y < 100; y++)
|
||||||
|
{
|
||||||
|
var checkCell = new Vector2I(cell.X - x, cell.Y - y);
|
||||||
|
if (grid.GetBuildingAtCell(checkCell, layer) == building)
|
||||||
|
{
|
||||||
|
// Found the top-left corner, now find the size
|
||||||
|
var size = Vector2I.One;
|
||||||
|
// Search right
|
||||||
|
while (grid.GetBuildingAtCell(new Vector2I(checkCell.X + size.X, checkCell.Y), layer) ==
|
||||||
|
building)
|
||||||
|
size.X++;
|
||||||
|
// Search down
|
||||||
|
while (grid.GetBuildingAtCell(new Vector2I(checkCell.X, checkCell.Y + size.Y), layer) ==
|
||||||
|
building)
|
||||||
|
size.Y++;
|
||||||
|
|
||||||
|
// Get rotation from the first cell
|
||||||
|
var rotation = 0f; // You'll need to store rotation in GridManager to make this work
|
||||||
|
return (checkCell, size, rotation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,45 +1,75 @@
|
|||||||
|
using System.Numerics;
|
||||||
|
using AceFieldNewHorizon.Scripts.System;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using Vector2 = Godot.Vector2;
|
||||||
|
|
||||||
|
namespace AceFieldNewHorizon.Scripts.Tiles;
|
||||||
|
|
||||||
namespace AceFieldNewHorizon.Scripts.Tiles
|
|
||||||
{
|
|
||||||
public partial class BaseTile : Node2D
|
public partial class BaseTile : Node2D
|
||||||
{
|
{
|
||||||
private CollisionShape2D _collisionShape;
|
private CollisionShape2D _collisionShape;
|
||||||
private Sprite2D _sprite;
|
private Sprite2D _sprite;
|
||||||
|
private ColorRect _progressOverlay;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_collisionShape = GetNodeOrNull<CollisionShape2D>("CollisionShape2D");
|
_collisionShape = GetNodeOrNull<CollisionShape2D>("CollisionShape2D");
|
||||||
_sprite = GetNodeOrNull<Sprite2D>("Sprite2D");
|
_sprite = GetNodeOrNull<Sprite2D>("Sprite2D");
|
||||||
|
_progressOverlay = GetNodeOrNull<ColorRect>("ProgressOverlay");
|
||||||
|
if (_progressOverlay != null)
|
||||||
|
_progressOverlay.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Switch between ghost and placed mode.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="canPlace">If in ghost mode, true = green, false = red. If placed, always white.</param>
|
|
||||||
public void SetGhostMode(bool canPlace)
|
public void SetGhostMode(bool canPlace)
|
||||||
{
|
{
|
||||||
if (_collisionShape != null)
|
if (_collisionShape != null)
|
||||||
_collisionShape.Disabled = true; // always disabled in ghost mode
|
_collisionShape.Disabled = true;
|
||||||
|
|
||||||
if (_sprite != null)
|
if (_sprite != null)
|
||||||
{
|
_sprite.Modulate = canPlace
|
||||||
// Ghost preview coloring
|
? new Color(0, 1, 0, 0.5f)
|
||||||
_sprite.Modulate = canPlace ? new Color(1, 1, 1, 0.2f) : // white semi-transparent
|
: new Color(1, 0, 0, 0.5f);
|
||||||
new Color(1, 0, 0, 0.2f); // red semi-transparent
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Call when placement is finalized.
|
|
||||||
/// </summary>
|
|
||||||
public void FinalizePlacement()
|
public void FinalizePlacement()
|
||||||
{
|
{
|
||||||
if (_collisionShape != null)
|
if (_collisionShape != null)
|
||||||
_collisionShape.Disabled = false;
|
_collisionShape.Disabled = false;
|
||||||
|
|
||||||
if (_sprite != null)
|
if (_sprite != null)
|
||||||
_sprite.Modulate = Colors.White; // reset to normal
|
_sprite.Modulate = Colors.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Building progress visualization
|
||||||
|
public void StartConstruction(float buildTime)
|
||||||
|
{
|
||||||
|
if (_progressOverlay == null || _sprite?.Texture == null) return;
|
||||||
|
|
||||||
|
var texSize = new Vector2(GridUtils.TileSize, GridUtils.TileSize);
|
||||||
|
|
||||||
|
_progressOverlay.Visible = true;
|
||||||
|
_progressOverlay.Color = new Color(0, 0, 1, 0.4f); // semi-transparent blue
|
||||||
|
|
||||||
|
async void RunProgress()
|
||||||
|
{
|
||||||
|
var elapsed = 0f;
|
||||||
|
while (elapsed < buildTime)
|
||||||
|
{
|
||||||
|
await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
|
||||||
|
elapsed += (float)GetProcessDeltaTime();
|
||||||
|
|
||||||
|
var ratio = Mathf.Clamp(elapsed / buildTime, 0, 1);
|
||||||
|
|
||||||
|
// Fill from bottom to top, aligned with sprite center pivot
|
||||||
|
_progressOverlay.Size = new Vector2(texSize.X, texSize.Y * ratio);
|
||||||
|
_progressOverlay.Position = new Vector2(
|
||||||
|
-texSize.X / 2, // align left edge
|
||||||
|
texSize.Y / 2 - _progressOverlay.Size.Y // move upward
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_progressOverlay.Visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
RunProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
8
Scripts/Tiles/GroundTile.cs
Normal file
8
Scripts/Tiles/GroundTile.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace AceFieldNewHorizon.Scripts.Tiles;
|
||||||
|
|
||||||
|
public partial class GroundTile : BaseTile
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
1
Scripts/Tiles/GroundTile.cs.uid
Normal file
1
Scripts/Tiles/GroundTile.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dh0jdeplrigxu
|
8
Scripts/Tiles/MinerTile.cs
Normal file
8
Scripts/Tiles/MinerTile.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace AceFieldNewHorizon.Scripts.Tiles;
|
||||||
|
|
||||||
|
public partial class MinerTile : BaseTile
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
1
Scripts/Tiles/MinerTile.cs.uid
Normal file
1
Scripts/Tiles/MinerTile.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dyubkyqtpcg3a
|
@@ -55,6 +55,31 @@ destroy_tile={
|
|||||||
"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":2,"position":Vector2(481, 42),"global_position":Vector2(500, 138),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
"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":2,"position":Vector2(481, 42),"global_position":Vector2(500, 138),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
rotate_tile={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"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":79,"key_label":0,"unicode":111,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
rotate_tile_reverse={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":true,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":79,"key_label":0,"unicode":79,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_sprint={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"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={
|
||||||
|
"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user