This commit is contained in:
Taevas 2025-02-22 17:16:30 +01:00
parent 6a31ab76b8
commit 3b56cd4c81
30 changed files with 352 additions and 173 deletions

34
elements/collectible.tscn Normal file
View file

@ -0,0 +1,34 @@
[gd_scene load_steps=3 format=3 uid="uid://bwxor1n3m4d4a"]
[sub_resource type="GDScript" id="GDScript_f1obc"]
script/source = "extends Area3D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_body_entered(body: Node3D) -> void:
print(body, \" !!\")
pass # Replace with function body.
"
[sub_resource type="SphereShape3D" id="SphereShape3D_lnm1h"]
radius = 1.0
[node name="Collectible" type="Area3D"]
script = SubResource("GDScript_f1obc")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_lnm1h")
[node name="CSGSphere3D" type="CSGSphere3D" parent="."]
radius = 1.0
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View file

@ -1,18 +1,17 @@
[gd_scene load_steps=7 format=3 uid="uid://dw0xl8644x166"]
[gd_scene load_steps=8 format=3 uid="uid://dw0xl8644x166"]
[ext_resource type="Texture2D" uid="uid://ctjugvy1v3y6b" path="res://graphics/arrow.svg" id="1_4mbho"]
[ext_resource type="AudioStream" uid="uid://dmdbharecy448" path="res://sounds/gravity.ogg" id="2_5uwlw"]
[sub_resource type="GDScript" id="GDScript_wuka5"]
script/source = "extends HSlider
[sub_resource type="GDScript" id="GDScript_3yq1l"]
script/source = "extends Control
# Maybe change it so it's not a slider, but just a value that... depends on the mouse position?
# Or a value that's only high if the user is pressing shift, à la catch the beat
const normal = 7
const stronger = normal * 3
func _on_value_changed(value: float) -> void:
PhysicsServer3D.area_set_param(get_viewport().find_world_3d().space, PhysicsServer3D.AREA_PARAM_GRAVITY, value)
func _on_focus_entered() -> void:
release_focus()
func _process(delta: float) -> void:
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)
"
[sub_resource type="GDScript" id="GDScript_my602"]
@ -30,24 +29,34 @@ func _input(ev: InputEvent) -> void:
if k == KEY_UP:
direction = Vector3.UP
self.rotation_degrees = -90
$AudioStreamPlayer.pitch_scale = 1.05
elif k == KEY_LEFT:
direction = Vector3.LEFT
self.rotation_degrees = -180
$AudioStreamPlayer.pitch_scale = 1.02
elif k == KEY_RIGHT:
direction = Vector3.RIGHT
self.rotation_degrees = 0
$AudioStreamPlayer.pitch_scale = 0.98
elif k == KEY_DOWN:
direction = Vector3.DOWN
self.rotation_degrees = 90
PhysicsServer3D.area_set_param(
get_viewport().find_world_3d().space,
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR,
direction
)
$AudioStreamPlayer.pitch_scale = 0.95
if $AnimationPlayer.is_playing():
$AnimationPlayer.stop()
$AnimationPlayer.play(\"grow_fadeout\")
if direction != PhysicsServer3D.area_get_param(
get_viewport().find_world_3d().space,
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR
):
PhysicsServer3D.area_set_param(
get_viewport().find_world_3d().space,
PhysicsServer3D.AREA_PARAM_GRAVITY_VECTOR,
direction
)
if $AnimationPlayer.is_playing():
$AnimationPlayer.stop()
$AudioStreamPlayer.play()
$AnimationPlayer.play(\"grow_fadeout\")
"
[sub_resource type="Animation" id="Animation_6rwl4"]
@ -119,46 +128,33 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Strength" type="HSlider" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.2
anchor_top = 0.9
anchor_right = 0.8
anchor_bottom = 1.0
offset_right = -0.00012207
grow_horizontal = 2
grow_vertical = 0
size_flags_horizontal = 4
size_flags_vertical = 1
min_value = 10.0
max_value = 40.0
step = 0.2
value = 10.0
script = SubResource("GDScript_wuka5")
metadata/_edit_use_anchors_ = true
script = SubResource("GDScript_3yq1l")
[node name="Direction" type="TextureRect" parent="."]
self_modulate = Color(1, 1, 1, 0.501961)
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -400.0
offset_top = -400.0
offset_right = 400.0
offset_bottom = 400.0
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.3, 0.3)
pivot_offset = Vector2(576, 324)
pivot_offset = Vector2(400, 400)
texture = ExtResource("1_4mbho")
expand_mode = 3
stretch_mode = 5
script = SubResource("GDScript_my602")
metadata/_edit_use_anchors_ = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="Direction"]
libraries = {
"": SubResource("AnimationLibrary_0w0ne")
}
[connection signal="focus_entered" from="Strength" to="Strength" method="_on_focus_entered"]
[connection signal="value_changed" from="Strength" to="Strength" method="_on_value_changed"]
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Direction"]
stream = ExtResource("2_5uwlw")
volume_db = -6.0
mix_target = 2

View file

