lock in the first level

This commit is contained in:
Taevas 2025-02-22 19:46:19 +01:00
parent 3b56cd4c81
commit 7a18c4f8c6
14 changed files with 201 additions and 16 deletions

View file

@ -6,10 +6,12 @@
[sub_resource type="GDScript" id="GDScript_3yq1l"]
script/source = "extends Control
var player_ready = false
const normal = 7
const stronger = normal * 3
func _process(delta: float) -> void:
if player_ready:
var grav = stronger if Input.is_key_pressed(KEY_SHIFT) else normal
PhysicsServer3D.area_set_param(get_viewport().find_world_3d().space, PhysicsServer3D.AREA_PARAM_GRAVITY, grav)
"
@ -43,10 +45,11 @@ func _input(ev: InputEvent) -> void:
self.rotation_degrees = 90
$AudioStreamPlayer.pitch_scale = 0.95
if direction != PhysicsServer3D.area_get_param(
if get_parent().player_ready == false or direction != PhysicsServer3D.area_get_param(
get_viewport().find_world_3d().space,
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR
):
get_parent().player_ready = true
PhysicsServer3D.area_set_param(
get_viewport().find_world_3d().space,
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR,

View file

@ -7,8 +7,6 @@
script/source = "extends Node3D
func _process(_delta: float) -> void:
#if $Sphere.position.y < -2:
# $Sphere.position.y = 0
$SpotLightMain.position = $Sphere.position + Vector3(0, 5, 0)
$SpotLightTop.position = $Sphere.position
$SpotLightLeft.position = $Sphere.position
@ -20,12 +18,12 @@ func _process(_delta: float) -> void:
## Angle of the camera, so the player can see where the ball is going
var velocity: Vector3 = $Sphere.linear_velocity
var desired_x = max(min(velocity.y / 2, 20), -20)
var desired_y = max(min(-velocity.x / 2, 45), -45)
var desired_x = max(min(velocity.y, 20), -20)
var desired_y = max(min(-velocity.x, 50), -50)
var difference_x = $Camera.rotation_degrees.x - desired_x
var difference_y = $Camera.rotation_degrees.y - desired_y
$Camera.rotation_degrees.x -= max(min(difference_x / 4, 3), -3)
$Camera.rotation_degrees.y -= max(min(difference_y / 4, 3), -3)
$Camera.rotation_degrees.x -= max(min(difference_x / 2, 3), -3)
$Camera.rotation_degrees.y -= max(min(difference_y / 2, 3), -3)
## FOV of the camera, so it unzooms more at higher velocities
const default_fov = 75

View file

@ -1,25 +1,39 @@
[gd_scene load_steps=3 format=3 uid="uid://cpm3laywhlbq5"]
[gd_scene load_steps=7 format=3 uid="uid://cpm3laywhlbq5"]
[ext_resource type="Material" uid="uid://brwwlwb1rpro7" path="res://levels/base/material.tres" id="1_48h5f"]
[ext_resource type="AudioStream" uid="uid://b0cl5v6q1ocbv" path="res://sounds/ring1.ogg" id="2_2so43"]
[ext_resource type="AudioStream" uid="uid://cvvs74ep5d4wt" path="res://sounds/ring2.ogg" id="3_lkqw0"]
[sub_resource type="GDScript" id="GDScript_86vhg"]
script/source = "extends CSGTorus3D
var happy_material = preload(\"res://graphics/happy_material.tres\")
var collected = false
func _on_area_3d_body_entered(body: Node3D) -> void:
if collected == false and body.name == \"Sphere\":
print(\"YES \", body)
self.material = happy_material
collected = true
$AudioStreamPlayer.play()
"
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tgirv"]
radius = 4.0
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_251sn"]
random_pitch = 1.3
streams_count = 2
stream_0/stream = ExtResource("2_2so43")
stream_1/stream = ExtResource("3_lkqw0")
[node name="Ring" type="CSGTorus3D"]
use_collision = true
inner_radius = 4.0
outer_radius = 8.0
sides = 16
ring_sides = 8
material = ExtResource("1_48h5f")
script = SubResource("GDScript_86vhg")
[node name="Area3D" type="Area3D" parent="."]
@ -27,4 +41,7 @@ script = SubResource("GDScript_86vhg")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("CylinderShape3D_tgirv")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_251sn")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]

18
elements/sign.tscn Normal file
View file

@ -0,0 +1,18 @@
[gd_scene format=3 uid="uid://c77bli40240nk"]
[node name="Sign" type="Node3D"]
[node name="Text" type="Label3D" parent="."]
text = "Sample text"
font_size = 1024
[node name="CSGBox3D" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5.1)
use_collision = true
size = Vector3(80, 30, 10)
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -138.981, -5)
use_collision = true
radius = 4.0
height = 256.0

View file

@ -0,0 +1,5 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://df0n6u78ylb4h"]
[resource]
albedo_color = Color(1, 0, 1, 1)
metallic_specular = 0.0

View file

@ -1,17 +1,123 @@
[gd_scene load_steps=4 format=3 uid="uid://b0mhosbyt1fit"]
[gd_scene load_steps=6 format=3 uid="uid://b0mhosbyt1fit"]
[ext_resource type="Material" uid="uid://brwwlwb1rpro7" path="res://levels/base/material.tres" id="1_dwsqy"]
[ext_resource type="PackedScene" uid="uid://ygvokp5f78i5" path="res://levels/base/environment.tscn" id="1_n7fd8"]
[ext_resource type="PackedScene" uid="uid://cnnvwotv33u1b" path="res://elements/player.tscn" id="2_b00jj"]
[ext_resource type="PackedScene" uid="uid://cpm3laywhlbq5" path="res://elements/ring.tscn" id="3_hel5x"]
[ext_resource type="PackedScene" uid="uid://c77bli40240nk" path="res://elements/sign.tscn" id="4_atq6y"]
[node name="Level" type="Node3D"]
metadata/name = "base"
metadata/material = ExtResource("1_dwsqy")
[node name="Environment" parent="." instance=ExtResource("1_n7fd8")]
[node name="Player" parent="." instance=ExtResource("2_b00jj")]
[node name="Ring" parent="." instance=ExtResource("3_hel5x")]
[node name="Signs" type="Node3D" parent="."]
transform = Transform3D(-1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, -366.478, 20.7111, -61.4153)
[node name="Sign" parent="Signs" instance=ExtResource("4_atq6y")]
transform = Transform3D(-1, -8.74228e-08, 0, 8.74228e-08, -1, 0, 0, 0, 1, -366.478, 3.24249e-05, 0)
[node name="Text" parent="Signs/Sign" index="0"]
text = "Press the arrow keys
to change the gravity!"
[node name="Sign2" parent="Signs" instance=ExtResource("4_atq6y")]
transform = Transform3D(-1, -8.74228e-08, 0, 8.74228e-08, -1, 0, 0, 0, 1, -234.9, 2.09808e-05, 0)
[node name="Text" parent="Signs/Sign2" index="0"]
text = "While the shift key is pressed,
the gravity is much stronger!"
[node name="Sign4" parent="Signs" instance=ExtResource("4_atq6y")]
transform = Transform3D(-1, -8.74228e-08, 0, 8.74228e-08, -1, 0, 0, 0, 1, -131.629, 81.2564, 0)
[node name="Text" parent="Signs/Sign4" index="0"]
text = "You can take the rings
in any order!"
[node name="Sign5" parent="Signs" instance=ExtResource("4_atq6y")]
transform = Transform3D(-4.37114e-08, 8.74228e-08, 1, 0, -1, 8.74228e-08, 1, 3.82137e-15, 4.37114e-08, -490.634, 50.3763, 34.0693)
[node name="Text" parent="Signs/Sign5" index="0"]
text = "The level is over once
you get all rings!"
[node name="Sign6" parent="Signs" instance=ExtResource("4_atq6y")]
transform = Transform3D(-0.707107, 6.18172e-08, 0.707107, -8.74228e-08, -1, 0, 0.707107, -6.18172e-08, 0.707107, -532.475, 18.0064, 60)
[node name="Text" parent="Signs/Sign6" index="0"]
text = "Have fun!"
font_size = 2048
[node name="Sign3" parent="Signs" instance=ExtResource("4_atq6y")]
[node name="Text" parent="Signs/Sign3" index="0"]
transform = Transform3D(-1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0, 1, 0, 0, 0)
text = "The less time you take,
the more score you get!"
[node name="Rings" type="Node3D" parent="."]
[node name="Ring" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -3.18355, 0)
[node name="Ring2" parent="." instance=ExtResource("3_hel5x")]
transform = Transform3D(-6.55671e-08, -1.5, 0, 1.5, -6.55671e-08, 0, 0, 0, 1.5, 10, 5, 0)
[node name="Ring4" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -14.2868, 3.51514, 0)
[node name="Ring18" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 10.4967, 3.51514, 0)
[node name="Ring5" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -27.6263, 3.51514, 0)
[node name="Ring6" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -51.8171, 3.51514, 0)
[node name="Ring7" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, -65.1566, 3.51514, 0)
[node name="Ring3" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.9205, -3.18355, 0)
[node name="Ring2" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-6.55671e-08, -1.5, 0, 1.5, -6.55671e-08, 0, 0, 0, 1.5, 10, -16.4737, 0)
[node name="Ring8" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(1.06066, 1.06066, 0, -1.06066, 1.06066, 0, 0, 0, 1.5, -326.538, -16.4737, 0)
[node name="Ring14" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(0.707107, -0.707107, 0, 0.707107, 0.707107, 0, 0, 0, 1, -354.547, -11.0247, 0)
[node name="Ring15" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-0.105404, -1.99722, 0, 1.99722, -0.105404, 0, 0, 0, 2, -217.214, -66.3843, 0)
[node name="Ring16" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-0.079053, -1.49792, 0, 1.49792, -0.079053, 0, 0, 0, 1.5, -101.621, -65.3763, 0)
[node name="Ring17" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(-0.079053, -1.49792, 0, 1.49792, -0.079053, 0, 0, 0, 1.5, 125.89, -1.2963, 0)
[node name="Ring9" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(1.49977, -0.0263618, 0, 0.0263618, 1.49977, 0, 0, 0, 1.5, -459.613, -6.55224, 0)
[node name="Ring10" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(0.0287439, 1.49972, 0, -1.49972, 0.0287439, 0, 0, 0, 1.5, -440.296, 8.64172, 0)
[node name="Ring11" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(0.0229952, 1.19978, 0, -1.19978, 0.0229952, 0, 0, 0, 1.2, -430.715, 8.64172, 0)
[node name="Ring12" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(0.0172464, 0.899835, 0, -0.899835, 0.0172464, 0, 0, 0, 0.9, -422.376, 8.64172, 0)
[node name="Ring13" parent="Rings" instance=ExtResource("3_hel5x")]
transform = Transform3D(0.0114976, 0.59989, 0, -0.59989, 0.0114976, 0, 0, 0, 0.6, -414.274, 8.64172, 0)
[editable path="Signs/Sign"]
[editable path="Signs/Sign2"]
[editable path="Signs/Sign4"]
[editable path="Signs/Sign5"]
[editable path="Signs/Sign6"]
[editable path="Signs/Sign3"]

Binary file not shown.

View file

@ -29,7 +29,7 @@ buses/default_bus_layout=""
common/physics_ticks_per_second=120
common/max_physics_steps_per_frame=20
3d/physics_engine="GodotPhysics3D"
3d/default_gravity=10.0
3d/default_gravity=1.0
3d/solver/solver_iterations=40
3d/solver/default_contact_bias=1.0
common/physics_interpolation=true

BIN
sounds/ring1.ogg Normal file

Binary file not shown.

19
sounds/ring1.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://b0cl5v6q1ocbv"
path="res://.godot/imported/ring1.ogg-c5ad63d4306f2e7bf90aef52d5b9e2b1.oggvorbisstr"
[deps]
source_file="res://sounds/ring1.ogg"
dest_files=["res://.godot/imported/ring1.ogg-c5ad63d4306f2e7bf90aef52d5b9e2b1.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
sounds/ring2.ogg Normal file

Binary file not shown.

19
sounds/ring2.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://cvvs74ep5d4wt"
path="res://.godot/imported/ring2.ogg-74176717eaeee56d524f87e3f1fc75c2.oggvorbisstr"
[deps]
source_file="res://sounds/ring2.ogg"
dest_files=["res://.godot/imported/ring2.ogg-74176717eaeee56d524f87e3f1fc75c2.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

Binary file not shown.