Add FinalMenu and tweak signals

Signals are not correctly connected yet.
I need to extract the Player from the Level scene.
This commit is contained in:
Fabien Freling 2019-02-14 14:20:44 +01:00
parent acacbc65e8
commit 3aeeaab1ba
9 changed files with 130 additions and 23 deletions

View file

@ -1,6 +1,20 @@
extends Node
func _process(delta):
var player = get_node("Player")
if player.has_reached_goal:
get_node("Panel").visible = true
onready var final_menu := $FinalMenu
onready var player := $Player
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.

View file

@ -1,16 +1,20 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://levels/Level_01.gd" type="Script" id=1]
[ext_resource path="res://models/mlib.meshlib" type="MeshLibrary" id=2]
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=3]
[ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=4]
[ext_resource path="res://levels/Level_01_env.tres" type="Environment" id=5]
[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]
[node name="Level_01" type="Node"]
script = ExtResource( 1 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource( 2 )
[node name="GridMap" type="GridMap" parent="."]
mesh_library = ExtResource( 2 )
mesh_library = ExtResource( 3 )
data = {
"cells": PoolIntArray( 0, 0, 1441792, 65534, 0, 1441792, 65535, 0, 1441792, 0, 65534, 1441792, 65534, 65534, 1441792, 65535, 65534, 1441792, 0, 65535, 1441792, 65534, 65535, 1441792 )
}
@ -23,16 +27,20 @@ __meta__ = {
transform = Transform( 1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 6, 7 )
fov = 54.1445
[node name="Player" parent="." instance=ExtResource( 3 )]
[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 )
[node name="Goal" parent="." instance=ExtResource( 4 )]
[node name="Goal" parent="." instance=ExtResource( 5 )]
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.993621, 1.99794, 1.00068 )
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource( 5 )
[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
@ -49,6 +57,5 @@ You reached the goal!"
align = 1
valign = 1
[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 )
[connection signal="level_completed" from="." to="." method="_on_Level_01_level_completed"]
[connection signal="body_entered" from="Goal" to="." method="_on_Goal_body_entered"]