Improved dash skill
This commit is contained in:
parent
4c518e93c9
commit
3b2d8514a3
@ -5,9 +5,10 @@ extends Node
|
||||
func _enter_tree():
|
||||
connect_main()
|
||||
connect_ui()
|
||||
pause(true)
|
||||
|
||||
func _ready():
|
||||
pause(true)
|
||||
|
||||
var args := OS.get_cmdline_args()
|
||||
var offline := args.has("--offline")
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=35 format=3 uid="uid://b40y7iuskv1ar"]
|
||||
[gd_scene load_steps=36 format=3 uid="uid://b40y7iuskv1ar"]
|
||||
|
||||
[ext_resource type="Script" path="res://Main.gd" id="1_cw3ws"]
|
||||
[ext_resource type="Script" path="res://network/Client.gd" id="2_8hxcx"]
|
||||
@ -29,6 +29,7 @@
|
||||
[ext_resource type="Material" uid="uid://dw754wh1xcwgr" path="res://world/trees/LeafMaterial1.tres" id="21_v66do"]
|
||||
[ext_resource type="Material" uid="uid://cxlib6jo32hxg" path="res://world/trees/LeafMaterial2.tres" id="22_k67l0"]
|
||||
[ext_resource type="Material" uid="uid://c8o7cihkhrqf6" path="res://world/trees/LeafMaterial3.tres" id="23_lxn2x"]
|
||||
[ext_resource type="AudioStream" uid="uid://b36mntcqlt553" path="res://assets/audio/ambience/Wind-Vegetation-Leaves-Gusts.wav" id="30_b3a1m"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_he5c5"]
|
||||
diffuse_mode = 3
|
||||
@ -131,6 +132,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.5, 0)
|
||||
shape = SubResource("BoxShape3D_yg2lt")
|
||||
|
||||
[node name="Grass" type="MultiMeshInstance3D" parent="World"]
|
||||
visible = false
|
||||
layers = 2
|
||||
material_override = ExtResource("18_tja64")
|
||||
cast_shadow = 0
|
||||
@ -142,7 +144,7 @@ scene = ExtResource("20_xjraj")
|
||||
noise = SubResource("FastNoiseLite_xy4ll")
|
||||
size_x = 100.0
|
||||
size_z = 100.0
|
||||
step = 10.0
|
||||
step = 15.0
|
||||
density = 0.3
|
||||
scale_max = 2.0
|
||||
|
||||
@ -172,6 +174,11 @@ tilt = 0.15
|
||||
|
||||
[node name="Follow" parent="World" instance=ExtResource("12_aljdh")]
|
||||
|
||||
[node name="Ambience" type="AudioStreamPlayer" parent="World"]
|
||||
stream = ExtResource("30_b3a1m")
|
||||
autoplay = true
|
||||
bus = &"Ambience"
|
||||
|
||||
[node name="Players" type="Node3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource("16_dp6bj")
|
||||
|
@ -4,11 +4,13 @@ extends Node
|
||||
var state: StateComponent
|
||||
var animation: AnimationComponent
|
||||
var voice: VoiceComponent
|
||||
var movement: MovementComponent
|
||||
|
||||
func _enter_tree():
|
||||
state = get_parent().get_node("State") as StateComponent
|
||||
animation = get_parent().get_node("Animation") as AnimationComponent
|
||||
voice = get_parent().get_node("Voice") as VoiceComponent
|
||||
movement = get_parent().get_node("Movement") as MovementComponent
|
||||
state.current = StateComponent.State.Skill
|
||||
|
||||
func end():
|
||||
|
@ -1,6 +1,27 @@
|
||||
extends SkillInstance
|
||||
|
||||
var direction: Vector3
|
||||
|
||||
func _ready():
|
||||
animation.play("human/roll")
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
direction = movement.direction
|
||||
|
||||
if direction == Vector3.ZERO:
|
||||
direction = (get_parent() as CharacterBody3D).global_basis.z
|
||||
|
||||
movement.set_physics_process(false)
|
||||
set_physics_process(true)
|
||||
animation.play("human/dash")
|
||||
await get_tree().create_timer(0.3).timeout
|
||||
movement.set_physics_process(true)
|
||||
set_physics_process(false)
|
||||
end()
|
||||
|
||||
func _physics_process(_delta):
|
||||
if movement.direction:
|
||||
direction = movement.direction
|
||||
|
||||
var body := get_parent() as CharacterBody3D
|
||||
body.velocity.x = direction.x * movement.move_speed * 3.0
|
||||
body.velocity.y = 0
|
||||
body.velocity.z = direction.z * movement.move_speed * 3.0
|
||||
body.move_and_slide()
|
@ -273,7 +273,7 @@ layout_mode = 2
|
||||
[node name="Voices" parent="VBoxContainer/TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Environment" parent="VBoxContainer/TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")]
|
||||
[node name="Ambience" parent="VBoxContainer/TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Skills" parent="VBoxContainer/TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[gd_resource type="AudioBusLayout" load_steps=2 format=3 uid="uid://c4mndkm5mss5f"]
|
||||
|
||||
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_f5en5"]
|
||||
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_hjj00"]
|
||||
resource_name = "Reverb"
|
||||
|
||||
[resource]
|
||||
@ -22,13 +22,13 @@ bus/3/mute = false
|
||||
bus/3/bypass_fx = false
|
||||
bus/3/volume_db = -10.0741
|
||||
bus/3/send = &"Master"
|
||||
bus/4/name = &"Environment"
|
||||
bus/4/name = &"Ambience"
|
||||
bus/4/solo = false
|
||||
bus/4/mute = false
|
||||
bus/4/bypass_fx = false
|
||||
bus/4/volume_db = -25.0
|
||||
bus/4/volume_db = -12.9785
|
||||
bus/4/send = &"Master"
|
||||
bus/4/effect/0/effect = SubResource("AudioEffectReverb_f5en5")
|
||||
bus/4/effect/0/effect = SubResource("AudioEffectReverb_hjj00")
|
||||
bus/4/effect/0/enabled = true
|
||||
bus/5/name = &"Footsteps"
|
||||
bus/5/solo = false
|
||||
|
@ -16,6 +16,11 @@ func _ready():
|
||||
if !visible:
|
||||
return
|
||||
|
||||
rebuild()
|
||||
|
||||
func rebuild():
|
||||
remove_children()
|
||||
|
||||
for x in range(-size_x, size_x, step):
|
||||
for z in range(-size_z, size_z, step):
|
||||
if noise.get_noise_2d(x, z) < 1 - density * 2:
|
||||
@ -38,3 +43,9 @@ func generate(x: int, z: int) -> Node3D:
|
||||
t.scale = Vector3(uniform_scale, uniform_scale, uniform_scale)
|
||||
|
||||
return t
|
||||
|
||||
func remove_children():
|
||||
var num_children = get_child_count()
|
||||
|
||||
for n in range(num_children):
|
||||
get_child(num_children - 1 - n).queue_free()
|
Loading…
Reference in New Issue
Block a user