better in-game timer
as in, use `_process()` and add a number could you lag on purpose before finishing to cut time? probably not
This commit is contained in:
parent
4afec6386c
commit
df7736a9d1
10 changed files with 180 additions and 190 deletions
|
@ -1,10 +1,10 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cnnvwotv33u1b"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dw0xl8644x166" path="res://elements/gravity.tscn" id="1_h0h2o"]
|
||||
[ext_resource type="PackedScene" uid="uid://df5m716pd6mej" path="res://elements/sphere.tscn" id="2_ophnk"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://cnnvwotv33u1b"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_bnqcw"]
|
||||
script/source = "extends Node3D
|
||||
script/source = "class_name Player
|
||||
extends Node3D
|
||||
|
||||
var velocity: Vector3 = Vector3(0, 0, 0)
|
||||
|
||||
func _physics_process(_delta: float) -> void:
|
||||
$SpotLightMain.position = $Sphere.position + Vector3(0, 5, 0)
|
||||
|
@ -17,7 +17,7 @@ func _physics_process(_delta: float) -> void:
|
|||
$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
|
||||
velocity = $Sphere.linear_velocity
|
||||
var desired_x = max(min(velocity.y, 35), -35)
|
||||
var desired_y = max(min(-velocity.x, 50), -50)
|
||||
var difference_x = $Camera.rotation_degrees.x - desired_x
|
||||
|
@ -31,13 +31,43 @@ func _physics_process(_delta: float) -> void:
|
|||
$Camera.fov = default_fov + (total_velocity / 12)
|
||||
"
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_vumbr"]
|
||||
bounce = 0.2
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_xfgrm"]
|
||||
|
||||
[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_5d6uk"]
|
||||
gradient = SubResource("Gradient_bgp4x")
|
||||
fill_from = Vector2(0.504951, 0.00495049)
|
||||
fill_to = Vector2(0.549505, 1)
|
||||
|
||||
[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)
|
||||
gravity = Vector3(0, 0, 0)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2ybet"]
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_color = Color(0, 0.734117, 0.734117, 1)
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_1m3ut"]
|
||||
material = SubResource("StandardMaterial3D_2ybet")
|
||||
radius = 0.2
|
||||
height = 0.4
|
||||
radial_segments = 8
|
||||
rings = 4
|
||||
|
||||
[node name="Player" type="Node3D"]
|
||||
script = SubResource("GDScript_bnqcw")
|
||||
|
||||
[node name="Gravity" parent="." instance=ExtResource("1_h0h2o")]
|
||||
|
||||
[node name="Sphere" parent="." instance=ExtResource("2_ophnk")]
|
||||
|
||||
[node name="Camera" type="Camera3D" parent="."]
|
||||
current = true
|
||||
|
||||
|
@ -61,3 +91,20 @@ 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
|
||||
|
||||
[node name="Sphere" type="RigidBody3D" parent="."]
|
||||
collision_priority = 100.0
|
||||
axis_lock_linear_z = true
|
||||
physics_material_override = SubResource("PhysicsMaterial_vumbr")
|
||||
contact_monitor = true
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Sphere"]
|
||||
shape = SubResource("SphereShape3D_xfgrm")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="Sphere"]
|
||||
mesh = SubResource("SphereMesh_bor8g")
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="Sphere"]
|
||||
amount = 16
|
||||
process_material = SubResource("ParticleProcessMaterial_4tofj")
|
||||
draw_pass_1 = SubResource("SphereMesh_1m3ut")
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
[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
|
||||
script/source = "class_name Ring
|
||||
extends CSGTorus3D
|
||||
|
||||
var happy_material = preload(\"res://graphics/happy_material.tres\")
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://df5m716pd6mej"]
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_vumbr"]
|
||||
bounce = 0.2
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_xfgrm"]
|
||||
|
||||
[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_5d6uk"]
|
||||
gradient = SubResource("Gradient_bgp4x")
|
||||
fill_from = Vector2(0.504951, 0.00495049)
|
||||
fill_to = Vector2(0.549505, 1)
|
||||
|
||||
[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)
|
||||
gravity = Vector3(0, 0, 0)
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2ybet"]
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_color = Color(0, 0.734117, 0.734117, 1)
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_1m3ut"]
|
||||
material = SubResource("StandardMaterial3D_2ybet")
|
||||
radius = 0.2
|
||||
height = 0.4
|
||||
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
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_xfgrm")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_bor8g")
|
||||
|
||||
[node name="GPUParticles3D" type="GPUParticles3D" parent="."]
|
||||
amount = 16
|
||||
process_material = SubResource("ParticleProcessMaterial_4tofj")
|
||||
draw_pass_1 = SubResource("SphereMesh_1m3ut")
|
Loading…
Add table
Add a link
Reference in a new issue