Добавил кнопки и интерфейс #1

Closed
DIvan2000 wants to merge 1 commits from Interface_branch into main
18 changed files with 356 additions and 4 deletions

19
TimerforVariable.tscn Normal file
View File

@ -0,0 +1,19 @@
[gd_scene load_steps=2 format=3 uid="uid://c4i2x2n7xckcw"]
[ext_resource type="Script" path="res://label.gd" id="1_a6v74"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 23.0
text = "
"
script = ExtResource("1_a6v74")

BIN
assets/Heart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

34
assets/Heart.png.import Normal file
View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://brldhixjky0yu"
path="res://.godot/imported/Heart.png-30a5ad9a510a2f0aa8e7d98f371b9c70.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Heart.png"
dest_files=["res://.godot/imported/Heart.png-30a5ad9a510a2f0aa8e7d98f371b9c70.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
assets/Iconary.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

34
assets/Iconary.png.import Normal file
View File

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

43
buttons.tscn Normal file
View File

@ -0,0 +1,43 @@
[gd_scene format=3 uid="uid://xodvne8kl7ek"]
[node name="Buttons" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="NULL" type="Button" parent="."]
z_index = 1025
offset_left = 932.0
offset_right = 1024.0
offset_bottom = 31.0
text = "Убрать
"
[node name="Demolish" type="Button" parent="."]
z_index = 1025
offset_left = 932.0
offset_top = 38.0
offset_right = 1024.0
offset_bottom = 69.0
text = "Демонтаж
"
[node name="Construct" type="Button" parent="."]
z_index = 1025
offset_left = 911.0
offset_top = 75.0
offset_right = 1024.0
offset_bottom = 106.0
text = "Конструкция
"
[node name="Build" type="Button" parent="."]
z_index = 1025
offset_left = 932.0
offset_top = 113.0
offset_right = 1024.0
offset_bottom = 144.0
text = "Строить"

5
demolish.gd Normal file
View File

@ -0,0 +1,5 @@
extends Button
# Called when the node enters the scene tree for the first time.
func _ready() -> void:

12
energylabel.gd Normal file
View File

@ -0,0 +1,12 @@
extends Label
var energyLvl : float = 100.0
var time = 0.0
func addTIme(delta: float) -> void:
$Timer.new()
func _on_timer_timeout() -> void:
if (time == 0.0):
energyLvl -= 1.0

14
label.gd Normal file
View File

@ -0,0 +1,14 @@
extends Label
var max_energy = 100
var count_time = 0
var str_max_energy
func _process(delta: float) -> void:
$Label.text = max_energy
count_time += delta
if (count_time >= 60):
count_time = 0
if max_energy > 0:
max_energy -= 1
$Label.text = max_energy

14
menu.gd Normal file
View File

@ -0,0 +1,14 @@
extends Control
func _on_play_pressed() -> void:
get_tree().change_scene_to_file("res://world.tscn")
func _on_settings_pressed() -> void:
get_tree().change_scene_to_file("res://options_menu.tscn")
func _on_quit_game_pressed() -> void:
get_tree().quit()

40
menu.tscn Normal file
View File

@ -0,0 +1,40 @@
[gd_scene load_steps=2 format=3 uid="uid://dp6pttsbfm0f1"]
[ext_resource type="Script" path="res://menu.gd" id="1_a0bq7"]
[node name="menu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_a0bq7")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
[node name="Play" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Play"
[node name="Settings" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Options"
[node name="Quit Game" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Quit game"
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(43, 55)
zoom = Vector2(2, 2)
[connection signal="pressed" from="MarginContainer/VBoxContainer/Play" to="." method="_on_play_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/Quit Game" to="." method="_on_quit_game_pressed"]

4
options_menu.gd Normal file
View File

@ -0,0 +1,4 @@
extends Control
func _on_back_to_menu_pressed() -> void:
get_tree().change_scene_to_file('res://menu.tscn')

34
options_menu.tscn Normal file
View File

@ -0,0 +1,34 @@
[gd_scene load_steps=2 format=3 uid="uid://bnqopjqlq8iim"]
[ext_resource type="Script" path="res://options_menu.gd" id="1_tywj4"]
[node name="options_menu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_tywj4")
[node name="MarginContainer" type="MarginContainer" parent="."]
layout_mode = 0
offset_right = 40.0
offset_bottom = 40.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
layout_mode = 2
[node name="MasterVolume" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Master Volume"
[node name="back to menu" type="Button" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
text = "Back to menu"
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(62, 35)
zoom = Vector2(2, 2)
[connection signal="pressed" from="MarginContainer/VBoxContainer/back to menu" to="." method="_on_back_to_menu_pressed"]

1
play.gd Normal file
View File

@ -0,0 +1 @@
extends Button

View File

@ -11,7 +11,7 @@ config_version=5
[application]
config/name="TestProject"
run/main_scene="res://world.tscn"
run/main_scene="res://menu.tscn"
config/features=PackedStringArray("4.3", "GL Compatibility")
config/icon="res://assets/icon.svg"
@ -28,7 +28,7 @@ project/assembly_name="TestProject"
[editor_plugins]
enabled=PackedStringArray("res://addons/sprite_painter/plugin.cfg")
enabled=PackedStringArray()
[input]
@ -53,3 +53,4 @@ right_mouse={
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
textures/main_scene="res://world.tscn"

11
settings.gd Normal file
View File

@ -0,0 +1,11 @@
extends Button
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@ -6,6 +6,18 @@ extends Node2D
const SELECTION_SCENE = preload("res://selection.tscn")
func _on_null_pressed() -> void:
change_instrument(instruments.NULL)
func _on_demolish_pressed() -> void:
change_instrument(instruments.DESTROY)
func _on_construct_pressed() -> void:
change_instrument(instruments.CONSTRUCT)
func _on_build_pressed() -> void:
change_instrument(instruments.BUILD_ROAD)
var selected_instrument: instruments
var selected_tile: Vector2i
var selected_tile2: Vector2i

File diff suppressed because one or more lines are too long