mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-21 15:24:18 +00:00
Limit deletion to single converter
This commit is contained in:
parent
2efdb5ebee
commit
3b27e8a269
10 changed files with 22 additions and 15 deletions
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
|
@ -5,6 +5,7 @@
|
||||||
"**/*.tres": true,
|
"**/*.tres": true,
|
||||||
"**/*.tscn": true,
|
"**/*.tscn": true,
|
||||||
"**/*.import": true,
|
"**/*.import": true,
|
||||||
|
"**/*.png": true,
|
||||||
},
|
},
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.gdignore": "ignore",
|
"*.gdignore": "ignore",
|
||||||
|
|
|
@ -40,7 +40,7 @@ func ending_deletion():
|
||||||
sprite_front.modulate = Color.WHITE
|
sprite_front.modulate = Color.WHITE
|
||||||
is_pending_deletion = false
|
is_pending_deletion = false
|
||||||
|
|
||||||
func _input(event: InputEvent):
|
func _on_input_event(viewport: Node, event: InputEvent, shape_idx: int):
|
||||||
if is_pending_deletion:
|
if is_pending_deletion:
|
||||||
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
if event is InputEventMouseButton or event is InputEventScreenTouch:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
@ -136,5 +136,6 @@ stream = ExtResource("11_r8505")
|
||||||
|
|
||||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_5qhgs")]
|
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_5qhgs")]
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="goal" from="Collector" to="." method="_on_collector_goal"]
|
[connection signal="goal" from="Collector" to="." method="_on_collector_goal"]
|
||||||
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout"]
|
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout"]
|
||||||
|
|
|
@ -144,6 +144,7 @@ stream = ExtResource("11_5c46k")
|
||||||
|
|
||||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_xld3l")]
|
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_xld3l")]
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18]
|
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18]
|
||||||
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18]
|
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18]
|
||||||
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]
|
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]
|
||||||
|
|
|
@ -148,6 +148,7 @@ stream = ExtResource("12_vklpo")
|
||||||
|
|
||||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("13_6o73w")]
|
[node name="ConverterPlacementBody" parent="." instance=ExtResource("13_6o73w")]
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18]
|
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18]
|
||||||
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18]
|
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18]
|
||||||
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]
|
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]
|
||||||
|
|
|
@ -227,6 +227,7 @@ frame_progress = 0.228399
|
||||||
|
|
||||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("17_udaa3")]
|
[node name="ConverterPlacementBody" parent="." instance=ExtResource("17_udaa3")]
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18]
|
[connection signal="collected" from="Collector" to="." method="_on_collector_collected" flags=18]
|
||||||
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18]
|
[connection signal="goal" from="Collector" to="." method="_on_collector_goal" flags=18]
|
||||||
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]
|
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout" flags=18]
|
||||||
|
|
|
@ -122,6 +122,7 @@ stream = ExtResource("11_ow0vy")
|
||||||
|
|
||||||
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_37x2h")]
|
[node name="ConverterPlacementBody" parent="." instance=ExtResource("12_37x2h")]
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
||||||
[connection signal="collected" from="Collector" to="." method="_on_collector_collected"]
|
[connection signal="collected" from="Collector" to="." method="_on_collector_collected"]
|
||||||
[connection signal="goal" from="Collector" to="." method="_on_collector_goal"]
|
[connection signal="goal" from="Collector" to="." method="_on_collector_goal"]
|
||||||
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout"]
|
[connection signal="timeout" from="ConversionTimer" to="." method="_on_timer_timeout"]
|
||||||
|
|
|
@ -35,6 +35,7 @@ func _on_purchase_begin(what: PurchasableItem):
|
||||||
print("[Game] Beginning purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
|
print("[Game] Beginning purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
|
||||||
store_collector.collecting_types = [what.item_cost_type]
|
store_collector.collecting_types = [what.item_cost_type]
|
||||||
store_collector.collecting_amount = what.item_cost_goal
|
store_collector.collecting_amount = what.item_cost_goal
|
||||||
|
store_collector.collected_count = 0
|
||||||
store_collector.goal.connect(_handle_purchase_success.bind(what))
|
store_collector.goal.connect(_handle_purchase_success.bind(what))
|
||||||
update_counter_icon()
|
update_counter_icon()
|
||||||
update_counter_text()
|
update_counter_text()
|
||||||
|
|
|
@ -67,7 +67,7 @@ position = Vector2(136, 0)
|
||||||
target = NodePath("..")
|
target = NodePath("..")
|
||||||
buffer_cap = 1
|
buffer_cap = 1
|
||||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
overlapping_body_count_limit = 4
|
overlapping_body_count_limit = 16
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"]
|
[node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"]
|
||||||
|
@ -99,7 +99,7 @@ scene = ExtResource("13_4j8om")
|
||||||
target = NodePath("..")
|
target = NodePath("..")
|
||||||
buffer_cap = 10
|
buffer_cap = 10
|
||||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
overlapping_body_count_limit = 4
|
overlapping_body_count_limit = 16
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"]
|
[node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"]
|
||||||
|
|
|
@ -39,20 +39,14 @@ func _on_any_purchase_begin(what: Node):
|
||||||
if what.item_scene:
|
if what.item_scene:
|
||||||
ghost_requested.emit(what.item_scene, what.item_icon)
|
ghost_requested.emit(what.item_scene, what.item_icon)
|
||||||
purchase_begin.emit(what)
|
purchase_begin.emit(what)
|
||||||
for item in purchasable_items:
|
set_all_can_buy(false, what)
|
||||||
if item == what:
|
|
||||||
continue
|
|
||||||
item.can_buy = false
|
|
||||||
|
|
||||||
func _on_any_purchase_cancel(what: Node):
|
func _on_any_purchase_cancel(what: Node):
|
||||||
if not what is PurchasableItem:
|
if not what is PurchasableItem:
|
||||||
push_error("Purchase cancelled outside a PurchasableItem")
|
push_error("Purchase cancelled outside a PurchasableItem")
|
||||||
return
|
return
|
||||||
purchase_cancel.emit(what)
|
purchase_cancel.emit(what)
|
||||||
for item in purchasable_items:
|
set_all_can_buy(true, what)
|
||||||
if item == what:
|
|
||||||
continue
|
|
||||||
item.can_buy = true
|
|
||||||
|
|
||||||
func _on_any_purchase_success(what: Node):
|
func _on_any_purchase_success(what: Node):
|
||||||
if not what is PurchasableItem:
|
if not what is PurchasableItem:
|
||||||
|
@ -61,10 +55,7 @@ func _on_any_purchase_success(what: Node):
|
||||||
if what.item_scene:
|
if what.item_scene:
|
||||||
ghost_materialize.emit()
|
ghost_materialize.emit()
|
||||||
purchase_success.emit(what)
|
purchase_success.emit(what)
|
||||||
for item in purchasable_items:
|
set_all_can_buy(true, what)
|
||||||
if item == what:
|
|
||||||
continue
|
|
||||||
item.can_buy = true
|
|
||||||
|
|
||||||
func _on_game_score_changed(total: int):
|
func _on_game_score_changed(total: int):
|
||||||
score_button.set_score(total)
|
score_button.set_score(total)
|
||||||
|
@ -159,9 +150,18 @@ func _on_delete_button_pressed():
|
||||||
is_deleting = false
|
is_deleting = false
|
||||||
delete_button.text = "Del"
|
delete_button.text = "Del"
|
||||||
delete_button.modulate = Color.WHITE
|
delete_button.modulate = Color.WHITE
|
||||||
|
set_all_can_buy(true, null)
|
||||||
delete_cancel.emit()
|
delete_cancel.emit()
|
||||||
else:
|
else:
|
||||||
is_deleting = true
|
is_deleting = true
|
||||||
delete_button.text = "Undo"
|
delete_button.text = "Undo"
|
||||||
delete_button.modulate = Color.RED
|
delete_button.modulate = Color.RED
|
||||||
|
set_all_can_buy(false, null)
|
||||||
delete_begin.emit()
|
delete_begin.emit()
|
||||||
|
|
||||||
|
|
||||||
|
func set_all_can_buy(state: bool, except: PurchasableItem):
|
||||||
|
for item in purchasable_items:
|
||||||
|
if item == except:
|
||||||
|
continue
|
||||||
|
item.can_buy = state
|
||||||
|
|
Loading…
Reference in a new issue