Skip to content

Commit

Permalink
feat/base-portal (#52)
Browse files Browse the repository at this point in the history
* Added portal placeholder in test_map

* Made a scene for PortalPlaceholder

* Added back-portal to mountain map

* Chose a position for the portal back

Co-authored-by: Telmo Valverde <[email protected]>
  • Loading branch information
telmotrooper and telmotrooper authored May 22, 2022
1 parent 4f7956a commit 672fc51
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 6 deletions.
25 changes: 24 additions & 1 deletion maps/mountain_map.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=2]
[gd_scene load_steps=19 format=2]

[ext_resource path="res://models/height_map/height_map.tscn" type="PackedScene" id=1]
[ext_resource path="res://shaders/stylized_water/stylized_water_material.tres" type="Material" id=2]
Expand All @@ -11,6 +11,8 @@
[ext_resource path="res://entities/enemy/blue_enemy.tscn" type="PackedScene" id=9]
[ext_resource path="res://models/ball/ball.tscn" type="PackedScene" id=10]
[ext_resource path="res://models/red_button/red_button.tscn" type="PackedScene" id=11]
[ext_resource path="res://maps/portal_placeholder.tscn" type="PackedScene" id=12]
[ext_resource path="res://models/height_map/Material.material" type="Material" id=13]

[sub_resource type="Curve3D" id=1]
_data = {
Expand Down Expand Up @@ -70,6 +72,10 @@ tracks/1/keys = {
} ]
}

[sub_resource type="CylinderShape" id=5]
radius = 5.0
height = 5.0

[node name="MontainMap" type="Spatial"]
script = ExtResource( 3 )
drain_water_sound = ExtResource( 4 )
Expand Down Expand Up @@ -126,5 +132,22 @@ far = 200.0
[node name="Boundary" parent="." instance=ExtResource( 5 )]
transform = Transform( 15, 0, 0, 0, -0.2, -2.26494e-06, 0, 3.01992e-08, -15, 65, -60, 91 )

[node name="CSGCylinder" type="CSGCylinder" parent="."]
transform = Transform( -0.5, 0, -0.866025, 0, 1, 0, 0.866025, 0, -0.5, 55.2639, 3.8, 21.8429 )
radius = 5.0
height = 5.0
material = ExtResource( 13 )

[node name="PortalPlaceholder" parent="CSGCylinder" instance=ExtResource( 12 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1.52588e-05, 2.5, -0.00272942 )
map_name = "test_map"

[node name="StaticBody" type="StaticBody" parent="CSGCylinder"]
collision_layer = 4
collision_mask = 0

[node name="CollisionShape" type="CollisionShape" parent="CSGCylinder/StaticBody"]
shape = SubResource( 5 )

[connection signal="hit" from="Player" to="." method="_on_Player_hit"]
[connection signal="pressed" from="Props/RedButton" to="." method="_on_RedButton_pressed"]
6 changes: 6 additions & 0 deletions maps/portal_placeholder.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends CSGCylinder

export var map_name: String

func _on_Portal_entered(_body):
GameState.change_map(map_name)
25 changes: 25 additions & 0 deletions maps/portal_placeholder.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://maps/portal_placeholder.gd" type="Script" id=1]

[sub_resource type="SpatialMaterial" id=19]
albedo_color = Color( 0.639216, 0.141176, 0.141176, 1 )

[sub_resource type="CylinderShape" id=20]

[node name="PortalPlaceholder" type="CSGCylinder"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0670445, 0, -135.074 )
radius = 3.0
height = 0.5
material = SubResource( 19 )
script = ExtResource( 1 )

[node name="Area" type="Area" parent="."]
collision_layer = 0
monitorable = false

[node name="CollisionShape" type="CollisionShape" parent="Area"]
transform = Transform( 3, 0, 0, 0, 0.25, 0, 0, 0, 3, 0, 0, 0 )
shape = SubResource( 20 )

[connection signal="body_entered" from="Area" to="." method="_on_Portal_entered"]
13 changes: 9 additions & 4 deletions maps/test_map.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=36 format=2]
[gd_scene load_steps=37 format=2]

[ext_resource path="res://addons/scatter/demos/assets/grass/data/m_grass_52.tres" type="Material" id=1]
[ext_resource path="res://addons/scatter/src/core/scatter.gd" type="Script" id=2]
Expand All @@ -20,6 +20,7 @@
[ext_resource path="res://models/goweti/goweti.tscn" type="PackedScene" id=18]
[ext_resource path="res://models/red_button/red_button.tscn" type="PackedScene" id=19]
[ext_resource path="res://entities/enemy/purple_enemy.tscn" type="PackedScene" id=20]
[ext_resource path="res://maps/portal_placeholder.tscn" type="PackedScene" id=21]

[sub_resource type="BoxShape" id=3]
extents = Vector3( 30, 1, 30 )
Expand Down Expand Up @@ -316,6 +317,10 @@ direction = 1
[node name="Goweti" parent="." instance=ExtResource( 18 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 60.906, -0.312, -0.581 )

[node name="PortalPlaceholder" parent="." instance=ExtResource( 21 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0670445, 0.244789, -135.074 )
map_name = "mountain_map"

[node name="Enemies" type="Spatial" parent="."]

[node name="BlueEnemyPath" type="Path" parent="Enemies"]
Expand Down Expand Up @@ -358,14 +363,14 @@ transform = Transform( 0.854641, 0, -0.519218, 0, 1, 0, 0.519218, 0, 0.854641, 2
[node name="BlueEnemy4" parent="Enemies/BlueEnemyPath4/PathFollow" instance=ExtResource( 10 )]
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0 )

[node name="BlueEnemyPath5" type="Path" parent="Enemies"]
[node name="PurpleEnemyPath" type="Path" parent="Enemies"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.04762, 0, -119.803 )
curve = SubResource( 18 )

[node name="PathFollow" type="PathFollow" parent="Enemies/BlueEnemyPath5"]
[node name="PathFollow" type="PathFollow" parent="Enemies/PurpleEnemyPath"]
transform = Transform( -0.192319, 0, 0.981332, 0, 1, 0, -0.981332, 0, -0.192319, -21.9524, 0, 7.80272 )

[node name="PurpleEnemy" parent="Enemies/BlueEnemyPath5/PathFollow" instance=ExtResource( 20 )]
[node name="PurpleEnemy" parent="Enemies/PurpleEnemyPath/PathFollow" instance=ExtResource( 20 )]
transform = Transform( -6, 0, 5.24537e-07, 0, 6, 0, -5.24537e-07, 0, -6, 0, 0, 0 )
patrolling_speed = 18

Expand Down
Binary file added models/height_map/Material.material
Binary file not shown.
2 changes: 1 addition & 1 deletion models/height_map/height_map.glb.import
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nodes/custom_script=""
nodes/storage=0
nodes/use_legacy_names=false
materials/location=1
materials/storage=0
materials/storage=1
materials/keep_on_reimport=true
meshes/octahedral_compression=true
meshes/compress=4286
Expand Down

0 comments on commit 672fc51

Please sign in to comment.