mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-21 15:24:18 +00:00
Add deletion and debug spam
This commit is contained in:
parent
cd0ddc0f5a
commit
b71faaabba
9 changed files with 96 additions and 11 deletions
|
@ -29,3 +29,18 @@ func _on_timer_timeout():
|
|||
sound_working.stop()
|
||||
sound_complete.play()
|
||||
spawner.spawn()
|
||||
|
||||
var is_pending_deletion: bool = false
|
||||
|
||||
func pending_deletion():
|
||||
sprite_front.modulate = Color.RED
|
||||
is_pending_deletion = true
|
||||
|
||||
func ending_deletion():
|
||||
sprite_front.modulate = Color.WHITE
|
||||
is_pending_deletion = false
|
||||
|
||||
func _input(event: InputEvent):
|
||||
if is_pending_deletion:
|
||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||
queue_free()
|
||||
|
|
7
game/DebugTimer.gd
Normal file
7
game/DebugTimer.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends Timer
|
||||
class_name DebugTimer
|
||||
|
||||
|
||||
func _input(event):
|
||||
if event.is_action("turbo"):
|
||||
start()
|
10
game/game.gd
10
game/game.gd
|
@ -95,3 +95,13 @@ func _on_ghost_materialize():
|
|||
var spawner = instantiated.find_child("Spawner")
|
||||
if spawner != null:
|
||||
spawner.target = self
|
||||
|
||||
func _on_shop_ui_delete_begin():
|
||||
var converters = find_children("*", "Converter", true, false)
|
||||
for converter in converters:
|
||||
converter.pending_deletion()
|
||||
|
||||
func _on_shop_ui_delete_end():
|
||||
var converters = find_children("*", "Converter", true, false)
|
||||
for converter in converters:
|
||||
converter.ending_deletion()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=22 format=3 uid="uid://c3rxmcwa5nqng"]
|
||||
[gd_scene load_steps=23 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"]
|
||||
|
@ -15,6 +15,7 @@
|
|||
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="10_sayqn"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"]
|
||||
[ext_resource type="Script" path="res://game/DebugTimer.gd" id="13_6ai3c"]
|
||||
[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
|
||||
|
@ -75,6 +76,23 @@ debug_color = Color(0, 0.6, 0.701961, 0)
|
|||
|
||||
[node name="Timer" type="Timer" parent="TimeSpawner"]
|
||||
|
||||
[node name="DebugSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||
position = Vector2(136, 0)
|
||||
scene = ExtResource("13_4j8om")
|
||||
target = NodePath("..")
|
||||
buffer_cap = 1
|
||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||
overlapping_body_count_limit = 128
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="NeckShape" type="CollisionShape2D" parent="DebugSpawner"]
|
||||
shape = SubResource("RectangleShape2D_4uksi")
|
||||
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||
|
||||
[node name="DebugTimer" type="Timer" parent="DebugSpawner"]
|
||||
wait_time = 0.017
|
||||
script = ExtResource("13_6ai3c")
|
||||
|
||||
[node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||
position = Vector2(136, 0)
|
||||
scene = ExtResource("13_4j8om")
|
||||
|
@ -169,4 +187,5 @@ debug_color = Color(0, 0, 0, 0.419608)
|
|||
|
||||
[connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"]
|
||||
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
|
||||
[connection signal="timeout" from="DebugSpawner/DebugTimer" to="DebugSpawner" method="spawn"]
|
||||
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]
|
||||
|
|
|
@ -38,3 +38,14 @@ func _on_shop_ui_purchase_cancel(_what: PurchasableItem):
|
|||
func _on_shop_ui_purchase_success(_what: PurchasableItem):
|
||||
spawn_button.disabled = false
|
||||
spawn_button.text = "Put"
|
||||
|
||||
|
||||
func _on_shop_ui_delete_begin():
|
||||
spawn_button.disabled = true
|
||||
spawn_button.text = "Del"
|
||||
spawn_button.modulate = Color.RED
|
||||
|
||||
func _on_shop_ui_delete_cancel():
|
||||
spawn_button.disabled = false
|
||||
spawn_button.text = "Put"
|
||||
spawn_button.modulate = Color.WHITE
|
||||
|
|
|
@ -6,9 +6,6 @@ class_name ShopUI
|
|||
## Emitted when the Score button is pressed.
|
||||
signal score_button_pressed
|
||||
|
||||
## Emitted when the Delete button is pressed.
|
||||
signal delete_button_pressed
|
||||
|
||||
## Emitted when the Back button is presesd.
|
||||
signal back_button_pressed
|
||||
|
||||
|
@ -74,9 +71,6 @@ func _on_game_score_changed(total: int):
|
|||
|
||||
func _on_score_button_pressed():
|
||||
score_button_pressed.emit()
|
||||
|
||||
func _on_delete_button_pressed():
|
||||
delete_button_pressed.emit()
|
||||
|
||||
func _on_back_button_pressed():
|
||||
back_button_pressed.emit()
|
||||
|
@ -151,3 +145,17 @@ func _on_buy_compressor_purchase_success():
|
|||
|
||||
func _on_buy_artifactomatic_purchase_success():
|
||||
print("[ShopUI] Completing Arti-factory...")
|
||||
|
||||
|
||||
var is_deleting = false
|
||||
|
||||
signal delete_begin
|
||||
signal delete_cancel
|
||||
|
||||
func _on_delete_button_pressed():
|
||||
if is_deleting:
|
||||
is_deleting = false
|
||||
delete_cancel.emit()
|
||||
else:
|
||||
is_deleting = true
|
||||
delete_begin.emit()
|
||||
|
|
9
main.gd
9
main.gd
|
@ -40,9 +40,6 @@ func _on_game_ui_score_button_pressed():
|
|||
func _on_shop_ui_back_button_pressed():
|
||||
ui_state = UIState.GAME
|
||||
|
||||
func _on_shop_ui_delete_button_pressed():
|
||||
ui_state = UIState.GAME
|
||||
|
||||
func _on_shop_ui_score_button_pressed():
|
||||
ui_state = UIState.SCORE
|
||||
|
||||
|
@ -51,3 +48,9 @@ func _on_game_ui_shop_button_pressed():
|
|||
|
||||
func _on_shop_ui_purchase_begin(_what):
|
||||
ui_state = UIState.GAME
|
||||
|
||||
func _on_shop_ui_delete_begin():
|
||||
ui_state = UIState.GAME
|
||||
|
||||
func _on_shop_ui_delete_cancel():
|
||||
ui_state = UIState.GAME
|
||||
|
|
|
@ -82,7 +82,11 @@ layout_mode = 2
|
|||
[connection signal="shop_button_pressed" from="CustomUI/GameSafeUI/GameUI" to="." method="_on_game_ui_shop_button_pressed"]
|
||||
[connection signal="spawn_button_pressed" from="CustomUI/GameSafeUI/GameUI" to="CustomUI/GameViewport/Viewport/Game" method="trigger_spawn"]
|
||||
[connection signal="back_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"]
|
||||
[connection signal="delete_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"]
|
||||
[connection signal="delete_begin" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_delete_begin"]
|
||||
[connection signal="delete_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_shop_ui_delete_begin"]
|
||||
[connection signal="delete_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_delete_begin"]
|
||||
[connection signal="delete_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_delete_cancel"]
|
||||
[connection signal="delete_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_delete_cancel"]
|
||||
[connection signal="ghost_materialize" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_ghost_materialize"]
|
||||
[connection signal="ghost_requested" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_ghost_requested"]
|
||||
[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
|
||||
|
|
|
@ -25,6 +25,14 @@ window/size/mode=2
|
|||
window/stretch/aspect="keep_height"
|
||||
window/handheld/orientation=1
|
||||
|
||||
[input]
|
||||
|
||||
turbo={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194308,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="Default"
|
||||
|
|
Loading…
Reference in a new issue