diff --git a/Assets/.DS_Store b/Assets/.DS_Store index ff2e371..accb028 100644 Binary files a/Assets/.DS_Store and b/Assets/.DS_Store differ diff --git a/Assets/SFX/footsteps.wav b/Assets/SFX/footsteps.wav index a6f29ff..a683144 100644 Binary files a/Assets/SFX/footsteps.wav and b/Assets/SFX/footsteps.wav differ diff --git a/Assets/Scenes/GrenouilleVillage.unity b/Assets/Scenes/GrenouilleVillage.unity index 756d8c6..f3341b1 100644 --- a/Assets/Scenes/GrenouilleVillage.unity +++ b/Assets/Scenes/GrenouilleVillage.unity @@ -21189,7 +21189,7 @@ SpriteRenderer: m_SortingOrder: -1 m_Sprite: {fileID: 1768850514, guid: 111317b79023e9049b71c547d53ef9e6, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 1 + m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 m_Size: {x: 0.2, y: 0.87} @@ -21206,7 +21206,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1033726431} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 58.8, y: -1.12, z: 0.05524211} + m_LocalPosition: {x: 63.16, y: 2.15, z: 0.05524211} m_LocalScale: {x: 6, y: 6, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -22355,7 +22355,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1075726551} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 54.316, y: 1.39, z: 0} + m_LocalPosition: {x: 59.538, y: 4.66, z: 0} m_LocalScale: {x: 3, y: 3, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -28703,7 +28703,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1418452257} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 70.22, y: 1.97, z: 0.05524211} + m_LocalPosition: {x: 77.77, y: 2.04, z: 0.05524211} m_LocalScale: {x: 6, y: 6, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -28755,7 +28755,7 @@ SpriteRenderer: m_SortingOrder: -1 m_Sprite: {fileID: 1768850514, guid: 111317b79023e9049b71c547d53ef9e6, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 1 + m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 m_Size: {x: 0.2, y: 0.87} @@ -39106,7 +39106,11 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_Radius - value: 2.2205286 + value: 1.92 + objectReference: {fileID: 0} + - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} + propertyPath: m_Offset.x + value: -0.75 objectReference: {fileID: 0} - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_Offset.y @@ -39118,7 +39122,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalScale.x - value: 0.19692631 + value: 0.3718835 objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalScale.y @@ -39126,7 +39130,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalPosition.x - value: 0.0011997223 + value: -0.08628 objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalPosition.y @@ -41644,6 +41648,10 @@ PrefabInstance: propertyPath: m_Radius value: 2.2205286 objectReference: {fileID: 0} + - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} + propertyPath: m_Offset.x + value: -0.99 + objectReference: {fileID: 0} - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_Offset.y value: -7.9313927 @@ -41658,7 +41666,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalScale.x - value: 0.19610907 + value: 0.36381567 objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalScale.y @@ -41666,7 +41674,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalPosition.x - value: 0.00161 + value: -0.08224 objectReference: {fileID: 0} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} propertyPath: m_LocalPosition.y diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index ebd6f91..8e460bf 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -90,18 +90,6 @@ public class PlayerMovement : MonoBehaviour } else { this._moveInput = Vector2.zero; } - - if (!IsJumping && !_isJumpFalling && !isRegFalling && value.Get().x != 0) { - if (!soundPlaying) { - print("footsteps PLAY"); - audioSource.Play(); - soundPlaying = true; - } - } else if (audioSource.isPlaying && audioSource.clip.name == "footsteps") { - print("footsteps stop"); - audioSource.Stop(); - soundPlaying = false; - } } void OnJump() @@ -227,6 +215,14 @@ public class PlayerMovement : MonoBehaviour gameObject.transform.Find("Trumpet").GetComponent().Play(); } } + + // stop sound if needed + if (soundPlaying && (isRegFalling || IsJumping || _isJumpFalling)) { + print("footsteps stop"); + audioSource.Stop(); + soundPlaying = false; + } + //WALL JUMP // else if (CanWallJump() && LastPressedJumpTime > 0) // { @@ -292,6 +288,20 @@ public class PlayerMovement : MonoBehaviour SetGravityScale(Data.gravityScale); } #endregion + + #region SOUND CHECKS + if (!IsJumping && !_isJumpFalling && !isRegFalling && _moveInput.x != 0) { + if (!soundPlaying) { + // print("footsteps PLAY"); + audioSource.Play(); + soundPlaying = true; + } + } else if (soundPlaying && audioSource.clip.name == "footsteps") { + // print("footsteps stop"); + audioSource.Stop(); + soundPlaying = false; + } + #endregion } private void FixedUpdate() @@ -380,15 +390,6 @@ public class PlayerMovement : MonoBehaviour //Convert this to a vector and apply to rigidbody RB.AddForce(movement * Vector2.right, ForceMode2D.Force); - // play sound - // if (!IsJumping && movement != 0) { - // if (!audioSource.isPlaying) { - // audioSource.Play(); - // } - // } else if (audioSource.isPlaying && audioSource.clip.name == "footsteps") { - // audioSource.Stop(); - // } - /* * For those interested here is what AddForce() will do * RB.velocity = new Vector2(RB.velocity.x + (Time.fixedDeltaTime * speedDif * accelRate) / RB.mass, RB.velocity.y);