Changed bottom

This commit is contained in:
Bruno Rybársky 2021-07-21 09:54:17 +02:00
parent a4c22ed754
commit b8eb84a9c5
3 changed files with 8 additions and 2 deletions

@ -7,5 +7,5 @@ PhysicsMaterial2D:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_Name: Slippery m_Name: Slippery
friction: 0 friction: 10
bounciness: 0.9 bounciness: 0.9

@ -5336,7 +5336,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 484806140} m_GameObject: {fileID: 484806140}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 8.24, y: 2.352011, z: 1} m_LocalPosition: {x: 8.24, y: 2.352011, z: 4}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 8146526} m_Father: {fileID: 8146526}
@ -6149,6 +6149,8 @@ MonoBehaviour:
sprite: {fileID: 1174924376} sprite: {fileID: 1174924376}
bottom: {fileID: 6200000, guid: 2c0538ecede9d3b43867ca45f72ba04b, type: 2} bottom: {fileID: 6200000, guid: 2c0538ecede9d3b43867ca45f72ba04b, type: 2}
controller: {fileID: 1174924383} controller: {fileID: 1174924383}
topx: 5
bottomx: 4
sfx: {fileID: 367000705} sfx: {fileID: 367000705}
runspeed: 40 runspeed: 40
--- !u!1 &1195437271 --- !u!1 &1195437271

@ -12,6 +12,8 @@ public class PlayerControls : MonoBehaviour
public SpriteRenderer sprite; public SpriteRenderer sprite;
public PhysicsMaterial2D bottom; public PhysicsMaterial2D bottom;
public CharacterController2D controller; public CharacterController2D controller;
public RigidbodyConstraints2D topx;
public RigidbodyConstraints2D bottomx;
public AudioSource sfx; public AudioSource sfx;
public float runspeed = 40f; public float runspeed = 40f;
float horizonatalaxis = 0f; float horizonatalaxis = 0f;
@ -36,11 +38,13 @@ public class PlayerControls : MonoBehaviour
switchy = !switchy; switchy = !switchy;
if (switchy){ if (switchy){
sprite.flipY = true; sprite.flipY = true;
rb.constraints = topx;
rb.sharedMaterial = top; rb.sharedMaterial = top;
controller.m_JumpForce = controller.m_JumpForce * 1.2f; controller.m_JumpForce = controller.m_JumpForce * 1.2f;
} }
else { else {
sprite.flipY = false; sprite.flipY = false;
rb.constraints = bottomx;
rb.sharedMaterial = bottom; rb.sharedMaterial = bottom;
controller.m_JumpForce = controller.m_JumpForce * 0.8f; controller.m_JumpForce = controller.m_JumpForce * 0.8f;
} }