Des changements de scènes sans bugs

du moins je l'espère!
This commit is contained in:
Thomas
2025-04-15 11:09:07 +02:00
parent 5e32ed4196
commit 9350825614
17 changed files with 278 additions and 97 deletions

View File

@@ -1,6 +1,8 @@
extends Node
var _game : GameControler
var _is_switiching = false
var _debug = false
var isUsingTouch = false
var hasChosenNotToMakeChoices = false
var hasChosenToMakeChoices = false
@@ -8,21 +10,34 @@ var hasCompletedBobDialogue = false
var hasMetBob = false
var hasVisitedBakery = false
var isPlayerDeaf = false
var vec_last_facing_direction = Vector2(0, 0)
var float_thomas_music_position = 0
var current_scene = "outside"
var position_outside = Vector2(-134.3333, -164.0905)
var position_bakery = Vector2(461, 710)
var position_bakery = Vector2(506.361, 843.8615)
func update_position(p: Vector2):
if _is_switiching:
if(_debug):
print("switching scene, not updating position")
return
match current_scene:
"outside":
position_outside = p
"bakery":
position_bakery = p
print (current_scene, " position ", p)
if(_debug):
print (current_scene, " position ", p)
func get_position_player():
match current_scene:
"outside":
return position_outside
"bakery":
return position_bakery
return Vector2(0, 0)
func save():
var ret = {}
@@ -47,9 +62,11 @@ func load_save(data:Dictionary):
continue
if propertyName.begins_with("is") or propertyName.begins_with("has"):
set(propertyName, data.get(propertyName) == "true")
elif propertyName.begins_with("position_"):
elif propertyName.begins_with("position_") or propertyName.begins_with("vec"):
var strplps = (data.get(propertyName) as String).replace("\"(", "").replace(")\"", "")
var parts = strplps.split(", ")
set(propertyName, Vector2(float(parts[0]), float(parts[1])))
elif propertyName.begins_with("float_"):
set(propertyName, float(data.get(propertyName)))
else:
set(propertyName, data.get(propertyName).lstrip("\"").rstrip("\""))