diff options
author | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 03:40:41 +0200 |
---|---|---|
committer | IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> | 2022-07-17 03:40:41 +0200 |
commit | d3f6967fe666595cf0862be57a3dae3bb23afd24 (patch) | |
tree | 7e6f90f9a3116431dc761fdd4167b58f4b59ec43 /godot/scenes | |
parent | 690e705de1e8b8babbb7bf86f55a5dbae559488b (diff) | |
download | 2022-d3f6967fe666595cf0862be57a3dae3bb23afd24.tar.gz 2022-d3f6967fe666595cf0862be57a3dae3bb23afd24.tar.bz2 2022-d3f6967fe666595cf0862be57a3dae3bb23afd24.zip |
asset for the goal trigger
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/Game.tscn | 20 | ||||
-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 |
7 files changed, 60 insertions, 7 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/Game.tscn b/godot/scenes/Game.tscn index 9891f4e..d4d287a 100644 --- a/godot/scenes/Game.tscn +++ b/godot/scenes/Game.tscn @@ -1,16 +1,16 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=9 format=2] -[ext_resource path="res://scenes/Game.gd" type="Script" id=1] +[ext_resource path="res://scenes/Die.tscn" type="PackedScene" id=1] [ext_resource path="res://scenes/levels/test_scene_movement/TestSceneMovement.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/theme.tres" type="Theme" id=3] [ext_resource path="res://assets/fonts/format.tres" type="DynamicFont" id=4] [ext_resource path="res://scenes/objects/Scoreboard.tscn" type="PackedScene" id=5] [ext_resource path="res://assets/sounds/bgm.mp3" type="AudioStream" id=6] +[ext_resource path="res://scenes/Game.gd" type="Script" id=7] +[ext_resource path="res://scenes/objects/GoalZone.tscn" type="PackedScene" id=8] [node name="Game" type="Spatial"] -script = ExtResource( 1 ) - -[node name="TestScene" parent="." instance=ExtResource( 2 )] +script = ExtResource( 7 ) [node name="PausePopup" type="Control" parent="."] pause_mode = 2 @@ -66,9 +66,19 @@ margin_bottom = 0.47998 [node name="Level1" type="Spatial" parent="."] +[node name="TestScene" parent="Level1" instance=ExtResource( 2 )] + +[node name="GoalZone" parent="Level1" instance=ExtResource( 8 )] +transform = Transform( 2.88272, 0, 0, 0, 2.00313, 0, 0, 0, 3.65044, 17.4844, 1.29056, -11.8885 ) + [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource( 6 ) autoplay = true +[node name="Level2" type="Spatial" parent="."] +visible = false + +[node name="Die" parent="Level2" instance=ExtResource( 1 )] + [connection signal="pressed" from="PausePopup/Panel/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"] [connection signal="pressed" from="PausePopup/Panel/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] 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"] |