Merge pull request #19 from NathanLovato/main

Update to Godot 4.3, fix AnimationPlayer blending issue in Godot 4.3
pull/20/head
Kenney 2024-08-17 16:21:46 +07:00 committed by GitHub
commit 036eb8caa9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 3673 additions and 60 deletions

@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/lilita_one_regular.ttf-68cc4ab6825bdd499d1ad6
Rendering=null Rendering=null
antialiasing=1 antialiasing=1
generate_mipmaps=false generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false multichannel_signed_distance_field=false
msdf_pixel_range=8 msdf_pixel_range=8
msdf_size=48 msdf_size=48

File diff suppressed because it is too large Load Diff

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -17,6 +17,7 @@ nodes/root_type="Node3D"
nodes/root_name="Scene Root" nodes/root_name="Scene Root"
nodes/apply_root_scale=true nodes/apply_root_scale=true
nodes/root_scale=1.0 nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/generate_lods=true meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
@ -28,6 +29,7 @@ animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/naming_version=0 gltf/naming_version=0

@ -24,3 +24,4 @@ transform = Transform3D(1, 0, 0, 0, 0.999999, 0, 0, 0, 0.999999, 0, 0.6, 0)
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
deterministic = true deterministic = true
playback_default_blend_time = 0.2

@ -33,21 +33,6 @@ shape = SubResource("CapsuleShape3D_gdq8c")
[node name="Character" parent="." instance=ExtResource("2_nero3")] [node name="Character" parent="." instance=ExtResource("2_nero3")]
[node name="leg-left" parent="Character/character/root" index="0"]
transform = Transform3D(0.965926, 0, 0.258819, 0, 1, 0, -0.258819, 0, 0.965926, 0.125, 0.17625, -0.02375)
[node name="leg-right" parent="Character/character/root" index="1"]
transform = Transform3D(0.965926, 0, -0.258819, 0, 1, 0, 0.258819, 0, 0.965926, -0.125, 0.17625, -0.02375)
[node name="torso" parent="Character/character/root" index="2"]
transform = Transform3D(1, 0, 0, 0, 0.996194, 0.0871557, 0, -0.0871557, 0.996194, -1.80478e-15, 0.17625, -0.02375)
[node name="arm-left" parent="Character/character/root/torso" index="0"]
transform = Transform3D(0.707107, 0.707107, 0, -0.707107, 0.707107, 0, 0, 0, 1, 0.3, 0.175, 0)
[node name="arm-right" parent="Character/character/root/torso" index="1"]
transform = Transform3D(0.707107, -0.707107, 0, 0.707107, 0.707107, 0, 0, 0, 1, -0.3, 0.1195, 0)
[node name="Shadow" type="Decal" parent="."] [node name="Shadow" type="Decal" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
size = Vector3(1, 2, 1) size = Vector3(1, 2, 1)

@ -28,119 +28,120 @@ var coins = 0
# Functions # Functions
func _physics_process(delta): func _physics_process(delta):
# Handle functions # Handle functions
handle_controls(delta) handle_controls(delta)
handle_gravity(delta) handle_gravity(delta)
handle_effects(delta) handle_effects(delta)
# Movement # Movement
var applied_velocity: Vector3 var applied_velocity: Vector3
applied_velocity = velocity.lerp(movement_velocity, delta * 10) applied_velocity = velocity.lerp(movement_velocity, delta * 10)
applied_velocity.y = -gravity applied_velocity.y = -gravity
velocity = applied_velocity velocity = applied_velocity
move_and_slide() move_and_slide()
# Rotation # Rotation
if Vector2(velocity.z, velocity.x).length() > 0: if Vector2(velocity.z, velocity.x).length() > 0:
rotation_direction = Vector2(velocity.z, velocity.x).angle() rotation_direction = Vector2(velocity.z, velocity.x).angle()
rotation.y = lerp_angle(rotation.y, rotation_direction, delta * 10) rotation.y = lerp_angle(rotation.y, rotation_direction, delta * 10)
# Falling/respawning # Falling/respawning
if position.y < -10: if position.y < -10:
get_tree().reload_current_scene() get_tree().reload_current_scene()
# Animation for scale (jumping and landing) # Animation for scale (jumping and landing)
model.scale = model.scale.lerp(Vector3(1, 1, 1), delta * 10) model.scale = model.scale.lerp(Vector3(1, 1, 1), delta * 10)
# Animation when landing # Animation when landing
if is_on_floor() and gravity > 2 and !previously_floored: if is_on_floor() and gravity > 2 and !previously_floored:
model.scale = Vector3(1.25, 0.75, 1.25) model.scale = Vector3(1.25, 0.75, 1.25)
Audio.play("res://sounds/land.ogg") Audio.play("res://sounds/land.ogg")
previously_floored = is_on_floor() previously_floored = is_on_floor()
# Handle animation(s) # Handle animation(s)
func handle_effects(delta): func handle_effects(delta):
particles_trail.emitting = false particles_trail.emitting = false
sound_footsteps.stream_paused = true sound_footsteps.stream_paused = true
if is_on_floor(): if is_on_floor():
var horizontal_velocity = Vector2(velocity.x, velocity.z) var horizontal_velocity = Vector2(velocity.x, velocity.z)
var speed_factor = horizontal_velocity.length() / movement_speed / delta var speed_factor = horizontal_velocity.length() / movement_speed / delta
if speed_factor > 0.05: if speed_factor > 0.05:
animation.play("walk", 0.5, speed_factor) if animation.current_animation != "walk":
animation.play("walk")
if speed_factor > 0.3: if speed_factor > 0.3:
sound_footsteps.stream_paused = false sound_footsteps.stream_paused = false
sound_footsteps.pitch_scale = speed_factor sound_footsteps.pitch_scale = speed_factor
if speed_factor > 0.75: if speed_factor > 0.75:
particles_trail.emitting = true particles_trail.emitting = true
else: elif animation.current_animation != "idle":
animation.play("idle", 0.5) animation.play("idle")
else: elif animation.current_animation != "jump":
animation.play("jump", 0.5) animation.play("jump")
# Handle movement input # Handle movement input
func handle_controls(delta): func handle_controls(delta):
# Movement # Movement
var input := Vector3.ZERO var input := Vector3.ZERO
input.x = Input.get_axis("move_left", "move_right") input.x = Input.get_axis("move_left", "move_right")
input.z = Input.get_axis("move_forward", "move_back") input.z = Input.get_axis("move_forward", "move_back")
input = input.rotated(Vector3.UP, view.rotation.y) input = input.rotated(Vector3.UP, view.rotation.y)
if input.length() > 1: if input.length() > 1:
input = input.normalized() input = input.normalized()
movement_velocity = input * movement_speed * delta movement_velocity = input * movement_speed * delta
# Jumping # Jumping
if Input.is_action_just_pressed("jump"): if Input.is_action_just_pressed("jump"):
if jump_single or jump_double: if jump_single or jump_double:
jump() jump()
# Handle gravity # Handle gravity
func handle_gravity(delta): func handle_gravity(delta):
gravity += 25 * delta gravity += 25 * delta
if gravity > 0 and is_on_floor(): if gravity > 0 and is_on_floor():
jump_single = true jump_single = true
gravity = 0 gravity = 0
# Jumping # Jumping
func jump(): func jump():
Audio.play("res://sounds/jump.ogg") Audio.play("res://sounds/jump.ogg")
gravity = -jump_strength gravity = -jump_strength
model.scale = Vector3(0.5, 1.5, 0.5) model.scale = Vector3(0.5, 1.5, 0.5)
if jump_single: if jump_single:
jump_single = false; jump_single = false;
jump_double = true; jump_double = true;
@ -150,7 +151,7 @@ func jump():
# Collecting coins # Collecting coins
func collect_coin(): func collect_coin():
coins += 1 coins += 1
coin_collected.emit(coins) coin_collected.emit(coins)