Display banner when reaching goal
This commit is contained in:
parent
48ef9f6470
commit
8e83495fd2
6
levels/Level_01.gd
Normal file
6
levels/Level_01.gd
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
var player = get_node("Player")
|
||||||
|
if player.has_reached_goal:
|
||||||
|
get_node("Panel").visible = true
|
|
@ -1,15 +1,18 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=6 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://models/mlib.meshlib" type="MeshLibrary" id=1]
|
[ext_resource path="res://levels/Level_01.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://models/mlib.meshlib" type="MeshLibrary" id=2]
|
||||||
[ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://scenes/Player.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://levels/Level_01_env.tres" type="Environment" id=4]
|
[ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=4]
|
||||||
|
[ext_resource path="res://levels/Level_01_env.tres" type="Environment" id=5]
|
||||||
|
|
||||||
[node name="Level_01" type="Node"]
|
[node name="Level_01" type="Node" index="0"]
|
||||||
|
|
||||||
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="GridMap" type="GridMap" parent="." index="0"]
|
[node name="GridMap" type="GridMap" parent="." index="0"]
|
||||||
|
|
||||||
theme = ExtResource( 1 )
|
theme = ExtResource( 2 )
|
||||||
cell_size = Vector3( 2, 2, 2 )
|
cell_size = Vector3( 2, 2, 2 )
|
||||||
cell_octant_size = 8
|
cell_octant_size = 8
|
||||||
cell_center_x = true
|
cell_center_x = true
|
||||||
|
@ -44,18 +47,61 @@ near = 0.05
|
||||||
far = 100.0
|
far = 100.0
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="Player" parent="." index="2" instance=ExtResource( 2 )]
|
[node name="Player" parent="." index="2" instance=ExtResource( 3 )]
|
||||||
|
|
||||||
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 2.79728, -2.72332 )
|
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 2.79728, -2.72332 )
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="Goal" parent="." index="3" instance=ExtResource( 3 )]
|
[node name="Goal" parent="." index="3" instance=ExtResource( 4 )]
|
||||||
|
|
||||||
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.993621, 1.99794, 1.00068 )
|
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0.993621, 1.99794, 1.00068 )
|
||||||
_sections_unfolded = [ "Transform" ]
|
_sections_unfolded = [ "Transform" ]
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="." index="4"]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="." index="4"]
|
||||||
|
|
||||||
environment = ExtResource( 4 )
|
environment = ExtResource( 5 )
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="." index="5"]
|
||||||
|
|
||||||
|
visible = false
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 330.0
|
||||||
|
margin_top = 180.0
|
||||||
|
margin_right = 720.0
|
||||||
|
margin_bottom = 400.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 0
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 1
|
||||||
|
_sections_unfolded = [ "Visibility" ]
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Panel" index="0"]
|
||||||
|
|
||||||
|
anchor_left = 0.0
|
||||||
|
anchor_top = 0.0
|
||||||
|
anchor_right = 0.0
|
||||||
|
anchor_bottom = 0.0
|
||||||
|
margin_left = 70.0
|
||||||
|
margin_top = 70.0
|
||||||
|
margin_right = 310.0
|
||||||
|
margin_bottom = 150.0
|
||||||
|
rect_pivot_offset = Vector2( 0, 0 )
|
||||||
|
rect_clip_content = false
|
||||||
|
mouse_filter = 2
|
||||||
|
mouse_default_cursor_shape = 0
|
||||||
|
size_flags_horizontal = 1
|
||||||
|
size_flags_vertical = 4
|
||||||
|
text = "Congratulations!
|
||||||
|
You reached the goal!"
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
percent_visible = 1.0
|
||||||
|
lines_skipped = 0
|
||||||
|
max_lines_visible = -1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,15 @@ extends KinematicBody
|
||||||
const norm_gravity = -100
|
const norm_gravity = -100
|
||||||
var velocity = Vector3()
|
var velocity = Vector3()
|
||||||
const MAX_SLOPE_ANGLE = 60
|
const MAX_SLOPE_ANGLE = 60
|
||||||
|
var has_reached_goal = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
if has_reached_goal:
|
||||||
|
return
|
||||||
|
|
||||||
# Keyboard input
|
# Keyboard input
|
||||||
var direction = Vector3()
|
var direction = Vector3()
|
||||||
|
|
||||||
|
@ -41,4 +45,5 @@ func _process(delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func reach_goal():
|
func reach_goal():
|
||||||
print("Reached goal")
|
has_reached_goal = true
|
||||||
|
print("Reached goal")
|
Loading…
Reference in a new issue