fixed footsteps

also @bryanna i moved the grapple poles in the village so they can be reached without the trumpet jump
This commit is contained in:
Sam 2023-05-01 15:06:45 -07:00
parent d2d10f064b
commit d1528cc6ff
4 changed files with 40 additions and 31 deletions

BIN
Assets/.DS_Store vendored

Binary file not shown.

Binary file not shown.

View File

@ -21189,7 +21189,7 @@ SpriteRenderer:
m_SortingOrder: -1 m_SortingOrder: -1
m_Sprite: {fileID: 1768850514, guid: 111317b79023e9049b71c547d53ef9e6, type: 3} m_Sprite: {fileID: 1768850514, guid: 111317b79023e9049b71c547d53ef9e6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 0.2, y: 0.87} m_Size: {x: 0.2, y: 0.87}
@ -21206,7 +21206,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1033726431} m_GameObject: {fileID: 1033726431}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 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_LocalScale: {x: 6, y: 6, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -22355,7 +22355,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1075726551} m_GameObject: {fileID: 1075726551}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 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_LocalScale: {x: 3, y: 3, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
@ -28703,7 +28703,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1418452257} m_GameObject: {fileID: 1418452257}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 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_LocalScale: {x: 6, y: 6, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
@ -28755,7 +28755,7 @@ SpriteRenderer:
m_SortingOrder: -1 m_SortingOrder: -1
m_Sprite: {fileID: 1768850514, guid: 111317b79023e9049b71c547d53ef9e6, type: 3} m_Sprite: {fileID: 1768850514, guid: 111317b79023e9049b71c547d53ef9e6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1} m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 1 m_FlipX: 0
m_FlipY: 0 m_FlipY: 0
m_DrawMode: 0 m_DrawMode: 0
m_Size: {x: 0.2, y: 0.87} m_Size: {x: 0.2, y: 0.87}
@ -39106,7 +39106,11 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_Radius 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} objectReference: {fileID: 0}
- target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_Offset.y propertyPath: m_Offset.y
@ -39118,7 +39122,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 0.19692631 value: 0.3718835
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
@ -39126,7 +39130,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0.0011997223 value: -0.08628
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
@ -41644,6 +41648,10 @@ PrefabInstance:
propertyPath: m_Radius propertyPath: m_Radius
value: 2.2205286 value: 2.2205286
objectReference: {fileID: 0} 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} - target: {fileID: 1025473297745678352, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_Offset.y propertyPath: m_Offset.y
value: -7.9313927 value: -7.9313927
@ -41658,7 +41666,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 0.19610907 value: 0.36381567
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
@ -41666,7 +41674,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: 0.00161 value: -0.08224
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3} - target: {fileID: 8452658923215583967, guid: 94c7d43583a3b46c58e7d4e253eae896, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y

View File

@ -90,18 +90,6 @@ public class PlayerMovement : MonoBehaviour
} else { } else {
this._moveInput = Vector2.zero; this._moveInput = Vector2.zero;
} }
if (!IsJumping && !_isJumpFalling && !isRegFalling && value.Get<Vector2>().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() void OnJump()
@ -227,6 +215,14 @@ public class PlayerMovement : MonoBehaviour
gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play(); gameObject.transform.Find("Trumpet").GetComponent<AudioSource>().Play();
} }
} }
// stop sound if needed
if (soundPlaying && (isRegFalling || IsJumping || _isJumpFalling)) {
print("footsteps stop");
audioSource.Stop();
soundPlaying = false;
}
//WALL JUMP //WALL JUMP
// else if (CanWallJump() && LastPressedJumpTime > 0) // else if (CanWallJump() && LastPressedJumpTime > 0)
// { // {
@ -292,6 +288,20 @@ public class PlayerMovement : MonoBehaviour
SetGravityScale(Data.gravityScale); SetGravityScale(Data.gravityScale);
} }
#endregion #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() private void FixedUpdate()
@ -380,15 +390,6 @@ public class PlayerMovement : MonoBehaviour
//Convert this to a vector and apply to rigidbody //Convert this to a vector and apply to rigidbody
RB.AddForce(movement * Vector2.right, ForceMode2D.Force); 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 * 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); * RB.velocity = new Vector2(RB.velocity.x + (Time.fixedDeltaTime * speedDif * accelRate) / RB.mass, RB.velocity.y);