From c78ed41bfd59267d9b67fa13950a16ac7f96b83d Mon Sep 17 00:00:00 2001 From: Forsoothatooth <56567039+Forsoothatooth@users.noreply.github.com> Date: Thu, 7 Nov 2019 17:32:51 -0500 Subject: [PATCH] Added animation to movement, improved overheating --- Animations/SpriteSheets.meta | 8 + Animations/SpriteSheets/commandofly.png | Bin 0 -> 444 bytes Animations/SpriteSheets/commandofly.png.meta | 197 ++++++++++ Animations/SpriteSheets/commandoidle.png | Bin 0 -> 307 bytes Animations/SpriteSheets/commandoidle.png.meta | 149 ++++++++ Animations/SpriteSheets/commandorun.png | Bin 0 -> 578 bytes Animations/SpriteSheets/commandorun.png.meta | 293 +++++++++++++++ Animations/bluecircle.controller | 338 ++++++++++++++++++ Animations/bluecircle.controller.meta | 8 + Animations/flying.anim | 81 +++++ Animations/flying.anim.meta | 8 + Animations/playerIdle.anim | 73 ++++ Animations/playerIdle.anim.meta | 8 + Animations/playerMove.anim | 97 +++++ Animations/playerMove.anim.meta | 8 + Movement.cs | 129 +++++++ Movement.cs.meta | 11 + 17 files changed, 1408 insertions(+) create mode 100644 Animations/SpriteSheets.meta create mode 100644 Animations/SpriteSheets/commandofly.png create mode 100644 Animations/SpriteSheets/commandofly.png.meta create mode 100644 Animations/SpriteSheets/commandoidle.png create mode 100644 Animations/SpriteSheets/commandoidle.png.meta create mode 100644 Animations/SpriteSheets/commandorun.png create mode 100644 Animations/SpriteSheets/commandorun.png.meta create mode 100644 Animations/bluecircle.controller create mode 100644 Animations/bluecircle.controller.meta create mode 100644 Animations/flying.anim create mode 100644 Animations/flying.anim.meta create mode 100644 Animations/playerIdle.anim create mode 100644 Animations/playerIdle.anim.meta create mode 100644 Animations/playerMove.anim create mode 100644 Animations/playerMove.anim.meta create mode 100644 Movement.cs create mode 100644 Movement.cs.meta diff --git a/Animations/SpriteSheets.meta b/Animations/SpriteSheets.meta new file mode 100644 index 0000000..487144a --- /dev/null +++ b/Animations/SpriteSheets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 025f31df0c7984091a36f6a93894c77c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Animations/SpriteSheets/commandofly.png b/Animations/SpriteSheets/commandofly.png new file mode 100644 index 0000000000000000000000000000000000000000..e42b034b6061d5bdf985052aa33f9ece218a667e GIT binary patch literal 444 zcmV;t0YmYAX9X8WNB|8RBvx=!KdMT0003; zNklclB3$P}z(>=J{7iM3@#9+y09bF@D27;5@b%q2LNp~+{h|PT%%=SEH1FJtExs-@&PQjk z^CbXaay#w0U^xRwE?;tFg5+60PF&2Fd!rc mefqltdDxqTX8`n-WPJngoOk#O9n25_00004nJh^c}wqi2xH2cV#I ziEBhjaDG}zd16s2gL7(5ab>YWa7k%OX1+p5etyouIEHu}PyX}&zx`nk zww@&{2d?W||1&l)Fevz3VZbNGAMk3~MFs^k20qhU|EC*=Cnf+vz=s*9Z#-J|asTfl z(riG`)<6Fqk4M9T-JNNS9}?U@{a3AZ4?Mzl>+^}cO`FBiH>|ez2wO5?3R6PP?qAK# zO56wTl)QN1y-B%s2}46<$mZ9_7H~3n-8In(Vo=RfvSRr0)8$|NpD%5KZv1Tw3)*IP z@HL2;_x?BCoo8_9#X$jvD+QM`xFlXOGB6xq+V`^jZRAv-PZ&I1{an^LB{Ts5;aGT2 literal 0 HcmV?d00001 diff --git a/Animations/SpriteSheets/commandoidle.png.meta b/Animations/SpriteSheets/commandoidle.png.meta new file mode 100644 index 0000000..1f4e3fb --- /dev/null +++ b/Animations/SpriteSheets/commandoidle.png.meta @@ -0,0 +1,149 @@ +fileFormatVersion: 2 +guid: 0471a4694f89343eea7f6503ee5a54ef +TextureImporter: + internalIDToNameTable: + - first: + 213: 9045660559749480445 + second: commandoidle_0 + - first: + 213: -8202225496785474199 + second: commandoidle_1 + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 2 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 10 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 2 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - serializedVersion: 2 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: + - serializedVersion: 2 + name: commandoidle_0 + rect: + serializedVersion: 2 + x: 9 + y: 0 + width: 8 + height: 11 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 58fbc3f4b12f14d33bf736ccd81fb8c4 + internalID: 9045660559749480445 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: commandoidle_1 + rect: + serializedVersion: 2 + x: 46 + y: 0 + width: 8 + height: 11 + alignment: 0 + pivot: {x: 0.5, y: 0.5} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 25cd42e34385540a1a6db12ef322f70d + internalID: -8202225496785474199 + vertices: [] + indices: + edges: [] + weights: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: e1153d80b90c344c58e200ffb8a3a48f + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Animations/SpriteSheets/commandorun.png b/Animations/SpriteSheets/commandorun.png new file mode 100644 index 0000000000000000000000000000000000000000..2c2a14391e95ba6d5144efa5c5ffc91da9ec6585 GIT binary patch literal 578 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K56gb#`Jdec8W>!D%1EB; zG4m`t_nUFU9tP{)8)u(IZn@kMyIr!np6S_6vGx1E#P|N|{&~-y@tWxYE3*UXA1k-1 zM2hUs;k*BOeN%(Z^?CJ8UoQLnwA}E6eM0)Qoy<%BF|J8&*d%`8(bxQ$9Zsj$9lE8< t8nblocfE$A2QKg@ow)g?cJKK=`kHCI_xt@n?f`}}gQu&X%Q~loCICqM_R#(); + plStats = GetComponent(); + speed = plStats.speed; + chargeAmt = plStats.chargeAmt; + overheated = false; + isRight = true; + timer = 0; + // isFlying = false; + } + + // Update is called once per frame + void FixedUpdate() + { + + + spaced = Input.GetKey(KeyCode.Space) || (Input.GetKey(KeyCode.Space) && Input.anyKey); + if (!spaced || overheated) + { + rise -= 0.8f; + if (rise <= 0f) + rise = 0f; + rigid.velocity = new Vector2(Mathf.Lerp(0f, Input.GetAxis("Horizontal") * speed, 0.8f), rigid.velocity.y); + timer++; + } + + + if(spaced && !overheated &&chargeAmt >= 0) + { + if (rise <= 5) + rise += 0.4f; + timer = 0; + if(rigid.velocity.y <= 0) + rigid.velocity = new Vector2(Mathf.Lerp(0f, Input.GetAxis("Horizontal") * speed, 0.8f), Mathf.Lerp(rigid.velocity.y, rise, 0.8f)); + else + rigid.velocity = new Vector2(Mathf.Lerp(0f, Input.GetAxis("Horizontal") * speed, 0.8f), Mathf.Lerp(0f, rise, 0.8f)); + + chargeAmt--; + GetComponentInChildren().x -= (1/ plStats.chargeAmt); + + if (spaced && chargeAmt <= 0) + { + transform.GetChild(1).transform.Rotate(0,90,0); + overheated = true; + rigid.gravityScale = 1f; + + } + + } + if (chargeAmt >= 60 && overheated) + { + transform.GetChild(1).transform.Rotate(0, -90, 0); + overheated = false; + } + if (overheated && rigid.velocity.magnitude <= 2 && timer >= 180) + { + chargeAmt += 2; + this.GetComponentInChildren().x += 2 / plStats.chargeAmt; + + } + else if (chargeAmt <= plStats.chargeAmt && timer >= 90) + { + this.GetComponentInChildren().x += 1/plStats.chargeAmt; + chargeAmt++; + } + + + var mov = Input.GetAxis("Horizontal"); + // print(chargeAmt); + if (isRight && mov < 0) + { + isRight = false; + this.transform.Rotate(new Vector3(0, 180f, 0)); + } + else if (!isRight && mov > 0) + { + isRight = true; + this.transform.Rotate(new Vector3(0, 180f, 0)); + } + if (!overheated && !isGrounded) + { + isMoving = false; + isFlying = true; + } + else + { + isFlying = false; + if (mov <= 0.15f && mov >= -0.15f) + isMoving = false; + else + isMoving = true; + + } + animator.SetBool("moving", isMoving); + animator.SetBool("flying", isFlying); + } + private void OnTriggerStay2D(Collider2D other) + { + print("Grounde"); + isGrounded = rigid.velocity.y <= 0.1f && rigid.velocity.y >= -0.1f; + + } +} diff --git a/Movement.cs.meta b/Movement.cs.meta new file mode 100644 index 0000000..0ce46de --- /dev/null +++ b/Movement.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e3e41bcdf6bb430ca50111b08096144 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: