OverviewFilesCommitsIssuesDocsReleasesPeers

godot-marble_madness_demo commits / 702a480

adding in game portal
702a4808cea8245b745c68ec7e20a4514e1347aa
by plankatron <fleeky@gmail.com> · 2022-05-06T03:01:59.000Z

Changed files (3) +43 -1

levels/portal/Portal.tscn +18 -0
……@@ -0,0 +1,18 @@
1[gd_scene load_steps=3 format=2]
2
3[ext_resource path="res://levels/scenes/portal.gd" type="Script" id=1]
4
5[sub_resource type="BoxShape" id=1]
6
7[node name="Portal" type="Spatial"]
8transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.178, 1.877, -3.673 )
9script = ExtResource( 1 )
10portal_destination = "tumble.pck"
11
12[node name="Hitbox" type="Area" parent="."]
13
14[node name="CollisionShape" type="CollisionShape" parent="Hitbox"]
15transform = Transform( 0.707107, 0, 0.707107, 0, 1, 0, -0.707107, 0, 0.707107, 2.72286, -8.67153, 19.502 )
16shape = SubResource( 1 )
17
18[connection signal="body_shape_entered" from="Hitbox" to="." method="_on_Hitbox_body_shape_entered"]
levels/scenes/level_0.tscn +6 -1
……@@ -1,4 +1,4 @@
1[gd_scene load_steps=16 format=2]
1[gd_scene load_steps=17 format=2]
22
33[ext_resource path="res://assets/levels/level0/assets_level_0.tscn" type="PackedScene" id=1]
44[ext_resource path="res://levels/spawn_point/spawn_point.tscn" type="PackedScene" id=2]
……@@ -15,6 +15,7 @@
1515[ext_resource path="res://ui/PlayerConfig.tscn" type="PackedScene" id=13]
1616[ext_resource path="res://menu/main/menu_main.scn" type="PackedScene" id=14]
1717[ext_resource path="res://player/ball/player_ball_controller.gd" type="Script" id=15]
18[ext_resource path="res://levels/portal/Portal.tscn" type="PackedScene" id=16]
1819
1920[node name="Spatial" type="Node"]
2021script = ExtResource( 3 )
……@@ -66,6 +67,8 @@ visible = false
6667[node name="CameraTween" type="Tween" parent="."]
6768pause_mode = 2
6869
70[node name="Portal" parent="." instance=ExtResource( 16 )]
71
6972[node name="HyperGodot" type="Node" parent="."]
7073
7174[node name="HyperGateway" type="Node" parent="HyperGodot"]
……@@ -84,3 +87,5 @@ autostart = true
8487[connection signal="event" from="HyperGodot/HyperGossip" to="." method="_on_HyperGossip_event"]
8588[connection signal="listening" from="HyperGodot/HyperGossip" to="." method="_on_HyperGossip_listening"]
8689[connection signal="timeout" from="HyperGodot/GossipEventTimer" to="." method="_on_GossipEventTimer_timeout"]
90
91[editable path="Portal"]
levels/scenes/portal.gd +19 -0
……@@ -0,0 +1,19 @@
1extends Spatial
2
3export var portal_destination : String = ""
4
5# Called when the node enters the scene tree for the first time.
6func _ready():
7 pass # Replace with function body.
8
9func tryGameChange(gameChangeName : String, sendGossip : bool, playerNode):
10 OS.execute(OS.get_executable_path(), ["--main-pack", portal_destination], false)
11 get_tree().quit()
12
13func _on_CollisionShape_gameplay_entered():
14 pass # Replace with function body.
15
16func _on_Hitbox_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
17 if(body is RigidBody):
18 tryGameChange(portal_destination, true, body)
19 #print("blah")