summaryrefslogtreecommitdiffstats
path: root/world/obstacles
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-09-18 19:38:35 -0400
committerdusoleil <howcansocksbereal@gmail.com>2022-09-18 19:42:01 -0400
commit32bf9d2024362d45dc351c8f1d0b3b301caf1131 (patch)
treefb6540bce94cb55c6123ecfe1327abeabea2925f /world/obstacles
parentffc92ed12c6e680776d355ff9fcef70e5e28d7c8 (diff)
downloadgame_jam49-32bf9d2024362d45dc351c8f1d0b3b301caf1131.tar.gz
game_jam49-32bf9d2024362d45dc351c8f1d0b3b301caf1131.zip
Organize World Gen Stuff
Diffstat (limited to 'world/obstacles')
-rw-r--r--world/obstacles/Rock.gd18
-rw-r--r--world/obstacles/Rock.tscn53
2 files changed, 71 insertions, 0 deletions
diff --git a/world/obstacles/Rock.gd b/world/obstacles/Rock.gd
new file mode 100644
index 0000000..577e626
--- /dev/null
+++ b/world/obstacles/Rock.gd
@@ -0,0 +1,18 @@
+extends StaticBody
+
+onready var collision_enabled = self.collision_layer
+
+func lod_distance():
+ $"MeshInstance".visible = false
+ $"MeshInstance2".visible = true
+ self.collision_layer = 0
+
+func lod_mid():
+ $"MeshInstance".visible = true
+ $"MeshInstance2".visible = false
+ self.collision_layer = 0
+
+func lod_close():
+ $"MeshInstance".visible = true
+ $"MeshInstance2".visible = false
+ self.collision_layer = collision_enabled
diff --git a/world/obstacles/Rock.tscn b/world/obstacles/Rock.tscn
new file mode 100644
index 0000000..3b50ff3
--- /dev/null
+++ b/world/obstacles/Rock.tscn
@@ -0,0 +1,53 @@
+[gd_scene load_steps=10 format=2]
+
+[ext_resource path="res://world/obstacles/Rock.gd" type="Script" id=1]
+[ext_resource path="res://world/chunk/helper/ChunkedMeshInstance.gd" type="Script" id=2]
+
+[sub_resource type="ConvexPolygonShape" id=2]
+points = PoolVector3Array( 2.5, -5, 2.5, 2.5, -5, -2.5, -2.5, -5, -2.5, -2.5, -5, 2.5, 0, 5, 2.5, 0, 5, -2.5 )
+
+[sub_resource type="OpenSimplexNoise" id=3]
+octaves = 4
+period = 32.0
+
+[sub_resource type="NoiseTexture" id=4]
+noise = SubResource( 3 )
+
+[sub_resource type="NoiseTexture" id=5]
+seamless = true
+as_normalmap = true
+bump_strength = 32.0
+noise = SubResource( 3 )
+
+[sub_resource type="SpatialMaterial" id=6]
+albedo_color = Color( 0.231373, 0.231373, 0.231373, 1 )
+albedo_texture = SubResource( 4 )
+normal_enabled = true
+normal_scale = 1.0
+normal_texture = SubResource( 5 )
+
+[sub_resource type="PrismMesh" id=1]
+size = Vector3( 5, 10, 5 )
+
+[sub_resource type="CubeMesh" id=9]
+size = Vector3( 5, 10, 5 )
+
+[node name="Rock" type="StaticBody"]
+collision_layer = 8
+collision_mask = 0
+script = ExtResource( 1 )
+
+[node name="CollisionShape" type="CollisionShape" parent="."]
+shape = SubResource( 2 )
+
+[node name="MeshInstance" type="MeshInstance" parent="."]
+visible = false
+material_override = SubResource( 6 )
+script = ExtResource( 2 )
+_mesh = SubResource( 1 )
+
+[node name="MeshInstance2" type="MeshInstance" parent="."]
+visible = false
+material_override = SubResource( 6 )
+script = ExtResource( 2 )
+_mesh = SubResource( 9 )