Des changements de scènes sans bugs
du moins je l'espère!
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
extends Control
|
||||
|
||||
var destination_map = {
|
||||
"oustide":preload("res://scenes/outside.tscn"),
|
||||
}
|
||||
|
||||
signal start
|
||||
signal save
|
||||
signal load
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
extends TileMapLayer
|
||||
|
||||
func do_trap():
|
||||
GameState.position_bakery = Vector2(506.361, 843.8615)
|
||||
GameState._game.switch_to("bakery")
|
||||
GameState.hasVisitedBakery = true
|
||||
|
||||
@@ -17,6 +17,7 @@ var humanInteractionTarget: Human = null
|
||||
var interactionClueFor : Human
|
||||
var interactionPaused= false
|
||||
var kill_path_finder = false
|
||||
var pause_everything = true
|
||||
|
||||
signal start_intracting
|
||||
signal loadFromGameState
|
||||
@@ -35,7 +36,8 @@ func face(whereToFace: Vector2) -> void:
|
||||
last_facing_direction = (whereToFace - global_position).normalized()
|
||||
|
||||
func decideAction() -> void:
|
||||
pass
|
||||
if pause_everything:
|
||||
return
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if interactionPaused and interactionClueFor:
|
||||
@@ -59,6 +61,10 @@ func _physics_process(delta):
|
||||
if state_machine.get_current_node() == "grabing" or humanInteractionTarget != null :
|
||||
velocity = Vector2(0,0);
|
||||
|
||||
|
||||
if pause_everything:
|
||||
velocity = Vector2(0,0);
|
||||
|
||||
# move the caracter
|
||||
move_and_slide()
|
||||
|
||||
@@ -115,3 +121,12 @@ func _on_load_from_game_state() -> void:
|
||||
emit_signal("loadFromGameState")
|
||||
feetSound.play()
|
||||
feetSound.stream_paused = true
|
||||
|
||||
|
||||
func _on_pause_game() -> void:
|
||||
pause_everything = true
|
||||
|
||||
|
||||
func _on_resume_game() -> void:
|
||||
pause_everything = false
|
||||
_on_load_from_game_state()
|
||||
|
||||
@@ -102,7 +102,6 @@ autoplay = true
|
||||
bus = &"player_foot_step"
|
||||
playback_type = 1
|
||||
|
||||
[connection signal="loadFromGameState" from="." to="controleur" method="_on_character_body_2d_load_from_game_state"]
|
||||
[connection signal="area_entered" from="Area2D" to="." method="_on_area_2d_area_entered"]
|
||||
[connection signal="area_entered" from="Area2D" to="controleur" method="_on_declencheur"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
|
||||
@@ -26,10 +26,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
human.velocityVector = Vector2(0, 0)
|
||||
human.wants_to_grab = false
|
||||
human.wants_to_interact_with = null
|
||||
if human.pause_everything:
|
||||
return
|
||||
human.velocityVector = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||
if human.velocityVector != Vector2(0, 0):
|
||||
GameState.isUsingTouch = false
|
||||
update_game_state()
|
||||
|
||||
if event.is_action_pressed("grab"):
|
||||
if can_interact_with:
|
||||
@@ -45,9 +46,15 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
pathFinder.destination = get_global_mouse_position()
|
||||
|
||||
func update_game_state():
|
||||
if human.pause_everything:
|
||||
return
|
||||
GameState.update_position(human.get_feet_global_position())
|
||||
GameState.vec_last_facing_direction = human.last_facing_direction
|
||||
|
||||
func _process(delta) -> void:
|
||||
if human.pause_everything:
|
||||
return
|
||||
update_game_state()
|
||||
ray.target_position = human.last_facing_direction * 48
|
||||
|
||||
if human.last_facing_direction.y > 0 :
|
||||
@@ -102,12 +109,11 @@ func _process(delta) -> void:
|
||||
can_interact_with.enable_interaction_clue(human)
|
||||
|
||||
func _on_area_2d_body_entered(body: Node2D) -> void:
|
||||
if human.pause_everything:
|
||||
return
|
||||
if body.has_method("do_trap") :
|
||||
human.kill_path_finder = true
|
||||
body.do_trap()
|
||||
|
||||
func _on_area_2d_body_exited(body: Node2D) -> void:
|
||||
pass
|
||||
|
||||
func _on_character_body_2d_load_from_game_state() -> void:
|
||||
human.set_feet_global_position(GameState.position_outside)
|
||||
|
||||
@@ -34,7 +34,7 @@ progressive_web_app/enabled=false
|
||||
progressive_web_app/ensure_cross_origin_isolation_headers=true
|
||||
progressive_web_app/offline_page=""
|
||||
progressive_web_app/display=1
|
||||
progressive_web_app/orientation=0
|
||||
progressive_web_app/orientation=1
|
||||
progressive_web_app/icon_144x144=""
|
||||
progressive_web_app/icon_180x180=""
|
||||
progressive_web_app/icon_512x512=""
|
||||
|
||||
@@ -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,22 +10,35 @@ 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
|
||||
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 = {}
|
||||
var thisScript: GDScript = get_script()
|
||||
@@ -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("\""))
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
signal loadFromGameState
|
||||
signal unloadFromScreen
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
load_from_game_state()
|
||||
|
||||
func load_from_game_state():
|
||||
print("setting player in bakery at ", GameState.position_bakery)
|
||||
$Bakery/player.set_feet_global_position(GameState.position_bakery)
|
||||
emit_signal("loadFromGameState")
|
||||
|
||||
func unload():
|
||||
emit_signal("unloadFromScreen")
|
||||
@@ -1,14 +0,0 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ditxepapl5asy"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/bakery.gd" id="1_ke1bh"]
|
||||
[ext_resource type="PackedScene" uid="uid://bu8ahxrceky0t" path="res://maps/bakery_interior.tscn" id="2_5t2dq"]
|
||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="3_tsy4v"]
|
||||
|
||||
[node name="bakery" type="Node2D"]
|
||||
script = ExtResource("1_ke1bh")
|
||||
|
||||
[node name="Bakery" parent="." instance=ExtResource("2_5t2dq")]
|
||||
position = Vector2(64, 92)
|
||||
|
||||
[node name="player" parent="Bakery" instance=ExtResource("3_tsy4v")]
|
||||
position = Vector2(458, 718)
|
||||
@@ -10,9 +10,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
# list of scenes
|
||||
var outside:Node2D = null
|
||||
var dest_outside = preload("res://scenes/outside.tscn")
|
||||
var dest_outside = preload("res://scenes/scene_outside.tscn")
|
||||
var bakery:Node2D = null
|
||||
var dest_bakery = preload("res://scenes/bakery_interior.tscn")
|
||||
var dest_bakery = preload("res://scenes/scene_bakery_interior.tscn")
|
||||
var menu = null
|
||||
var prev_scene = null
|
||||
|
||||
@@ -32,9 +32,12 @@ var toMenu = false;
|
||||
var switching_to
|
||||
|
||||
func switch_scene(to: String):
|
||||
GameState._is_switiching = true
|
||||
switching_to= to
|
||||
print("switching to", switching_to)
|
||||
print("switching to ", switching_to)
|
||||
toMenu = to == "menu"
|
||||
if !toMenu:
|
||||
GameState.current_scene = switching_to
|
||||
match to:
|
||||
"outside":
|
||||
if outside == null:
|
||||
@@ -46,11 +49,11 @@ func switch_scene(to: String):
|
||||
next_scene = bakery
|
||||
"menu":
|
||||
next_scene = menu
|
||||
if prev_scene != menu:
|
||||
prev_scene.pause()
|
||||
$TransitionShader.fade_out()
|
||||
|
||||
func init_scence(scene):
|
||||
scene.load_from_game_state()
|
||||
$TransitionShader.fade_in()
|
||||
|
||||
|
||||
func open_menu():
|
||||
switch_scene("menu")
|
||||
@@ -72,17 +75,19 @@ func save_game():
|
||||
save_file.close()
|
||||
|
||||
func _on_transition_shader_fade_in_done() -> void:
|
||||
if next_scene != menu:
|
||||
next_scene.resume()
|
||||
GameState._is_switiching = false
|
||||
prev_scene = next_scene
|
||||
|
||||
func init_scence(scene):
|
||||
if !toMenu:
|
||||
GameState.current_scene = switching_to
|
||||
scene.load_from_game_state()
|
||||
$TransitionShader.fade_in()
|
||||
|
||||
func _on_transition_shader_fade_out_done() -> void:
|
||||
print("fade out done")
|
||||
if !toMenu:
|
||||
next_scene.unload()
|
||||
call_deferred("add_child", next_scene)
|
||||
if prev_scene != menu:
|
||||
prev_scene.unload()
|
||||
call_deferred("remove_child", prev_scene)
|
||||
if !toMenu:
|
||||
call_deferred("add_child", next_scene)
|
||||
call_deferred("init_scence", next_scene)
|
||||
else:
|
||||
$TransitionShader.fade_in()
|
||||
prev_scene = next_scene
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
extends Node2D
|
||||
|
||||
signal loadFromGameState
|
||||
signal unloadFromScreen
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
load_from_game_state()
|
||||
|
||||
func load_from_game_state():
|
||||
emit_signal("loadFromGameState")
|
||||
|
||||
func unload():
|
||||
emit_signal("unloadFromScreen")
|
||||
@@ -1,13 +1,13 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b4ydi1vv8dvwr"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/outside.gd" id="1_wyh83"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/map.tscn" id="1_ysg4m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bleadp4yrdgj" path="res://caracters/bob/bob.tscn" id="2_vbahy"]
|
||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="3_bt1tp"]
|
||||
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="4_dt4vq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="5_4nlh0"]
|
||||
[ext_resource type="PackedScene" uid="uid://bh636kqo4rhy3" path="res://caracters/musicians/Thomas.tscn" id="7_7urlf"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjxpn0cukd6vo" path="res://caracters/musicians/mike.tscn" id="8_eenai"]
|
||||
[ext_resource type="Script" path="res://scenes/scene.gd" id="1_02n2r"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/map.tscn" id="2_rr7is"]
|
||||
[ext_resource type="PackedScene" uid="uid://bleadp4yrdgj" path="res://caracters/bob/bob.tscn" id="3_vh8rr"]
|
||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="4_rjwf4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="5_24ud7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="6_nm50p"]
|
||||
[ext_resource type="PackedScene" uid="uid://bh636kqo4rhy3" path="res://caracters/musicians/Thomas.tscn" id="7_a2x2y"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjxpn0cukd6vo" path="res://caracters/musicians/mike.tscn" id="8_uk0jy"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_shblg"]
|
||||
_data = {
|
||||
@@ -21,15 +21,16 @@ _data = {
|
||||
}
|
||||
point_count = 20
|
||||
|
||||
[node name="outside" type="Node2D"]
|
||||
script = ExtResource("1_wyh83")
|
||||
[node name="outside" type="Node2D" node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("1_02n2r")
|
||||
player = NodePath("world/player")
|
||||
|
||||
[node name="world" parent="." instance=ExtResource("1_ysg4m")]
|
||||
[node name="world" parent="." instance=ExtResource("2_rr7is")]
|
||||
|
||||
[node name="bob" parent="world" instance=ExtResource("2_vbahy")]
|
||||
[node name="bob" parent="world" instance=ExtResource("3_vh8rr")]
|
||||
position = Vector2(-333, -262)
|
||||
|
||||
[node name="player" parent="world" instance=ExtResource("3_bt1tp")]
|
||||
[node name="player" parent="world" instance=ExtResource("4_rjwf4")]
|
||||
position = Vector2(-171, -253)
|
||||
|
||||
[node name="movibles" type="Node2D" parent="."]
|
||||
@@ -40,37 +41,36 @@ position = Vector2(-171, -253)
|
||||
position = Vector2(-664, 181)
|
||||
curve = SubResource("Curve2D_shblg")
|
||||
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D" node_paths=PackedStringArray("car", "world") instance=ExtResource("4_dt4vq")]
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D" node_paths=PackedStringArray("car", "world") instance=ExtResource("5_24ud7")]
|
||||
position = Vector2(-285, 193)
|
||||
car = NodePath("../Car")
|
||||
distanceMax = 400
|
||||
world = NodePath("../../../../world")
|
||||
|
||||
[node name="Car" parent="movibles/cars/Path2D" instance=ExtResource("5_4nlh0")]
|
||||
[node name="Car" parent="movibles/cars/Path2D" instance=ExtResource("6_nm50p")]
|
||||
position = Vector2(-287, 196)
|
||||
speed = 500
|
||||
|
||||
[node name="Path2D2" type="Path2D" parent="movibles/cars"]
|
||||
curve = SubResource("Curve2D_nircx")
|
||||
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D2" node_paths=PackedStringArray("car", "world") instance=ExtResource("4_dt4vq")]
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D2" node_paths=PackedStringArray("car", "world") instance=ExtResource("5_24ud7")]
|
||||
position = Vector2(794, 1374)
|
||||
car = NodePath("../Car")
|
||||
distanceMax = 400
|
||||
world = NodePath("../../../../world")
|
||||
|
||||
[node name="Car" parent="movibles/cars/Path2D2" instance=ExtResource("5_4nlh0")]
|
||||
[node name="Car" parent="movibles/cars/Path2D2" instance=ExtResource("6_nm50p")]
|
||||
position = Vector2(790, 1372)
|
||||
speed = 500
|
||||
|
||||
[node name="Thomas" parent="." instance=ExtResource("7_7urlf")]
|
||||
[node name="Thomas" parent="." instance=ExtResource("7_a2x2y")]
|
||||
z_index = 2001
|
||||
position = Vector2(-199, -484)
|
||||
|
||||
[node name="Thomas2" parent="." instance=ExtResource("8_eenai")]
|
||||
[node name="Thomas2" parent="." instance=ExtResource("8_uk0jy")]
|
||||
z_index = 2001
|
||||
position = Vector2(-142, -510)
|
||||
|
||||
[connection signal="loadFromGameState" from="." to="world/player" method="_on_load_from_game_state"]
|
||||
[connection signal="loadFromGameState" from="." to="Thomas" method="_on_load_from_game_state"]
|
||||
[connection signal="unloadFromScreen" from="." to="Thomas" method="_on_outside_unload_from_screen"]
|
||||
76
scenes/sceAB28.tmp
Normal file
76
scenes/sceAB28.tmp
Normal file
@@ -0,0 +1,76 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b4ydi1vv8dvwr"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/scene.gd" id="1_02n2r"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/map.tscn" id="2_rr7is"]
|
||||
[ext_resource type="PackedScene" uid="uid://bleadp4yrdgj" path="res://caracters/bob/bob.tscn" id="3_vh8rr"]
|
||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="4_rjwf4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="5_24ud7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="6_nm50p"]
|
||||
[ext_resource type="PackedScene" uid="uid://bh636kqo4rhy3" path="res://caracters/musicians/Thomas.tscn" id="7_a2x2y"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjxpn0cukd6vo" path="res://caracters/musicians/mike.tscn" id="8_uk0jy"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_shblg"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, -285, 193, -24.1571, -83.6138, 24.1571, 83.6138, -220, 253, -59.9683, -76.1091, 59.9683, 76.1091, -200, 1158, -72.4586, -10.5935, 72.4586, 10.5935, 2570, 1182, -96.6533, 37.8814, 96.6533, -37.8814, 2646, 173, -98.6077, 103.694, 98.6077, -103.694, 2759, 110, 117.462, 37.6927, -117.462, -37.6927, 2715, -276, 114.239, -35.1712, -114.239, 35.1712, 2384, -293, 50.2246, -13.5362, -50.2246, 13.5362, 2209, -126, 61.4659, 8.33138, -61.4659, -8.33138, 133, -135, 40.4345, 62.8385, -40.4345, -62.8385, 40, -272, 50.2081, -75.7177, -50.2081, 75.7177, -399, -242, -67.7454, -78.8949, 67.7454, 78.8949, -399, 107, 0, 0, 0, 0, -286, 193, 0, 0, 0, 0, -285, 193)
|
||||
}
|
||||
point_count = 15
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_nircx"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 794, 1374, 0, 0, 0, 0, 1938, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2086, -88, 0, 0, 0, 0, 1656, -97, 0, 0, 0, 0, 1649, 73, 0, 0, 0, 0, 912.469, 60.5339, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -885, -108, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1073, 283, 0, 0, 0, 0, -912.429, 290.552, 0, 0, 0, 0, -624, 293, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, -577, 160, 0, 0, 0, 0, 823, 165, 0, 0, 0, 0, 802, 305, 0, 0, 0, 0, 790, 1374)
|
||||
}
|
||||
point_count = 20
|
||||
|
||||
[node name="outside" type="Node2D" node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("1_02n2r")
|
||||
player = NodePath("world/player")
|
||||
|
||||
[node name="world" parent="." instance=ExtResource("2_rr7is")]
|
||||
|
||||
[node name="bob" parent="world" instance=ExtResource("3_vh8rr")]
|
||||
position = Vector2(-333, -262)
|
||||
|
||||
[node name="player" parent="world" instance=ExtResource("4_rjwf4")]
|
||||
position = Vector2(-171, -253)
|
||||
|
||||
[node name="movibles" type="Node2D" parent="."]
|
||||
|
||||
[node name="cars" type="Node" parent="movibles"]
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="movibles/cars"]
|
||||
position = Vector2(-664, 181)
|
||||
curve = SubResource("Curve2D_shblg")
|
||||
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D" node_paths=PackedStringArray("car", "world") instance=ExtResource("5_24ud7")]
|
||||
position = Vector2(-285, 193)
|
||||
car = NodePath("../Car")
|
||||
distanceMax = 400
|
||||
world = NodePath("../../../../world")
|
||||
|
||||
[node name="Car" parent="movibles/cars/Path2D" instance=ExtResource("6_nm50p")]
|
||||
position = Vector2(-287, 196)
|
||||
speed = 500
|
||||
|
||||
[node name="Path2D2" type="Path2D" parent="movibles/cars"]
|
||||
curve = SubResource("Curve2D_nircx")
|
||||
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D2" node_paths=PackedStringArray("car", "world") instance=ExtResource("5_24ud7")]
|
||||
position = Vector2(794, 1374)
|
||||
car = NodePath("../Car")
|
||||
distanceMax = 400
|
||||
world = NodePath("../../../../world")
|
||||
|
||||
[node name="Car" parent="movibles/cars/Path2D2" instance=ExtResource("6_nm50p")]
|
||||
position = Vector2(790, 1372)
|
||||
speed = 500
|
||||
|
||||
[node name="Thomas" parent="." instance=ExtResource("7_a2x2y")]
|
||||
z_index = 2001
|
||||
position = Vector2(-199, -484)
|
||||
|
||||
[node name="Thomas2" parent="." instance=ExtResource("8_uk0jy")]
|
||||
z_index = 2001
|
||||
position = Vector2(-142, -510)
|
||||
|
||||
[connection signal="loadFromGameState" from="." to="Thomas" method="_on_load_from_game_state"]
|
||||
[connection signal="unloadFromScreen" from="." to="Thomas" method="_on_outside_unload_from_screen"]
|
||||
21
scenes/scene.gd
Normal file
21
scenes/scene.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Node2D
|
||||
|
||||
signal loadFromGameState
|
||||
signal unloadFromScreen
|
||||
|
||||
@export var player : Human
|
||||
|
||||
func load_from_game_state():
|
||||
print("setting player in ", GameState.current_scene, " at ",GameState.get_position_player())
|
||||
player.set_feet_global_position(GameState.get_position_player())
|
||||
player.last_facing_direction = GameState.vec_last_facing_direction
|
||||
emit_signal("loadFromGameState")
|
||||
|
||||
func unload():
|
||||
emit_signal("unloadFromScreen")
|
||||
|
||||
func pause():
|
||||
player._on_pause_game()
|
||||
|
||||
func resume():
|
||||
player._on_resume_game()
|
||||
15
scenes/scene_bakery_interior.tscn
Normal file
15
scenes/scene_bakery_interior.tscn
Normal file
@@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://ditxepapl5asy"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/scene.gd" id="1_xt0wx"]
|
||||
[ext_resource type="PackedScene" uid="uid://bu8ahxrceky0t" path="res://maps/bakery_interior.tscn" id="2_4pfep"]
|
||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="3_f6ale"]
|
||||
|
||||
[node name="bakery" type="Node2D" node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("1_xt0wx")
|
||||
player = NodePath("Bakery/player")
|
||||
|
||||
[node name="Bakery" parent="." instance=ExtResource("2_4pfep")]
|
||||
position = Vector2(64, 92)
|
||||
|
||||
[node name="player" parent="Bakery" instance=ExtResource("3_f6ale")]
|
||||
position = Vector2(458, 718)
|
||||
76
scenes/scene_outside.tscn
Normal file
76
scenes/scene_outside.tscn
Normal file
@@ -0,0 +1,76 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://b4ydi1vv8dvwr"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/scene.gd" id="1_02n2r"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1oqt6sbjvopi" path="res://maps/map.tscn" id="2_rr7is"]
|
||||
[ext_resource type="PackedScene" uid="uid://bleadp4yrdgj" path="res://caracters/bob/bob.tscn" id="3_vh8rr"]
|
||||
[ext_resource type="PackedScene" uid="uid://vclpg4e4ql54" path="res://caracters/player/player.tscn" id="4_rjwf4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cl201baro5y5" path="res://vehicules/npc_car.tscn" id="5_24ud7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bt1p311rn1h6q" path="res://vehicules/car.tscn" id="6_nm50p"]
|
||||
[ext_resource type="PackedScene" uid="uid://bh636kqo4rhy3" path="res://caracters/musicians/Thomas.tscn" id="7_a2x2y"]
|
||||
[ext_resource type="PackedScene" uid="uid://cjxpn0cukd6vo" path="res://caracters/musicians/mike.tscn" id="8_uk0jy"]
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_shblg"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, -285, 193, -24.1571, -83.6138, 24.1571, 83.6138, -220, 253, -59.9683, -76.1091, 59.9683, 76.1091, -200, 1158, -72.4586, -10.5935, 72.4586, 10.5935, 2570, 1182, -96.6533, 37.8814, 96.6533, -37.8814, 2646, 173, -98.6077, 103.694, 98.6077, -103.694, 2759, 110, 117.462, 37.6927, -117.462, -37.6927, 2715, -276, 114.239, -35.1712, -114.239, 35.1712, 2384, -293, 50.2246, -13.5362, -50.2246, 13.5362, 2209, -126, 61.4659, 8.33138, -61.4659, -8.33138, 133, -135, 40.4345, 62.8385, -40.4345, -62.8385, 40, -272, 50.2081, -75.7177, -50.2081, 75.7177, -399, -242, -67.7454, -78.8949, 67.7454, 78.8949, -399, 107, 0, 0, 0, 0, -286, 193, 0, 0, 0, 0, -285, 193)
|
||||
}
|
||||
point_count = 15
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_nircx"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 794, 1374, 0, 0, 0, 0, 1938, 1371, 0, 0, 0, 0, 1931, 342, 0, 0, 0, 0, 2082, 333, 0, 0, 0, 0, 2086, -88, 0, 0, 0, 0, 1656, -97, 0, 0, 0, 0, 1649, 73, 0, 0, 0, 0, 912.469, 60.5339, 0, 0, 0, 0, 904, -1165, 0, 0, 0, 0, -890, -1162, 0, 0, 0, 0, -885, -108, 0, 0, 0, 0, -1062, -106, 0, 0, 0, 0, -1073, 283, 0, 0, 0, 0, -912.429, 290.552, 0, 0, 0, 0, -624, 293, 0, 0, 0, 0, -616, 161, 0, 0, 0, 0, -577, 160, 0, 0, 0, 0, 823, 165, 0, 0, 0, 0, 802, 305, 0, 0, 0, 0, 790, 1374)
|
||||
}
|
||||
point_count = 20
|
||||
|
||||
[node name="outside" type="Node2D" node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("1_02n2r")
|
||||
player = NodePath("world/player")
|
||||
|
||||
[node name="world" parent="." instance=ExtResource("2_rr7is")]
|
||||
|
||||
[node name="bob" parent="world" instance=ExtResource("3_vh8rr")]
|
||||
position = Vector2(-333, -262)
|
||||
|
||||
[node name="player" parent="world" instance=ExtResource("4_rjwf4")]
|
||||
position = Vector2(-171, -253)
|
||||
|
||||
[node name="movibles" type="Node2D" parent="."]
|
||||
|
||||
[node name="cars" type="Node" parent="movibles"]
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="movibles/cars"]
|
||||
position = Vector2(-664, 181)
|
||||
curve = SubResource("Curve2D_shblg")
|
||||
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D" node_paths=PackedStringArray("car", "world") instance=ExtResource("5_24ud7")]
|
||||
position = Vector2(-285, 193)
|
||||
car = NodePath("../Car")
|
||||
distanceMax = 400
|
||||
world = NodePath("../../../../world")
|
||||
|
||||
[node name="Car" parent="movibles/cars/Path2D" instance=ExtResource("6_nm50p")]
|
||||
position = Vector2(-287, 196)
|
||||
speed = 500
|
||||
|
||||
[node name="Path2D2" type="Path2D" parent="movibles/cars"]
|
||||
curve = SubResource("Curve2D_nircx")
|
||||
|
||||
[node name="voiture_pnj" parent="movibles/cars/Path2D2" node_paths=PackedStringArray("car", "world") instance=ExtResource("5_24ud7")]
|
||||
position = Vector2(794, 1374)
|
||||
car = NodePath("../Car")
|
||||
distanceMax = 400
|
||||
world = NodePath("../../../../world")
|
||||
|
||||
[node name="Car" parent="movibles/cars/Path2D2" instance=ExtResource("6_nm50p")]
|
||||
position = Vector2(790, 1372)
|
||||
speed = 500
|
||||
|
||||
[node name="Thomas" parent="." instance=ExtResource("7_a2x2y")]
|
||||
z_index = 2001
|
||||
position = Vector2(-199, -484)
|
||||
|
||||
[node name="Thomas2" parent="." instance=ExtResource("8_uk0jy")]
|
||||
z_index = 2001
|
||||
position = Vector2(-142, -510)
|
||||
|
||||
[connection signal="loadFromGameState" from="." to="Thomas" method="_on_load_from_game_state"]
|
||||
[connection signal="unloadFromScreen" from="." to="Thomas" method="_on_outside_unload_from_screen"]
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_g48os"]
|
||||
shader = ExtResource("1_kyfmm")
|
||||
shader_parameter/cutoff = 0.0
|
||||
shader_parameter/cutoff = 1.0
|
||||
shader_parameter/smooth_size = 0.1
|
||||
shader_parameter/mask = ExtResource("2_pg1r4")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user