made some changes to double jump

This commit is contained in:
Bryanna 2023-04-28 16:18:50 -07:00
parent db0e7665f7
commit ac035cecf9
3 changed files with 61 additions and 17 deletions

View File

@ -1282,7 +1282,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 1
m_Sprite: {fileID: 1217184404, guid: 111317b79023e9049b71c547d53ef9e6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -2271,7 +2271,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: 3
m_Sprite: {fileID: -1673959225, guid: 111317b79023e9049b71c547d53ef9e6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -4215,7 +4215,7 @@ SpriteRenderer:
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: 76fcde544015cf346bb5c4f298140474, type: 3}
m_Color: {r: 1, g: 1, b: 0.7254902, a: 1}
m_FlipX: 0
@ -5324,6 +5324,10 @@ PrefabInstance:
propertyPath: m_Offset.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4489883303814393335, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_SortingOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5269081590298199107, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_Constraints
value: 1
@ -7426,6 +7430,10 @@ PrefabInstance:
propertyPath: m_Offset.y
value: -0.0013582557
objectReference: {fileID: 0}
- target: {fileID: 4489883303814393335, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_SortingOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5269081590298199107, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_Constraints
value: 1
@ -8305,7 +8313,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3781786539254097561, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_LocalPosition.x
value: 50.854
value: 50.8
objectReference: {fileID: 0}
- target: {fileID: 3781786539254097561, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_LocalPosition.y
@ -8343,6 +8351,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4410162585455081168, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_SortingOrder
value: -1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -9057,7 +9069,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 3781786539254097561, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_LocalPosition.y
value: -0.122
value: -0.11
objectReference: {fileID: 0}
- target: {fileID: 3781786539254097561, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_LocalPosition.z
@ -9091,6 +9103,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: -47.934
objectReference: {fileID: 0}
- target: {fileID: 4410162585455081168, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_SortingOrder
value: -2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -9816,6 +9832,10 @@ PrefabInstance:
propertyPath: m_Offset.y
value: -0.0013582557
objectReference: {fileID: 0}
- target: {fileID: 4489883303814393335, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_SortingOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5269081590298199107, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_Constraints
value: 1
@ -11950,7 +11970,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1033726431}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 31.63, y: 1.6402353, z: 0.05524211}
m_LocalPosition: {x: 30.88, y: 1.6402353, z: 0.05524211}
m_LocalScale: {x: 5, y: 5, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@ -12231,6 +12251,10 @@ PrefabInstance:
propertyPath: m_Offset.y
value: -0.000000014901161
objectReference: {fileID: 0}
- target: {fileID: 4489883303814393335, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_SortingOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 5269081590298199107, guid: b4de2c0f6f97dfd4889c636185501814, type: 3}
propertyPath: m_Constraints
value: 1
@ -15471,6 +15495,10 @@ PrefabInstance:
propertyPath: m_DrawMode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4410162585455081168, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_SortingOrder
value: -2
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -15626,6 +15654,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4410162585455081168, guid: 9230d7cbf1bbf0046a4d642090b875f3, type: 3}
propertyPath: m_SortingOrder
value: -1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
@ -19781,6 +19813,10 @@ PrefabInstance:
propertyPath: m_ConstrainProportionsScale
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5885597207104481987, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_SortingOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5885597207104481989, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
propertyPath: m_ConnectedAnchor.x
value: -12.5

View File

@ -171,7 +171,7 @@ public class PlayerBehavior : MonoBehaviour
}
else if (col.tag == "Trumpet")
{
this.playerController.in_range = true;
this.playerController.in_range = false;
this.playerController.enemy = null;
}
}

View File

@ -29,8 +29,8 @@ public class PlayerMovement : MonoBehaviour
public float LastOnWallTime { get; private set; }
public float LastOnWallRightTime { get; private set; }
public float LastOnWallLeftTime { get; private set; }
private bool trumpet = false;
public int trumpet = 0;
public bool in_range = false;
public GameObject enemy;
@ -97,9 +97,12 @@ public class PlayerMovement : MonoBehaviour
CheckDirectionToFace(_moveInput.x > 0);
#endregion
if (!IsJumping) {
if (!IsJumping)
{
print("not jumping");
} else {
}
else
{
print("jumping, " + RB.velocity.y);
}
@ -110,7 +113,7 @@ public class PlayerMovement : MonoBehaviour
if (IsGrounded()) //checks if set box overlaps with ground
{
LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
trumpet = true;
trumpet = 2;
}
//Right Wall Check
@ -159,12 +162,15 @@ public class PlayerMovement : MonoBehaviour
_isJumpCut = false;
_isJumpFalling = false;
Jump();
if (!IsGrounded() && in_range && trumpet) {
if (!IsGrounded() && in_range && trumpet > 0)
{
Destroy(enemy.gameObject);
enemy = null;
in_range = false;
} else if (!IsGrounded() && !in_range && trumpet) {
trumpet = false;
}
else if (!IsGrounded() && !in_range && trumpet > 0)
{
trumpet -= 1;
}
}
//WALL JUMP
@ -395,7 +401,8 @@ public class PlayerMovement : MonoBehaviour
private bool CanJump()
{
if (!IsGrounded() && trumpet) {
if (!IsGrounded() && trumpet > 0)
{
return true;
}
return LastOnGroundTime > 0 && !IsJumping;
@ -425,7 +432,8 @@ public class PlayerMovement : MonoBehaviour
return false;
}
public bool IsGrounded() {
public bool IsGrounded()
{
// print(Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
return (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping);
}