Add covers and basic camera movements

This commit is contained in:
Ategon 2024-09-17 16:37:19 -04:00
parent 88c082ac2a
commit 72b0bf1d1e
20 changed files with 365 additions and 113 deletions

229
Main.tscn
View file

@ -1,4 +1,4 @@
[gd_scene load_steps=35 format=4 uid="uid://5ske2hm55rce"] [gd_scene load_steps=36 format=4 uid="uid://5ske2hm55rce"]
[ext_resource type="PackedScene" uid="uid://n2lpy72tkyc8" path="res://storm/StormManager.tscn" id="1_gcxt1"] [ext_resource type="PackedScene" uid="uid://n2lpy72tkyc8" path="res://storm/StormManager.tscn" id="1_gcxt1"]
[ext_resource type="Script" path="res://main.gd" id="1_pg2kh"] [ext_resource type="Script" path="res://main.gd" id="1_pg2kh"]
@ -28,6 +28,118 @@
[ext_resource type="Texture2D" uid="uid://cqmbbg06vdb2r" path="res://meter.png" id="23_a1lb7"] [ext_resource type="Texture2D" uid="uid://cqmbbg06vdb2r" path="res://meter.png" id="23_a1lb7"]
[ext_resource type="Script" path="res://meter.gd" id="24_p0q5k"] [ext_resource type="Script" path="res://meter.gd" id="24_p0q5k"]
[ext_resource type="Texture2D" uid="uid://bcj5syslhrfsx" path="res://mask.png" id="24_ygd3p"] [ext_resource type="Texture2D" uid="uid://bcj5syslhrfsx" path="res://mask.png" id="24_ygd3p"]
[ext_resource type="Script" path="res://camera.gd" id="29_cfuj5"]
[sub_resource type="Animation" id="Animation_gcod0"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CanvasLayer/Start/RichTextLabel:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CanvasLayer/Start/RichTextLabel2:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("CanvasLayer/Start:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("CanvasLayer/StartOverlay:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("CanvasLayer/UI/Background/Control:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -28)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("CanvasLayer/UI/Background/Control2:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -28)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("CanvasLayer/UI/Background/Control3:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(41, -28)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("CanvasLayer/BuildingMenu:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 363.755)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("CanvasLayer/Control:position")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -28.285)]
}
[sub_resource type="Animation" id="Animation_ycb31"] [sub_resource type="Animation" id="Animation_ycb31"]
resource_name = "start" resource_name = "start"
@ -153,117 +265,6 @@ tracks/9/keys = {
"values": [Vector2(0, -28.285), Vector2(0, -20.6623), Vector2(0, -14.3426), Vector2(0, -9.21402), Vector2(0, -5.16457), Vector2(0, -2.08232), Vector2(0, 0.144659), Vector2(0, 1.62829), Vector2(0, 2.48052), Vector2(0, 2.81329), Vector2(0, 2.73851), Vector2(0, 2.36814), Vector2(0, 1.8141), Vector2(0, 1.18834), Vector2(0, 0.602774), Vector2(0, 0.169348), Vector2(0, 0)] "values": [Vector2(0, -28.285), Vector2(0, -20.6623), Vector2(0, -14.3426), Vector2(0, -9.21402), Vector2(0, -5.16457), Vector2(0, -2.08232), Vector2(0, 0.144659), Vector2(0, 1.62829), Vector2(0, 2.48052), Vector2(0, 2.81329), Vector2(0, 2.73851), Vector2(0, 2.36814), Vector2(0, 1.8141), Vector2(0, 1.18834), Vector2(0, 0.602774), Vector2(0, 0.169348), Vector2(0, 0)]
} }
[sub_resource type="Animation" id="Animation_gcod0"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("CanvasLayer/Start/RichTextLabel:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CanvasLayer/Start/RichTextLabel2:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("CanvasLayer/Start:modulate")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("CanvasLayer/StartOverlay:modulate")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("CanvasLayer/UI/Background/Control:position")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -28)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("CanvasLayer/UI/Background/Control2:position")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -28)]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("CanvasLayer/UI/Background/Control3:position")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(41, -28)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("CanvasLayer/BuildingMenu:position")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, 363.755)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("CanvasLayer/Control:position")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0, -28.285)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8mn2x"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_8mn2x"]
_data = { _data = {
"RESET": SubResource("Animation_gcod0"), "RESET": SubResource("Animation_gcod0"),
@ -1026,3 +1027,7 @@ texture = ExtResource("7_bnuu0")
stream = SubResource("AudioStreamRandomizer_f4v2y") stream = SubResource("AudioStreamRandomizer_f4v2y")
volume_db = -10.0 volume_db = -10.0
autoplay = true autoplay = true
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(320, 180)
script = ExtResource("29_cfuj5")

37
camera.gd Normal file
View file

@ -0,0 +1,37 @@
extends Camera2D
# Variables to control zoom limits and speed
var zoom_min = 0.5
var zoom_max = 2.0
var zoom_speed = 0.1
# Variables for panning
var is_panning = false
var last_mouse_position = Vector2()
func _input(event):
if event is InputEventMouseButton:
# Zoom in (scroll up)
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
zoom -= Vector2(zoom_speed, zoom_speed)
# Zoom out (scroll down)
elif event.button_index == MOUSE_BUTTON_WHEEL_UP:
zoom += Vector2(zoom_speed, zoom_speed)
# Clamp the zoom value to stay within zoom_min and zoom_max
zoom.x = clamp(zoom.x, zoom_min, zoom_max)
zoom.y = clamp(zoom.y, zoom_min, zoom_max)
# Handle panning with right click
if event.button_index == MOUSE_BUTTON_RIGHT:
if event.pressed:
is_panning = true
last_mouse_position = get_global_mouse_position()
else:
is_panning = false
# Handle panning movement
if is_panning and event is InputEventMouseMotion:
var mouse_movement = last_mouse_position - get_global_mouse_position()
global_position += mouse_movement * zoom.x # Adjust movement based on zoom level
last_mouse_position = get_global_mouse_position()

BIN
cover Copy.aseprite Normal file

Binary file not shown.

BIN
cover.aseprite Normal file

Binary file not shown.

BIN
cover.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

BIN
cover.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 KiB

34
cover.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://oosowfc5qql6"
path="res://.godot/imported/cover.png-7415a2400197f69905d305dff229e3ab.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover.png"
dest_files=["res://.godot/imported/cover.png-7415a2400197f69905d305dff229e3ab.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

BIN
cover2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

34
cover2.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b7ko742xcklsn"
path="res://.godot/imported/cover2.png-2ef2bf54704d9d001b82b1ad156dc4f6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover2.png"
dest_files=["res://.godot/imported/cover2.png-2ef2bf54704d9d001b82b1ad156dc4f6.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

BIN
cover4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

34
cover4.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://daol7g1lylsmt"
path="res://.godot/imported/cover4.png-19fae104c6b0976f56a020466ca17034.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover4.png"
dest_files=["res://.godot/imported/cover4.png-19fae104c6b0976f56a020466ca17034.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

BIN
cover5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 369 KiB

34
cover5.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b2c4geob4lf3q"
path="res://.godot/imported/cover5.png-0c496ad1d8b7fd577db0c14a195a8435.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover5.png"
dest_files=["res://.godot/imported/cover5.png-0c496ad1d8b7fd577db0c14a195a8435.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

BIN
cover6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

34
cover6.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b516bcl3xf6eg"
path="res://.godot/imported/cover6.png-e6099f9f4c556f35ef81470604604e2b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://cover6.png"
dest_files=["res://.godot/imported/cover6.png-e6099f9f4c556f35ef81470604604e2b.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

3
default_bus_layout.tres Normal file
View file

@ -0,0 +1,3 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://dnndw0lm0ddb5"]
[resource]

BIN
text.aseprite Normal file

Binary file not shown.

BIN
text.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

34
text.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d0b1wjjlnrcak"
path="res://.godot/imported/text.png-3d72e54e4b30a381dfa6ca6c8743057b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://text.png"
dest_files=["res://.godot/imported/text.png-3d72e54e4b30a381dfa6ca6c8743057b.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

View file

@ -42,6 +42,9 @@ func _on_mouse_handler_clicked() -> void:
if Persister.get_value("win") or Persister.get_value("lose"): if Persister.get_value("win") or Persister.get_value("lose"):
return return
var data = Data.data.buildings[key]
if (not data.cost.has("wood") or int(data.cost.wood) <= Persister.get_value("wood")) and (not data.cost.has("stone") or int(data.cost.stone) <= Persister.get_value("stone")):
clicked = true clicked = true
if hover_tween: if hover_tween: