Skip to content

Commit

Permalink
Improve performance in the main menu
Browse files Browse the repository at this point in the history
Fix difficulty selector
  • Loading branch information
mgschwan committed Jul 15, 2020
1 parent b6baf38 commit 4bcc5ac
Show file tree
Hide file tree
Showing 16 changed files with 203 additions and 136 deletions.
14 changes: 0 additions & 14 deletions godot_project/DifficultySelector.gd

This file was deleted.

64 changes: 54 additions & 10 deletions godot_project/DifficultySelector.tscn
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[gd_scene load_steps=11 format=2]

[ext_resource path="res://models/red_material.tres" type="Material" id=1]
[ext_resource path="res://DifficultySelector.gd" type="Script" id=2]
[ext_resource path="res://DifficultySelector_body.gd" type="Script" id=3]
[ext_resource path="res://InfoBox.tscn" type="PackedScene" id=4]
[ext_resource path="res://neon_blue.tres" type="Material" id=5]

Expand All @@ -12,37 +10,83 @@
flags_ensure_correct_normals = true
albedo_color = Color( 0.0156863, 0, 0.490196, 1 )

[sub_resource type="BoxShape" id=3]
[sub_resource type="GDScript" id=3]
script/source = "extends MeshInstance


# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"


# Called when the node enters the scene tree for the first time.
func _ready():
get_node(\"difficulty\").print_info(\"Touch pole to\\nset difficulty\")

func set_difficulty(d):
get_node(\"marker\").translation.y = (-d+1)*0.5
"
[sub_resource type="GDScript" id=4]
script/source = "extends StaticBody


# Declare member variables here. Examples:
# var a = 2
# var b = \"text\"


# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

func get_difficulty(pos):
#var delta = self.translation.distance_to(pos)
var delta = pos.y
var difficulty = 0
if delta < 1.25:
difficulty = 2
elif delta < 1.5:
difficulty = 1
return difficulty
"
[sub_resource type="BoxShape" id=5]
extents = Vector3( 1, 0.712206, 1 )
[sub_resource type="PrismMesh" id=4]
[sub_resource type="PrismMesh" id=6]
size = Vector3( 1, 1, 1 )
[sub_resource type="PrismMesh" id=5]
[sub_resource type="PrismMesh" id=7]
left_to_right = 1.0
[node name="target_zone_difficulty" type="MeshInstance"]
transform = Transform( 0.2, 0, 0, 0, 1, 0, 0, 0, 0.2, -0.381111, 0.942349, 0.100338 )
mesh = SubResource( 1 )
material/0 = SubResource( 2 )
script = ExtResource( 2 )
script = SubResource( 3 )
[node name="StaticBody" type="StaticBody" parent="."]
script = ExtResource( 3 )
script = SubResource( 4 )
[node name="CollisionShape" type="CollisionShape" parent="StaticBody"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2881, 0 )
shape = SubResource( 3 )
shape = SubResource( 5 )
[node name="difficulty" parent="." instance=ExtResource( 4 )]
transform = Transform( 2.6433e-07, -2.59314e-06, -4.20776, 0.718573, -3.14098e-08, 2.18557e-08, -4.62618e-07, -10.5835, -2.1441e-07, -1.41627, 1.25248, -1.07518 )
[node name="marker" type="MeshInstance" parent="."]
transform = Transform( 3.30413e-08, 0.755896, 7.88298e-08, 0.117527, -5.13727e-09, -4.32329e-08, -5.09773e-07, 1.04287e-07, -1.3858, -0.536692, -0.344664, -0.791448 )
mesh = SubResource( 4 )
mesh = SubResource( 6 )
material/0 = ExtResource( 5 )
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 0.999999, 0, 0, 0, 0.706865, 0, 0, 0, 0.234012, -0.0892398, -0.28315, -0.829929 )
mesh = SubResource( 5 )
mesh = SubResource( 7 )
material/0 = ExtResource( 1 )
26 changes: 0 additions & 26 deletions godot_project/DifficultySelector_body.gd

This file was deleted.

4 changes: 2 additions & 2 deletions godot_project/InfoBox.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ func _ready():

# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

# pass

func print_info(text):
get_node("ViewportInfo/CanvasLayer/Container/Text").text = text
get_node("ViewportInfo").render_target_update_mode = Viewport.UPDATE_ONCE
1 change: 1 addition & 0 deletions godot_project/InfoBox.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ msaa = 6
disable_3d = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 0

[node name="CanvasLayer" type="CanvasLayer" parent="ViewportInfo"]

Expand Down
1 change: 1 addition & 0 deletions godot_project/InfoBoxOpaque.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ msaa = 6
disable_3d = true
usage = 0
render_target_v_flip = true
render_target_update_mode = 0

[node name="CanvasLayer" type="CanvasLayer" parent="ViewportInfo"]

Expand Down
38 changes: 25 additions & 13 deletions godot_project/Level.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=34 format=2]
[gd_scene load_steps=36 format=2]

[ext_resource path="res://Main.gd" type="Script" id=1]
[ext_resource path="res://spawn_timer.gd" type="Script" id=2]
Expand Down Expand Up @@ -48,18 +48,25 @@ flags_transparent = true
vertex_color_use_as_albedo = true
albedo_texture = SubResource( 4 )