@ -1,23 +0,0 @@
[gd_scene load_steps=3 format=3 uid="uid://gis4s061n422"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_llioc"]
[sub_resource type="BoxShape3D" id="BoxShape3D_shtld"]
size = Vector3(20, 20, 20)
[node name="Platform" type="RigidBody3D"]
axis_lock_linear_x = true
axis_lock_linear_y = true
axis_lock_linear_z = true
axis_lock_angular_x = true
axis_lock_angular_y = true
axis_lock_angular_z = true
physics_material_override = SubResource("PhysicsMaterial_llioc")
gravity_scale = 0.0
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_shtld")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
use_collision = true
size = Vector3(20, 20, 20)

View file

@ -4,11 +4,19 @@
[ext_resource type="PackedScene" uid="uid://df5m716pd6mej" path="res://elements/sphere.tscn" id="2_ophnk"]
[sub_resource type="GDScript" id="GDScript_bnqcw"]
script/source = "extends Node
script/source = "extends Node3D
func _process(delta: float) -> void:
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
$SpotLightRight.position = $Sphere.position
$SpotLightBottom.position = $Sphere.position
## Keep the ball at the center of the camera, at a distance
$Camera.position = $Sphere.position + Vector3(0, 0, 20)
$Camera.position = $Sphere.position + Vector3(0, 0, 15)
## Angle of the camera, so the player can see where the ball is going
var velocity: Vector3 = $Sphere.linear_velocity
@ -25,7 +33,7 @@ func _process(delta: float) -> void:
$Camera.fov = default_fov + (total_velocity / 12)
"
[node name="Player" type="Node"]
[node name="Player" type="Node3D"]
script = SubResource("GDScript_bnqcw")
[node name="Gravity" parent="." instance=ExtResource("1_h0h2o")]
@ -33,3 +41,25 @@ script = SubResource("GDScript_bnqcw")
[node name="Sphere" parent="." instance=ExtResource("2_ophnk")]
[node name="Camera" type="Camera3D" parent="."]
current = true
[node name="SpotLightMain" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
spot_range = 55.0
spot_angle = 20.0
[node name="SpotLightTop" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0)
spot_range = 50.0
[node name="SpotLightLeft" type="SpotLight3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
spot_range = 50.0
[node name="SpotLightRight" type="SpotLight3D" parent="."]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0, 0, 0)
spot_range = 50.0
[node name="SpotLightBottom" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
spot_range = 50.0

30
elements/ring.tscn Normal file
View file

@ -0,0 +1,30 @@
[gd_scene load_steps=3 format=3 uid="uid://cpm3laywhlbq5"]
[sub_resource type="GDScript" id="GDScript_86vhg"]
script/source = "extends CSGTorus3D
var collected = false
func _on_area_3d_body_entered(body: Node3D) -> void:
if collected == false and body.name == \"Sphere\":
print(\"YES \", body)
collected = true
"
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tgirv"]
radius = 4.0
[node name="Ring" type="CSGTorus3D"]
use_collision = true
inner_radius = 4.0
outer_radius = 8.0
sides = 16
ring_sides = 8
script = SubResource("GDScript_86vhg")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("CylinderShape3D_tgirv")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=9 format=3 uid="uid://df5m716pd6mej"]
[gd_scene load_steps=10 format=3 uid="uid://df5m716pd6mej"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_vumbr"]
bounce = 0.8
bounce = 0.2
[sub_resource type="GDScript" id="GDScript_rvq6k"]
script/source = "extends RigidBody3D
@ -46,7 +46,7 @@ func _ready() -> void:
player.play()
func handleMusicWithVelocity(velocity: float, delta: float) -> void:
var instruments_needed = floor(velocity / 10)
var instruments_needed = floor(velocity / 7)
var instruments_playing = stream_players.filter(func(p: AudioStreamPlayer): return p.volume_db > -50)
for index_p in len(instruments_playing):
@ -74,16 +74,19 @@ func _process(delta: float) -> void:
[sub_resource type="SphereShape3D" id="SphereShape3D_xfgrm"]
[sub_resource type="Gradient" id="Gradient_ggbpc"]
colors = PackedColorArray(0.979416, 0, 0.376508, 1, 0, 0.583757, 0.65245, 1)
[sub_resource type="Gradient" id="Gradient_bgp4x"]
colors = PackedColorArray(0.942957, 7.89344e-06, 0.597148, 1, 0, 0.9912, 0.9912, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_vxsyc"]
gradient = SubResource("Gradient_ggbpc")
fill_from = Vector2(0.490476, 0)
fill_to = Vector2(0.504762, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_5d6uk"]
gradient = SubResource("Gradient_bgp4x")
fill_from = Vector2(0.504951, 0.00495049)
fill_to = Vector2(0.549505, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_14eku"]
albedo_texture = SubResource("GradientTexture2D_vxsyc")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qcgmu"]
albedo_texture = SubResource("GradientTexture2D_5d6uk")
[sub_resource type="SphereMesh" id="SphereMesh_bor8g"]
material = SubResource("StandardMaterial3D_qcgmu")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_4tofj"]
direction = Vector3(0, 0, 0)
@ -96,17 +99,17 @@ radial_segments = 8
rings = 4
[node name="Sphere" type="RigidBody3D"]
collision_priority = 100.0
axis_lock_linear_z = true
physics_material_override = SubResource("PhysicsMaterial_vumbr")
contact_monitor = true
script = SubResource("GDScript_rvq6k")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("SphereShape3D_xfgrm")
[node name="CSGSphere3D" type="CSGSphere3D" parent="."]
radial_segments = 20
rings = 10
material = SubResource("StandardMaterial3D_14eku")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("SphereMesh_bor8g")
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
amount = 16