1
Fork 0
mirror of https://github.com/Steffo99/cinnos.git synced 2025-02-16 16:13:57 +00:00

Particles

This commit is contained in:
Steffo 2023-11-25 16:00:26 +01:00
parent 6c7db038e4
commit 9d1ccdc2d2
2 changed files with 26 additions and 8 deletions

View file

@ -44,17 +44,14 @@ func _physics_process(delta):
var input_change = input_dir * input_accel
velocity.x += input_change.x * delta
velocity.z += input_change.y * delta
if is_on_floor():
velocity /= (1 + delta * friction)
if velocity.length() < 0.3 and input_dir.is_zero_approx():
velocity *= 0
move_and_slide()
if input_dir.length() > 0.01:
last_direction = input_dir
$Board/PlayerPart.emitting = true
else:
$Board/PlayerPart.emitting = false
rotation.y = last_direction.normalized().angle_to(Vector2.UP)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://4whij2hmts0t"]
[gd_scene load_steps=20 format=3 uid="uid://4whij2hmts0t"]
[ext_resource type="Script" path="res://Player.gd" id="1_wt4gx"]
[ext_resource type="Material" uid="uid://dondfiavgo2ws" path="res://Unshaded.material" id="2_upp15"]
@ -25,6 +25,14 @@ material = ExtResource("2_upp15")
material = ExtResource("2_upp15")
size = Vector3(1, 0.1, 3)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lw6u7"]
shading_mode = 0
albedo_color = Color(0.435294, 0.615686, 1, 1)
[sub_resource type="BoxMesh" id="BoxMesh_ry4bk"]
material = SubResource("StandardMaterial3D_lw6u7")
size = Vector3(0.3, 0.3, 0.3)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lkb30"]
albedo_texture = ExtResource("3_gtnhv")
@ -118,6 +126,7 @@ script = ExtResource("3_y362g")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.927202, 0)
script = ExtResource("1_wt4gx")
input_accel = 8.0
friction = 0.99
[node name="Man" type="CollisionShape3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.05, 0)
@ -127,13 +136,25 @@ shape = SubResource("CapsuleShape3D_castg")
mesh = SubResource("CapsuleMesh_pnmjt")
skeleton = NodePath("../..")
[node name="Board" type="CollisionShape3D" parent="Player"]
[node name="Board" type="Node3D" parent="Player"]
[node name="Mesh" type="MeshInstance3D" parent="Player/Board"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
mesh = SubResource("BoxMesh_4tnse")
skeleton = NodePath("../..")
[node name="PlayerPart" type="CPUParticles3D" parent="Player/Board"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1.5)
emitting = false
amount = 30
mesh = SubResource("BoxMesh_ry4bk")
direction = Vector3(0, 0, 1)
spread = 35.0
flatness = 1.0
gravity = Vector3(0, 0, 0)
initial_velocity_min = 8.0
initial_velocity_max = 8.0
[node name="Plane" type="StaticBody3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Plane"]