1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-22 07:44:17 +00:00

Reconnect button spawner

This commit is contained in:
Steffo 2023-10-01 15:40:42 +02:00
parent 39a0310a53
commit 07eb7f330b
Signed by: steffo
GPG key ID: 2A24051445686895
5 changed files with 27 additions and 7 deletions

9
game/game.gd Normal file
View file

@ -0,0 +1,9 @@
extends Node2D
class_name Game
@onready var button_spawner = $ButtonSpawner
func trigger_spawn():
button_spawner.spawn()

View file

@ -1,5 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://c3rxmcwa5nqng"] [gd_scene load_steps=6 format=3 uid="uid://c3rxmcwa5nqng"]
[ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"]
[ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"] [ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"]
[ext_resource type="PackedScene" uid="uid://d05b8jy3xmpcb" path="res://bottle/gravity_from_gyro.tscn" id="2_h2pfr"] [ext_resource type="PackedScene" uid="uid://d05b8jy3xmpcb" path="res://bottle/gravity_from_gyro.tscn" id="2_h2pfr"]
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"]
@ -7,6 +8,7 @@
[node name="Game" type="Node2D"] [node name="Game" type="Node2D"]
texture_filter = 1 texture_filter = 1
script = ExtResource("1_i3ly0")
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
@ -22,8 +24,6 @@ overlapping_bodies_collision_mask = 4
overlapping_body_count_limit = 4 overlapping_body_count_limit = 4
[node name="Timer" type="Timer" parent="TimeSpawner"] [node name="Timer" type="Timer" parent="TimeSpawner"]
wait_time = 0.03
autostart = true
[node name="ButtonSpawner" parent="." instance=ExtResource("3_qwsty")] [node name="ButtonSpawner" parent="." instance=ExtResource("3_qwsty")]
position = Vector2(0, -480) position = Vector2(0, -480)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=2 format=3 uid="uid://mfa1v4fsnupp"] [gd_scene load_steps=2 format=3 uid="uid://c0uce7ssweke"]
[ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="1_dbqdv"] [ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="1_dbqdv"]

View file

@ -3,6 +3,7 @@ class_name Root
@onready var tree: SceneTree = get_tree() @onready var tree: SceneTree = get_tree()
@onready var game: Game = $UI/GameContainer/Game
@onready var game_ui: GameUI = $UI/GameUI @onready var game_ui: GameUI = $UI/GameUI
@onready var shop_ui: ShopUI = $UI/ShopUI @onready var shop_ui: ShopUI = $UI/ShopUI
@ -46,4 +47,4 @@ func _on_game_ui_shop_button_pressed():
ui_state = UIState.SHOP ui_state = UIState.SHOP
func _on_game_ui_spawn_button_pressed(): func _on_game_ui_spawn_button_pressed():
pass # Replace with function body. game.trigger_spawn()

View file

@ -2,12 +2,13 @@
[ext_resource type="Script" path="res://root.gd" id="1_8jrhk"] [ext_resource type="Script" path="res://root.gd" id="1_8jrhk"]
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_h26ax"] [ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_h26ax"]
[ext_resource type="PackedScene" uid="uid://mfa1v4fsnupp" path="res://interface/game_container.tscn" id="1_xjgvu"] [ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="3_hrdyr"]
[ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="3_lvefk"] [ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="3_lvefk"]
[ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="5_2cc15"] [ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="5_2cc15"]
[node name="Root" type="Node"] [node name="Root" type="Node"]
script = ExtResource("1_8jrhk") script = ExtResource("1_8jrhk")
ui_state = null
[node name="UI" type="Control" parent="."] [node name="UI" type="Control" parent="."]
texture_filter = 1 texture_filter = 1
@ -20,9 +21,18 @@ grow_vertical = 2
size_flags_vertical = 8 size_flags_vertical = 8
theme = ExtResource("1_h26ax") theme = ExtResource("1_h26ax")
[node name="GameContainer" parent="UI" instance=ExtResource("1_xjgvu")] [node name="GameContainer" type="Control" parent="UI"]
process_mode = 1 process_mode = 1
layout_mode = 1 layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
[node name="Game" parent="UI/GameContainer" instance=ExtResource("3_hrdyr")]
[node name="GameUI" parent="UI" instance=ExtResource("5_2cc15")] [node name="GameUI" parent="UI" instance=ExtResource("5_2cc15")]
process_mode = 3 process_mode = 3