[sub_resource type="Curve3D" id=6]
[sub_resource type="PlaneMesh" id=6]
size = Vector2( 1.98, 0.2 )

[sub_resource type="SpatialMaterial" id=7]
flags_unshaded = true
albedo_color = Color( 0.0784314, 0, 0.639216, 1 )

[sub_resource type="Curve3D" id=8]
_data = {
"points": PoolVector3Array( 0, 0, 0, 0, 0, 0, -0.393426, 1.02695, 0.270852, 0, 0, 0, 0, 0, 0, 1.54268, 1.03279, 2.26938, 0, 0, 0, 0, 0, 0, 1.76955, 0.993884, 6.47424, 0, 0, 0, 0, 0, 0, -0.0516853, 1.12288, 8.81755 ),
"tilts": PoolRealArray( 0, 0, 0, 0 )
}

[sub_resource type="CubeMesh" id=7]
[sub_resource type="CubeMesh" id=9]

[sub_resource type="BoxShape" id=8]
[sub_resource type="BoxShape" id=10]
extents = Vector3( 0.455611, 0.0926839, 0.161588 )

[sub_resource type="SpatialMaterial" id=9]
[sub_resource type="SpatialMaterial" id=11]
albedo_color = Color( 0.94902, 0.937255, 0.937255, 1 )
albedo_texture = ExtResource( 23 )

Expand All @@ -74,7 +81,7 @@ handle_input_locally = false
msaa = 6
usage = 1
render_target_v_flip = true
render_target_update_mode = 3
render_target_update_mode = 0
gui_disable_input = true

[node name="InfoLayer" parent="Viewport" instance=ExtResource( 5 )]
Expand All @@ -90,6 +97,11 @@ mesh = SubResource( 3 )
skeleton = NodePath("")
material/0 = SubResource( 5 )

[node name="DurationIndicator" type="MeshInstance" parent="MeshInstance"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0143757, 2.262 )
mesh = SubResource( 6 )
material/0 = SubResource( 7 )

[node name="spawn_timer" type="Timer" parent="."]
autostart = true
script = ExtResource( 2 )
Expand All @@ -109,7 +121,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.959816, 0 )
aabb = AABB( -1, -0.256859, -1, 2, 0.513717, 2 )

[node name="Path" type="Path" parent="cue_emitter"]
curve = SubResource( 6 )
curve = SubResource( 8 )

[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
bus = "Music"
Expand All @@ -119,24 +131,24 @@ transform = Transform( 0.118828, 0, 0, 0, 1, 0, 0, 0, 0.0898216, -0.87, 1, -0.06

[node name="target_zone_l" type="MeshInstance" parent="target"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.7525, 0, 0 )
mesh = SubResource( 7 )
mesh = SubResource( 9 )
material/0 = ExtResource( 11 )

[node name="target_zone_l2" type="MeshInstance" parent="target"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 17.5653, 0, 0 )
mesh = SubResource( 7 )
mesh = SubResource( 9 )
material/0 = ExtResource( 11 )

[node name="target_zone_l3" type="MeshInstance" parent="target"]
transform = Transform( 0.866025, 4.20776, 1.65206e-08, -0.00129093, 0.0188166, 0.0898004, 0.661311, -9.63934, 0.0217276, 12.525, -1.07, -11.5 )
visible = false
mesh = SubResource( 7 )
mesh = SubResource( 9 )
material/0 = ExtResource( 10 )

[node name="target_zone_l4" type="MeshInstance" parent="target"]
transform = Transform( 0.866025, -4.20776, -1.65206e-08, 0.00129093, 0.0188166, 0.0898004, -0.661311, -9.63934, 0.0217276, 2.276, -1.07, -11.5 )
visible = false
mesh = SubResource( 7 )
mesh = SubResource( 9 )
material/0 = ExtResource( 10 )

[node name="exit_button" type="StaticBody" parent="target"]
Expand All @@ -149,7 +161,7 @@ default_text = "EXIT STAGE"

[node name="CollisionShape" type="CollisionShape" parent="target/exit_button"]
transform = Transform( 1, -3.55271e-15, 2.64698e-23, 0, 1, -1.77636e-15, 3.38813e-21, -2.84217e-14, 1, -0.688979, 0, -0.413249 )
shape = SubResource( 8 )
shape = SubResource( 10 )

[node name="PositionSign" parent="." instance=ExtResource( 9 )]
transform = Transform( 0.5, 0, 0, 0, -4.37114e-08, -0.5, 0, 1, -2.18557e-08, -1.79988, 0.513339, -4.91669 )
Expand Down Expand Up @@ -189,7 +201,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.026268, -0.001, -0.586 )
[node name="mat_simple" parent="MainStage" instance=ExtResource( 22 )]
transform = Transform( -6.99382e-10, 0, 0.018, 0, 0.02, 0, -0.016, 0, -7.86805e-10, 0.109178, -0.01, 0.493 )
visible = false
material/0 = SubResource( 9 )
material/0 = SubResource( 11 )

[node name="mat" parent="MainStage" instance=ExtResource( 24 )]
transform = Transform( 0.19, 0, 0, 0, 0.2, 0, 0, 0, 0.19, 0.0230895, 0.00996999, 0.522808 )
Expand Down
Loading

0 comments on commit 4bcc5ac

Please sign in to comment.