diff options
author | cel <cel@blos.sm> | 2022-07-17 02:56:58 +0100 |
---|---|---|
committer | cel <cel@blos.sm> | 2022-07-17 02:56:58 +0100 |
commit | 5d5d662a99a512e2718aae4a4a84f050bc1d411f (patch) | |
tree | e0c4dde0528ac8318f0775c3dac511e609a72826 /godot/scenes | |
parent | 45c8787154fe7384c9c1faa2ab7c003b995393ca (diff) | |
parent | 16f5d5aaacdd1a1420bba8d6600942520d85cb8c (diff) | |
download | 2022-5d5d662a99a512e2718aae4a4a84f050bc1d411f.tar.gz 2022-5d5d662a99a512e2718aae4a4a84f050bc1d411f.tar.bz2 2022-5d5d662a99a512e2718aae4a4a84f050bc1d411f.zip |
merged
Diffstat (limited to 'godot/scenes')
-rw-r--r-- | godot/scenes/Die.gd | 6 | ||||
-rw-r--r-- | godot/scenes/Game.gd | 1 | ||||
-rw-r--r-- | godot/scenes/levels/GoalTriggerZone.tscn | 3 | ||||
-rw-r--r-- | godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn | 2 | ||||
-rw-r--r-- | godot/scenes/objects/GoalTriggerBox.gd | 22 | ||||
-rw-r--r-- | godot/scenes/objects/GoalZone.tscn | 13 |
6 files changed, 45 insertions, 2 deletions
diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 21a408e..7d07a6f 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -32,8 +32,14 @@ func _ready(): mat = get_physics_material_override() previous_bounciness = mat.get_bounce() + func _input(event): + if _game.is_post_game(): + if event is InputEventMouseButton || event is InputEventKey: + _game.next_level() + return + if event is InputEventKey: if event.scancode == KEY_TAB: if event.is_pressed(): diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd index f24219e..8b86263 100644 --- a/godot/scenes/Game.gd +++ b/godot/scenes/Game.gd @@ -27,6 +27,7 @@ func _process(delta): get_tree().paused = true $PausePopup.show() Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) + close_scoreboard() diff --git a/godot/scenes/levels/GoalTriggerZone.tscn b/godot/scenes/levels/GoalTriggerZone.tscn index 861db4d..54cdfe1 100644 --- a/godot/scenes/levels/GoalTriggerZone.tscn +++ b/godot/scenes/levels/GoalTriggerZone.tscn @@ -1,6 +1,7 @@ [gd_scene load_steps=3 format=2] -[ext_resource path="res://scripts/GoalTriggerBox.gd" type="Script" id=1] +[ext_resource path="res://scenes/objects/GoalTriggerBox.gd" type="Script" id=1] + [sub_resource type="BoxShape" id=1] diff --git a/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn b/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn index dc25498..1350a10 100644 --- a/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn +++ b/godot/scenes/levels/test_scene_movement/TestSceneMovement.tscn @@ -28,4 +28,4 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 40, -1, -20 ) transform = Transform( 0.766044, 0, 0.642788, 0, 2, 0, -0.642788, 0, 0.766044, 19.47, 0, -14 ) [node name="Die" parent="." instance=ExtResource( 3 )] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.759363, 4.18965, -3.60846 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.50879, 0 ) diff --git a/godot/scenes/objects/GoalTriggerBox.gd b/godot/scenes/objects/GoalTriggerBox.gd new file mode 100644 index 0000000..9659520 --- /dev/null +++ b/godot/scenes/objects/GoalTriggerBox.gd @@ -0,0 +1,22 @@ +extends Area + +const Loader = preload("res://scenes/Game.gd") +var loader: Loader = null + +# Called when the node enters the scene tree for the first time. +func _ready(): + loader = get_node("/root/Game") + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass + + +func _on_Area_body_entered(body: RigidBody): + # return when body is not a rigidbody + if body == null: + return + + loader.end_level() + diff --git a/godot/scenes/objects/GoalZone.tscn b/godot/scenes/objects/GoalZone.tscn new file mode 100644 index 0000000..79b8624 --- /dev/null +++ b/godot/scenes/objects/GoalZone.tscn @@ -0,0 +1,13 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://scenes/objects/GoalTriggerBox.gd" type="Script" id=1] + +[sub_resource type="BoxShape" id=1] + +[node name="GoalZone" type="Area"] +script = ExtResource( 1 ) + +[node name="CollisionShape" type="CollisionShape" parent="."] +shape = SubResource( 1 ) + +[connection signal="body_entered" from="." to="." method="_on_Area_body_entered"] |