1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-25 00:54:19 +00:00

FIX FIX FIX

This commit is contained in:
Steffo 2023-10-02 23:56:28 +02:00
parent 4f240e1c7f
commit c90b99a9b3
Signed by: steffo
GPG key ID: 2A24051445686895
3 changed files with 12 additions and 30 deletions

View file

@ -35,7 +35,7 @@ package/app_category=2
package/retain_data_on_uninstall=false package/retain_data_on_uninstall=false
package/exclude_from_recents=false package/exclude_from_recents=false
launcher_icons/main_192x192="res://media/jar_icon.png" launcher_icons/main_192x192="res://media/jar_icon.png"
launcher_icons/adaptive_foreground_432x432="res://media/jar_icon.png" launcher_icons/adaptive_foreground_432x432=""
launcher_icons/adaptive_background_432x432="" launcher_icons/adaptive_background_432x432=""
graphics/opengl_debug=false graphics/opengl_debug=false
xr_features/xr_mode=0 xr_features/xr_mode=0

View file

@ -43,9 +43,6 @@ var can_place: bool:
## The last input event of the input that's dragging the ghost around, or null if the ghost isn't being dragged. ## The last input event of the input that's dragging the ghost around, or null if the ghost isn't being dragged.
var last_input_event: InputEvent var last_input_event: InputEvent
## The last alternate input event.
var last_alternate_event: InputEvent
func _ready(): func _ready():
collision_mask = collision_mask_prevent_placement | collision_mask_delete_placement collision_mask = collision_mask_prevent_placement | collision_mask_delete_placement
@ -58,30 +55,8 @@ func _input(event: InputEvent):
last_input_event = event if event.pressed else null last_input_event = event if event.pressed else null
# Handle touch begin # Handle touch begin
elif event is InputEventScreenTouch: elif event is InputEventScreenTouch:
print("Event: ", event) last_input_event = event if event.pressed else null
print("Last: ", last_input_event)
print("Alt: ", last_alternate_event)
if not last_input_event:
last_input_event = event if event.pressed else null
elif event.index == last_input_event.index:
last_input_event = event if event.pressed else null
last_alternate_event = null
else:
last_alternate_event = event if event.pressed else null
# If is pinching
if last_alternate_event:
if event.index == last_input_event.index:
var last_vector: Vector2 = last_alternate_event.position - last_input_event.position
var vector: Vector2 = last_alternate_event.position - event.position
var angle = vector.angle_to(last_vector)
rotation += angle
else:
var last_vector: Vector2 = last_alternate_event.position - last_input_event.position
var vector: Vector2 = event.position - last_input_event.position
var angle = vector.angle_to(last_vector)
rotation += angle
# If is dragging # If is dragging
elif last_input_event: elif last_input_event:
# Handle mouse drag # Handle mouse drag
@ -95,8 +70,6 @@ func _input(event: InputEvent):
var delta = event.position - last_input_event.position var delta = event.position - last_input_event.position
position += delta position += delta
last_input_event = event last_input_event = event
else:
last_alternate_event = event
## Update the value of [can_place]. ## Update the value of [can_place].
# DIRTY HACK: Relies on the placeable area being perfectly surrounded by solid bodies. # DIRTY HACK: Relies on the placeable area being perfectly surrounded by solid bodies.

View file

@ -56,7 +56,7 @@ func _on_any_purchase_success(what: Node):
return return
if what.item_scene: if what.item_scene:
ghost_materialize.emit() ghost_materialize.emit()
delete_button.disabled = false delete_button.disabled = false
purchase_success.emit(what) purchase_success.emit(what)
set_all_can_buy(true, what) set_all_can_buy(true, what)
@ -80,30 +80,36 @@ signal upgraded_auto_spawn(scene: PackedScene, period: float)
func _on_buy_auto_copper_purchase_success(): func _on_buy_auto_copper_purchase_success():
print("[ShopUI] Upgrading to Auto Copper * 2...") print("[ShopUI] Upgrading to Auto Copper * 2...")
upgraded_auto_spawn.emit(copper_coin_scene, 0.5) upgraded_auto_spawn.emit(copper_coin_scene, 0.5)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoCopper.has_unlocked = false
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyHeliCopper.has_unlocked = true $Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyHeliCopper.has_unlocked = true
func _on_buy_heli_copper_purchase_success(): func _on_buy_heli_copper_purchase_success():
print("[ShopUI] Upgrading to Auto Copper * 8...") print("[ShopUI] Upgrading to Auto Copper * 8...")
upgraded_auto_spawn.emit(copper_coin_scene, 0.125) upgraded_auto_spawn.emit(copper_coin_scene, 0.125)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyHeliCopper.has_unlocked = false
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoSilver.has_unlocked = true $Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoSilver.has_unlocked = true
func _on_buy_auto_silver_purchase_success(): func _on_buy_auto_silver_purchase_success():
print("[ShopUI] Upgrading to Auto Silver * 2...") print("[ShopUI] Upgrading to Auto Silver * 2...")
upgraded_auto_spawn.emit(silver_coin_scene, 0.5) upgraded_auto_spawn.emit(silver_coin_scene, 0.5)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoSilver.has_unlocked = false
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuySuperSilver.has_unlocked = true $Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuySuperSilver.has_unlocked = true
func _on_buy_super_silver_purchase_success(): func _on_buy_super_silver_purchase_success():
print("[ShopUI] Upgrading to Auto Silver * 8...") print("[ShopUI] Upgrading to Auto Silver * 8...")
upgraded_auto_spawn.emit(silver_coin_scene, 0.125) upgraded_auto_spawn.emit(silver_coin_scene, 0.125)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuySuperSilver.has_unlocked = false
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoGold.has_unlocked = true $Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoGold.has_unlocked = true
func _on_buy_auto_gold_purchase_success(): func _on_buy_auto_gold_purchase_success():
print("[ShopUI] Upgrading to Auto Gold * 2...") print("[ShopUI] Upgrading to Auto Gold * 2...")
upgraded_auto_spawn.emit(gold_coin_scene, 0.5) upgraded_auto_spawn.emit(gold_coin_scene, 0.5)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoGold.has_unlocked = false
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyMidasTouch.has_unlocked = true $Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyMidasTouch.has_unlocked = true
func _on_buy_midas_touch_purchase_success(): func _on_buy_midas_touch_purchase_success():
print("[ShopUI] Upgrading to Auto Gold * 8...") print("[ShopUI] Upgrading to Auto Gold * 8...")
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyMidasTouch.has_unlocked = false
upgraded_auto_spawn.emit(gold_coin_scene, 0.125) upgraded_auto_spawn.emit(gold_coin_scene, 0.125)
@ -112,10 +118,13 @@ signal upgraded_manual_spawn(scene: PackedScene)
func _on_buy_silver_star_purchase_success(): func _on_buy_silver_star_purchase_success():
print("[ShopUI] Upgrading to Manual Silver...") print("[ShopUI] Upgrading to Manual Silver...")
upgraded_manual_spawn.emit(silver_coin_scene) upgraded_manual_spawn.emit(silver_coin_scene)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory/BuySilverStar.has_unlocked = false
$Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory/BuyGoldStar.has_unlocked = true
func _on_buy_gold_star_purchase_success(): func _on_buy_gold_star_purchase_success():
print("[ShopUI] Upgrading to Manual Gold...") print("[ShopUI] Upgrading to Manual Gold...")
upgraded_manual_spawn.emit(gold_coin_scene) upgraded_manual_spawn.emit(gold_coin_scene)
$Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory/BuyGoldStar.has_unlocked = false
signal ghost_materialize signal ghost_materialize