Skip to content

Commit

Permalink
refractoring code
Browse files Browse the repository at this point in the history
  • Loading branch information
anonomity committed Mar 30, 2021
1 parent a03a6d9 commit d170c87
Show file tree
Hide file tree
Showing 36 changed files with 69 additions and 32 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified Assets/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Animations/QuestionMarkCoin1.controller
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ AnimatorStateTransition:
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
Expand Down
4 changes: 2 additions & 2 deletions Assets/MushroomBox.controller
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ AnimatorStateTransition:
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0
m_HasExitTime: 1
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
Expand Down Expand Up @@ -118,7 +118,7 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
Expand Down
21 changes: 11 additions & 10 deletions Assets/Prefabs/Mario.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ MonoBehaviour:
m_GameObject: {fileID: 5338456846625713673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 92cabb8a63ed047e2bac5b9ed1c79576, type: 3}
m_Script: {fileID: 11500000, guid: 67c2fdeec1b914e5f91a3861c14453be, type: 3}
m_Name:
m_EditorClassIdentifier:
playerSpeed: 10
playerJumpPower: 1250
isGrounded: 0
distanceToBottomOfPlayer: 1.2
hasDied: 0
health: 0
--- !u!114 &5338456846625713683
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -160,11 +158,14 @@ MonoBehaviour:
m_GameObject: {fileID: 5338456846625713673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be271dcb76c5248a1beb0ac19f05e35c, type: 3}
m_Script: {fileID: 11500000, guid: 9d0951c05f44b422996b96a80b764173, type: 3}
m_Name:
m_EditorClassIdentifier:
hasDied: 0
health: 0
playerSpeed: 10
playerJumpPower: 1750
isGrounded: 1
isBoxHit: 0
isBig: 0
--- !u!114 &2011549780772668684
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -174,12 +175,12 @@ MonoBehaviour:
m_GameObject: {fileID: 5338456846625713673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bf12432c3542c4c1c8de4afee6d35ac1, type: 3}
m_Script: {fileID: 11500000, guid: c29f5b9af24044a68a4b3e86c47235cd, type: 3}
m_Name:
m_EditorClassIdentifier:
playerScore: 0
timeLeftUI: {fileID: 0}
playerScoreUI: {fileID: 0}
playerCoinUI: {fileID: 0}
--- !u!95 &5338456846625713682
Animator:
serializedVersion: 3
Expand Down
Binary file added Assets/Scripts/.DS_Store
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Scripts/Boxes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Scripts/Boxes/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Assets/Scripts/Enemy.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Scripts/Enemy/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Assets/Scripts/GameState.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Scripts/GameState/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions Assets/Scripts/Player.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Scripts/Player/.DS_Store
Binary file not shown.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Player_Move : MonoBehaviour
{

public int playerSpeed = 10;
public int playerJumpPower = 1250;
public int playerJumpPower = 1750;
private float moveX;
private float moveY;
public bool isGrounded = true;
Expand All @@ -21,36 +21,40 @@ public class Player_Move : MonoBehaviour
void Update()
{
PlayerRaycast();
PlayerMove();
// if (isGrounded == false)
// {
// playerSpeed = 5;
// }
// else
// {
// playerSpeed = 10;
// }
AnimationChecks();

}

private void FixedUpdate()
{
PlayerMove();
}
void PlayerMove()
{
moveX = Input.GetAxis("Horizontal");
moveY = Input.GetAxis("Vertical");

if (Input.GetButtonDown("Jump"))
if (Input.GetButtonDown("Jump") && isGrounded)
{
if (isGrounded == true && this.gameObject.GetComponent<Rigidbody2D>().velocity.y == 0f)
{

Jump();

}
Jump();



}

if (isGrounded == false)
{
playerSpeed = 5;
}
else
{
playerSpeed = 10;
}
AnimationChecks();




gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(moveX * playerSpeed, gameObject.GetComponent<Rigidbody2D>().velocity.y);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d170c87

Please sign in to comment.