Refactor main scene into Game.tscn

This commit is contained in:
Fabien Freling 2019-02-16 18:05:52 +01:00
parent b8c6084c19
commit ceaec1ac03
9 changed files with 49 additions and 70 deletions

View file

@ -1,20 +1,7 @@
extends Node
onready var final_menu := $FinalMenu
onready var player := $Player
extends Spatial
signal level_completed()
#func _process(delta):
# var player = get_node("Player")
# if player.has_reached_goal:
# get_node("Panel").visible = true
#func _on_Goal_body_entered(body):
# if body.t is player.:
# emit_signal("level_completed")
func _on_Level_01_level_completed():
player.queue_free()
final_menu.show()
pass # Replace with function body.
func _on_Goal_body_entered(body):
if body is Player:
emit_signal("level_completed")

View file

@ -1,13 +1,11 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://levels/Level_01.gd" type="Script" id=1]
[ext_resource path="res://levels/Level_01_env.tres" type="Environment" id=2]
[ext_resource path="res://models/mlib.meshlib" type="MeshLibrary" id=3]
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=4]
[ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=5]
[ext_resource path="res://scenes/FinalMenu.tscn" type="PackedScene" id=6]
[ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=4]
[node name="Level_01" type="Node"]
[node name="Level_01" type="Spatial"]
script = ExtResource( 1 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
@ -25,38 +23,13 @@ __meta__ = {
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 6, 7 )
current = true
fov = 54.1445
[node name="Player" parent="." instance=ExtResource( 4 )]
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 2.79728, -2.72332 )
move_speed = 5.0
[node name="Goal" parent="." instance=ExtResource( 5 )]
[node name="Goal" parent="." instance=ExtResource( 4 )]
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.993621, 1.99794, 1.00068 )
[node name="DirectionalLight" type="DirectionalLight" parent="."]
transform = Transform( 0.701566, 0, -0.712605, 0.386011, 0.840578, 0.380031, 0.599, -0.541691, 0.589721, 0, 5.28645, 0 )
[node name="FinalMenu" parent="." instance=ExtResource( 6 )]
visible = false
[node name="Panel" type="Panel" parent="."]
editor/display_folded = true
visible = false
margin_left = 330.0
margin_top = 180.0
margin_right = 720.0
margin_bottom = 400.0
[node name="Label" type="Label" parent="Panel"]
margin_left = 70.0
margin_top = 70.0
margin_right = 310.0
margin_bottom = 150.0
text = "Congratulations!
You reached the goal!"
align = 1
valign = 1
[connection signal="level_completed" from="." to="." method="_on_Level_01_level_completed"]
[connection signal="body_entered" from="Goal" to="." method="_on_Goal_body_entered"]