This commit is contained in:
mightypanders 2021-06-13 00:45:30 +02:00
commit 9e1d3f2980
7 changed files with 115 additions and 1 deletions

102
GUIIngameTop.tscn Normal file
View File

@ -0,0 +1,102 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://assets/ui/bg.png" type="Texture" id=1]
[ext_resource path="res://Money.gd" type="Script" id=2]
[ext_resource path="res://assets/ui/coin.png" type="Texture" id=3]
[ext_resource path="res://assets/MonoRaccoon.ttf" type="DynamicFontData" id=4]
[sub_resource type="DynamicFont" id=1]
size = 25
font_data = ExtResource( 4 )
[node name="GUI" type="MarginContainer"]
margin_right = 1282.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 1282.0
margin_bottom = 80.0
rect_pivot_offset = Vector2( 187.174, 395.14 )
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer"]
margin_right = 140.0
margin_bottom = 80.0
[node name="Time" type="MarginContainer" parent="HBoxContainer/HBoxContainer"]
margin_right = 140.0
margin_bottom = 80.0
[node name="Background" type="NinePatchRect" parent="HBoxContainer/HBoxContainer/Time"]
margin_right = 140.0
margin_bottom = 80.0
rect_min_size = Vector2( 140, 80 )
texture = ExtResource( 1 )
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/HBoxContainer/Time/Background"]
margin_left = 8.39193
margin_top = -0.943878
margin_right = 52.3919
margin_bottom = 39.0561
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Number" type="Label" parent="HBoxContainer/HBoxContainer/Time/Background"]
margin_left = 29.0328
margin_top = 12.4994
margin_right = 73.0328
margin_bottom = 26.4994
text = "asdasd"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Control" type="Control" parent="HBoxContainer"]
margin_left = 144.0
margin_right = 1138.0
margin_bottom = 80.0
size_flags_horizontal = 3
[node name="HBoxContainer2" type="HBoxContainer" parent="HBoxContainer"]
margin_left = 1142.0
margin_right = 1282.0
margin_bottom = 80.0
[node name="Money" type="MarginContainer" parent="HBoxContainer/HBoxContainer2"]
margin_right = 140.0
margin_bottom = 80.0
rect_min_size = Vector2( 120, 80 )
script = ExtResource( 2 )
[node name="Background" type="NinePatchRect" parent="HBoxContainer/HBoxContainer2/Money"]
margin_right = 140.0
margin_bottom = 80.0
rect_min_size = Vector2( 140, 80 )
texture = ExtResource( 1 )
[node name="TextureRect" type="TextureRect" parent="HBoxContainer/HBoxContainer2/Money/Background"]
margin_left = 80.0765
margin_top = 12.5011
margin_right = 180.077
margin_bottom = 112.501
rect_scale = Vector2( 0.5, 0.5 )
texture = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Number" type="Label" parent="HBoxContainer/HBoxContainer2/Money/Background"]
margin_left = 11.0
margin_top = 13.0
margin_right = 77.0
margin_bottom = 63.0
custom_fonts/font = SubResource( 1 )
text = "Test"
align = 2
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}

7
Money.gd Normal file
View File

@ -0,0 +1,7 @@
extends MarginContainer
onready var label = $Background/Number
func update_text(value):
label.text = String(value)

View File

@ -3,6 +3,7 @@ extends Node2D
onready var streets = $Streets onready var streets = $Streets
onready var used_cells = streets.get_used_cells() onready var used_cells = streets.get_used_cells()
onready var guests = $Guests onready var guests = $Guests
onready var money_label = $GUI/HBoxContainer/HBoxContainer2/Money
export var player_score = 0 export var player_score = 0
@ -12,6 +13,7 @@ var rng = RandomNumberGenerator.new()
var spawn_tries = 0 var spawn_tries = 0
const MAX_SPAWN_TRIES = 50 const MAX_SPAWN_TRIES = 50
onready var radius_guests = guests.get_child(0).exclusionZoneShape.shape.radius * 2 onready var radius_guests = guests.get_child(0).exclusionZoneShape.shape.radius * 2
export var max_guests = 10 export var max_guests = 10
@ -59,4 +61,4 @@ func create_new_guest():
func _on_Playa_scored(value:int): func _on_Playa_scored(value:int):
print('Its a score of %s'% String(value)) print('Its a score of %s'% String(value))
player_score += value player_score += value
pass # Replace with function body. money_label.update_text(player_score)

View File

@ -32,6 +32,7 @@
[ext_resource path="res://assets/city_tiles/streets/3-Wege 10.png" type="Texture" id=30] [ext_resource path="res://assets/city_tiles/streets/3-Wege 10.png" type="Texture" id=30]
[ext_resource path="res://assets/city_tiles/streets/3-Wege 2.png" type="Texture" id=31] [ext_resource path="res://assets/city_tiles/streets/3-Wege 2.png" type="Texture" id=31]
[ext_resource path="res://assets/city_tiles/Bäume.png" type="Texture" id=32] [ext_resource path="res://assets/city_tiles/Bäume.png" type="Texture" id=32]
[ext_resource path="res://GUIIngameTop.tscn" type="PackedScene" id=33]
[sub_resource type="ConvexPolygonShape2D" id=1] [sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 ) points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
@ -1070,6 +1071,8 @@ autostart = true
[node name="Guest" parent="Guests" instance=ExtResource( 5 )] [node name="Guest" parent="Guests" instance=ExtResource( 5 )]
position = Vector2( 337.119, 100.387 ) position = Vector2( 337.119, 100.387 )
[node name="GUI" parent="." instance=ExtResource( 33 )]
[connection signal="scored" from="Playa" to="." method="_on_Playa_scored"] [connection signal="scored" from="Playa" to="." method="_on_Playa_scored"]
[connection signal="timeout" from="GuestTimer" to="." method="_on_GuestTimer_timeout"] [connection signal="timeout" from="GuestTimer" to="." method="_on_GuestTimer_timeout"]
[connection signal="picked_up" from="Guests/Guest" to="." method="_on_Guest_picked_up"] [connection signal="picked_up" from="Guests/Guest" to="." method="_on_Guest_picked_up"]

BIN
assets/MonoRaccoon.ttf Normal file

Binary file not shown.

BIN
assets/ui/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
assets/ui/coin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB