diff --git a/Assets/NoFriction.physicsMaterial2D b/Assets/NoFriction.physicsMaterial2D new file mode 100644 index 0000000..194a4b4 Binary files /dev/null and b/Assets/NoFriction.physicsMaterial2D differ diff --git a/Assets/NoFriction.physicsMaterial2D.meta b/Assets/NoFriction.physicsMaterial2D.meta new file mode 100644 index 0000000..25788a1 --- /dev/null +++ b/Assets/NoFriction.physicsMaterial2D.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2708844edbe2bd94198883d15bdd1682 +timeCreated: 1447746544 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Platform.prefab b/Assets/Prefabs/Platform.prefab new file mode 100644 index 0000000..af7b450 Binary files /dev/null and b/Assets/Prefabs/Platform.prefab differ diff --git a/Assets/Prefabs/Platform.prefab.meta b/Assets/Prefabs/Platform.prefab.meta new file mode 100644 index 0000000..9ef5e8c --- /dev/null +++ b/Assets/Prefabs/Platform.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0a34e04c50c7fdb478b9f3537d04975b +timeCreated: 1447741601 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab new file mode 100644 index 0000000..f0dc5e8 Binary files /dev/null and b/Assets/Prefabs/Player.prefab differ diff --git a/Assets/Prefabs/Player.prefab.meta b/Assets/Prefabs/Player.prefab.meta new file mode 100644 index 0000000..5ef77b4 --- /dev/null +++ b/Assets/Prefabs/Player.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9152fa60b3ecb934d91e92cf9081789d +timeCreated: 1447741591 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/test.unity b/Assets/Scenes/test.unity index de4ee0e..a374d99 100644 Binary files a/Assets/Scenes/test.unity and b/Assets/Scenes/test.unity differ diff --git a/Assets/Scripts/PlayerScript.cs b/Assets/Scripts/PlayerScript.cs new file mode 100644 index 0000000..e4f6f20 --- /dev/null +++ b/Assets/Scripts/PlayerScript.cs @@ -0,0 +1,35 @@ +using UnityEngine; +using System.Collections; + +public class PlayerScript : MonoBehaviour { + public float speed; + public float jumpStrength; + public Transform groundChecker; // A point on the player, used to check for ground. + public LayerMask groundLayerMask; // Only check for ground using ground, and nothing else. + + private float groundCheckerRadius; // How large of a circle the checker is. + private bool grounded; // Whether the player is on the ground, for jump checking. + private Rigidbody2D rigidbody2D; + + + void Start () { + // Get the player's rigidbody2D component for movement uses. + rigidbody2D = GetComponent(); + groundCheckerRadius = GetComponent().radius; + print(groundCheckerRadius); + } + + + // Update is called once per frame. + void Update () { + // Make player move left or right, depending on which key is pressed. + rigidbody2D.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * speed, rigidbody2D.velocity.y); + + grounded = Physics2D.OverlapCircle(groundChecker.position, groundCheckerRadius, groundLayerMask); + print(grounded); + if (grounded && Input.GetButton("Jump")) { + rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, jumpStrength); + grounded = false; + } + } +} diff --git a/Assets/Scripts/PlayerScript.cs.meta b/Assets/Scripts/PlayerScript.cs.meta new file mode 100644 index 0000000..6c18dc3 --- /dev/null +++ b/Assets/Scripts/PlayerScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a0c85a2a3a86d804abfaf10113c8408e +timeCreated: 1447741807 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/Platform.png b/Assets/Sprites/Platform.png index f6f70fe..0e39a53 100644 Binary files a/Assets/Sprites/Platform.png and b/Assets/Sprites/Platform.png differ diff --git a/Assets/Sprites/Player.png b/Assets/Sprites/Player.png new file mode 100644 index 0000000..ac1558e Binary files /dev/null and b/Assets/Sprites/Player.png differ diff --git a/Assets/Sprites/Player.png.meta b/Assets/Sprites/Player.png.meta new file mode 100644 index 0000000..78c2042 --- /dev/null +++ b/Assets/Sprites/Player.png.meta @@ -0,0 +1,55 @@ +fileFormatVersion: 2 +guid: d3bbcbfb34fd891459bf26dc1612d3b0 +timeCreated: 1447741431 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: 16 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 632de21..41e08da 100644 Binary files a/ProjectSettings/InputManager.asset and b/ProjectSettings/InputManager.asset differ diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 23ee63f..e487664 100644 Binary files a/ProjectSettings/TagManager.asset and b/ProjectSettings/TagManager.asset differ