animals
This commit is contained in:
parent
f4ffbf642b
commit
f5f80fd180
15 changed files with 73 additions and 10 deletions
|
|
@ -6,6 +6,9 @@ var rotationTimer = 0
|
|||
func _ready() -> void:
|
||||
set_rotation_amount()
|
||||
|
||||
func set_info(info:String):
|
||||
$Info.text = info
|
||||
|
||||
func set_location_offset(offset):
|
||||
%ViewObject.global_position = offset
|
||||
|
||||
|
|
|
|||
|
|
@ -18,9 +18,25 @@ unique_name_in_owner = true
|
|||
|
||||
[node name="TextureRect" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 200.0
|
||||
offset_right = 246.0
|
||||
offset_bottom = 200.0
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Info" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 2.0
|
||||
offset_top = 201.0
|
||||
offset_right = 248.0
|
||||
offset_bottom = 240.0
|
||||
theme_override_colors/font_color = Color(1, 0, 0, 1)
|
||||
theme_override_colors/font_shadow_color = Color(0, 0.882353, 0, 1)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 1, 1)
|
||||
theme_override_constants/outline_size = 8
|
||||
theme_override_constants/shadow_outline_size = 14
|
||||
theme_override_font_sizes/font_size = 28
|
||||
text = "Horse - 5 dollars"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[editable path="SubViewport/ViewObject"]
|
||||
[editable path="SubViewport/ViewObject/horse"]
|
||||
|
|
|
|||
|
|
@ -6,11 +6,13 @@ var shapes = [
|
|||
{
|
||||
"object": preload("res://models/horse.glb"),
|
||||
"name": "horse",
|
||||
"cost": 0,
|
||||
"scene": preload("res://objects/horse.tscn")
|
||||
},
|
||||
{
|
||||
"object": preload("res://models/shark.glb"),
|
||||
"name": "shark",
|
||||
"cost": 5,
|
||||
"scene": preload("res://objects/shark.tscn")
|
||||
},
|
||||
]
|
||||
|
|
@ -24,8 +26,10 @@ func close():
|
|||
visible = false
|
||||
|
||||
func button_clicked(index):
|
||||
GlobalVariables.player.change_object(shapes[index].scene.instantiate())
|
||||
close()
|
||||
if GlobalVariables.money >= shapes[index].cost:
|
||||
GlobalVariables.money -= shapes[index].cost
|
||||
GlobalVariables.player.change_object(shapes[index].scene.instantiate())
|
||||
close()
|
||||
|
||||
func setup_buttons():
|
||||
var index = 0
|
||||
|
|
@ -37,5 +41,6 @@ func setup_buttons():
|
|||
offset += Vector3(0, 10000, 10000)
|
||||
newButton.change_object(buttonObject)
|
||||
|
||||
newButton.set_info(shape.name + " - " + str(shape.cost) + " dollars")
|
||||
newButton.pressed.connect(button_clicked.bind(index))
|
||||
index += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue