From 0ac18a9022a228c250a3c48255f5eccdb69a7916 Mon Sep 17 00:00:00 2001 From: jasoncramer Date: Mon, 4 May 2020 21:51:55 -0400 Subject: [PATCH] change spike art and add comments --- .../Environment/Images/FullSpikes.png | 3 + .../Environment/Images/FullSpikes.png.meta | 110 +++++++++++ .../Resources/Environment/Tiles/spikes.asset | 2 +- Sidescroller/Assets/Scenes/Level.unity | 187 +++++++++--------- Sidescroller/Assets/Scripts/BirdContoller.cs | 3 + Sidescroller/Assets/Scripts/Gameflow.cs | 4 + Sidescroller/Assets/Scripts/SniperShoot.cs | 7 + Sidescroller/Assets/Scripts/TimeKeeper.cs | 3 + 8 files changed, 222 insertions(+), 97 deletions(-) create mode 100644 Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png create mode 100644 Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png.meta diff --git a/Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png b/Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png new file mode 100644 index 0000000..51f95bf --- /dev/null +++ b/Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85635d240483fcceea36dfa1dc5d5d810d0ed409b06185bbd6c83da2a1a90f52 +size 3609 diff --git a/Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png.meta b/Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png.meta new file mode 100644 index 0000000..99c2621 --- /dev/null +++ b/Sidescroller/Assets/Resources/Environment/Images/FullSpikes.png.meta @@ -0,0 +1,110 @@ +fileFormatVersion: 2 +guid: 6274c628228002644b7b053e9ed2b3fa +TextureImporter: + fileIDToRecycleName: {} + externalObjects: {} + serializedVersion: 9 + 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: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 128 + 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 + - serializedVersion: 2 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 78cf891db0ae21c45a217cb146c4a4e0 + vertices: [] + indices: + edges: [] + weights: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Sidescroller/Assets/Resources/Environment/Tiles/spikes.asset b/Sidescroller/Assets/Resources/Environment/Tiles/spikes.asset index 275e8b6..6394c6b 100644 --- a/Sidescroller/Assets/Resources/Environment/Tiles/spikes.asset +++ b/Sidescroller/Assets/Resources/Environment/Tiles/spikes.asset @@ -12,7 +12,7 @@ MonoBehaviour: m_Script: {fileID: 13312, guid: 0000000000000000e000000000000000, type: 0} m_Name: spikes m_EditorClassIdentifier: - m_Sprite: {fileID: 21300000, guid: af4664612f911e24f93c74cccf94bd4b, type: 3} + m_Sprite: {fileID: 21300000, guid: 6274c628228002644b7b053e9ed2b3fa, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_Transform: e00: 1 diff --git a/Sidescroller/Assets/Scenes/Level.unity b/Sidescroller/Assets/Scenes/Level.unity index 382eb9f..72b37a1 100644 --- a/Sidescroller/Assets/Scenes/Level.unity +++ b/Sidescroller/Assets/Scenes/Level.unity @@ -3253,24 +3253,6 @@ Tilemap: m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 - - first: {x: -2, y: 1, z: 0} - second: - m_TileIndex: 1 - m_TileSpriteIndex: 1 - m_TileMatrixIndex: 1 - m_TileColorIndex: 0 - m_ObjectToInstantiate: {fileID: 0} - m_TileFlags: 1 - m_ColliderType: 1 - - first: {x: -1, y: 1, z: 0} - second: - m_TileIndex: 1 - m_TileSpriteIndex: 1 - m_TileMatrixIndex: 1 - m_TileColorIndex: 0 - m_ObjectToInstantiate: {fileID: 0} - m_TileFlags: 1 - m_ColliderType: 1 - first: {x: 0, y: 1, z: 0} second: m_TileIndex: 0 @@ -4589,13 +4571,15 @@ Tilemap: m_TileAssetArray: - m_RefCount: 270 m_Data: {fileID: 11400000, guid: 20145ae991e61f341a47ed0f27a14cca, type: 2} - - m_RefCount: 2 - m_Data: {fileID: 11400000, guid: 8ca854ca348a7fa45a893cc2c67c198a, type: 2} + - m_RefCount: 0 + m_Data: {fileID: 0} m_TileSpriteArray: - m_RefCount: 270 m_Data: {fileID: 21300000, guid: 069068ea91cd7ba43bbd0e64bc076b7e, type: 3} - - m_RefCount: 2 - m_Data: {fileID: 21300000, guid: af4664612f911e24f93c74cccf94bd4b, type: 3} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 0 + m_Data: {fileID: 0} m_TileMatrixArray: - m_RefCount: 270 m_Data: @@ -4615,24 +4599,24 @@ Tilemap: e31: 0 e32: 0 e33: 1 - - m_RefCount: 2 + - m_RefCount: 0 m_Data: - e00: 0 - e01: 1 - e02: 0 - e03: 0 - e10: -1 - e11: 0 - e12: 0 + e00: 3.6160448e-16 + e01: NaN + e02: 141.3451 + e03: 8.785054e-39 + e10: 3.9284e-41 + e11: NaN + e12: 1e-45 e13: 0 - e20: 0 - e21: 0 - e22: 1 - e23: 0 + e20: 8.787206e-39 + e21: 2.3249066 + e22: 2.2834458 + e23: -0.0000030707129 e30: 0 - e31: 0 - e32: 0 - e33: 1 + e31: 1e-45 + e32: 1e-45 + e33: 4.5914e-41 - m_RefCount: 0 m_Data: e00: -7.185826e+26 @@ -4652,7 +4636,7 @@ Tilemap: e32: 1e-45 e33: 4.5908e-41 m_TileColorArray: - - m_RefCount: 272 + - m_RefCount: 270 m_Data: {r: 1, g: 1, b: 1, a: 1} m_AnimationFrameRate: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} @@ -5900,8 +5884,8 @@ Tilemap: - first: {x: 8, y: -6, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 0 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 2 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5909,8 +5893,8 @@ Tilemap: - first: {x: -12, y: -5, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 0 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 2 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5918,8 +5902,8 @@ Tilemap: - first: {x: 8, y: -5, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 0 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 2 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5927,8 +5911,8 @@ Tilemap: - first: {x: 8, y: -4, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 0 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 2 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5936,8 +5920,8 @@ Tilemap: - first: {x: 8, y: -3, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 0 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 2 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5945,8 +5929,8 @@ Tilemap: - first: {x: -18, y: -1, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 3 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5954,8 +5938,8 @@ Tilemap: - first: {x: 13, y: -1, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 3 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5963,8 +5947,8 @@ Tilemap: - first: {x: 16, y: -1, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 3 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5972,8 +5956,8 @@ Tilemap: - first: {x: 17, y: -1, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 3 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5981,17 +5965,8 @@ Tilemap: - first: {x: -2, y: 1, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 - m_TileColorIndex: 0 - m_ObjectToInstantiate: {fileID: 0} - m_TileFlags: 1 - m_ColliderType: 1 - - first: {x: -1, y: 1, z: 0} - second: - m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 3 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 @@ -5999,28 +5974,66 @@ Tilemap: - first: {x: 12, y: 4, z: 0} second: m_TileIndex: 0 - m_TileSpriteIndex: 0 - m_TileMatrixIndex: 1 + m_TileSpriteIndex: 1 + m_TileMatrixIndex: 3 m_TileColorIndex: 0 m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 m_AnimatedTiles: {} m_TileAssetArray: - - m_RefCount: 12 + - m_RefCount: 11 m_Data: {fileID: 11400000, guid: 8ca854ca348a7fa45a893cc2c67c198a, type: 2} m_TileSpriteArray: - - m_RefCount: 12 - m_Data: {fileID: 21300000, guid: af4664612f911e24f93c74cccf94bd4b, type: 3} + - m_RefCount: 0 + m_Data: {fileID: 0} + - m_RefCount: 11 + m_Data: {fileID: 21300000, guid: 6274c628228002644b7b053e9ed2b3fa, type: 3} m_TileMatrixArray: + - m_RefCount: 0 + m_Data: + e00: 3.6160448e-16 + e01: NaN + e02: 141.3451 + e03: 8.785054e-39 + e10: 3.9284e-41 + e11: NaN + e12: 1e-45 + e13: 0 + e20: 8.787206e-39 + e21: 2.3249066 + e22: 2.2834458 + e23: -0.0000030707129 + e30: 0 + e31: 1e-45 + e32: 1e-45 + e33: 4.5914e-41 + - m_RefCount: 0 + m_Data: + e00: 3.6160448e-16 + e01: NaN + e02: 141.3451 + e03: 8.785054e-39 + e10: 3.9284e-41 + e11: NaN + e12: 1e-45 + e13: 0 + e20: 8.787206e-39 + e21: 2.3249066 + e22: 2.2834458 + e23: -0.0000030707129 + e30: 0 + e31: 1e-45 + e32: 1e-45 + e33: 4.5914e-41 - m_RefCount: 5 m_Data: - e00: -1 + e00: 1 e01: 0 e02: 0 e03: 0 e10: 0 - e11: -1 + e11: 1 e12: 0 e13: 0 e20: 0 @@ -6031,13 +6044,13 @@ Tilemap: e31: 0 e32: 0 e33: 1 - - m_RefCount: 7 + - m_RefCount: 6 m_Data: e00: 0 - e01: 1 + e01: -1 e02: 0 e03: 0 - e10: -1 + e10: 1 e11: 0 e12: 0 e13: 0 @@ -6049,26 +6062,8 @@ Tilemap: e31: 0 e32: 0 e33: 1 - - m_RefCount: 0 - m_Data: - e00: 8.785626e-39 - e01: 2.2e-44 - e02: 867.2334 - e03: 0 - e10: 0 - e11: NaN - e12: 1e-45 - e13: 0 - e20: 4.672e-42 - e21: 0 - e22: 8.785603e-39 - e23: NaN - e30: 1 - e31: 7.34684e-40 - e32: 0 - e33: NaN m_TileColorArray: - - m_RefCount: 12 + - m_RefCount: 11 m_Data: {r: 1, g: 1, b: 1, a: 1} m_AnimationFrameRate: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} diff --git a/Sidescroller/Assets/Scripts/BirdContoller.cs b/Sidescroller/Assets/Scripts/BirdContoller.cs index d9c148e..df802e3 100644 --- a/Sidescroller/Assets/Scripts/BirdContoller.cs +++ b/Sidescroller/Assets/Scripts/BirdContoller.cs @@ -15,6 +15,7 @@ public class BirdContoller : MonoBehaviour pauseGame = gameFlow.pauseGame; } + // Zero gravity movement based off rigidbodies private void FixedUpdate() { if (!gameFlow.isPaused && !pauseGame.isPaused) @@ -24,8 +25,10 @@ public class BirdContoller : MonoBehaviour Vector2 movement = new Vector2(moveHorizontal, moveVertical); + // set the velocity to the movement vector amplified by the speed rb.velocity = movement * speed; + // if the player is moving, check which direction and rotate the transform accordingly if (Mathf.Abs(moveHorizontal) > 0 || Mathf.Abs(moveVertical) > 0) { if (moveHorizontal < 0) diff --git a/Sidescroller/Assets/Scripts/Gameflow.cs b/Sidescroller/Assets/Scripts/Gameflow.cs index ccce217..4d9ed02 100644 --- a/Sidescroller/Assets/Scripts/Gameflow.cs +++ b/Sidescroller/Assets/Scripts/Gameflow.cs @@ -77,6 +77,7 @@ public class Gameflow : MonoBehaviour AddDeath(); } + // Add or subtract to the score public void AddScore(int amt) { score += amt; @@ -94,6 +95,7 @@ public class Gameflow : MonoBehaviour AddScore(-50); } + // Change from the current incarnation to the next public void ChangePlayer() { objectiveCanvas.SetActive(false); @@ -211,6 +213,7 @@ public class Gameflow : MonoBehaviour } } + // Set the stage for the next reincarnation when the objective is met public void CompleteObjective() { // calculate score based off of time taken @@ -258,6 +261,7 @@ public class Gameflow : MonoBehaviour isPaused = false; } + // Put up a win menu screen public void GameOver() { isPaused = true; diff --git a/Sidescroller/Assets/Scripts/SniperShoot.cs b/Sidescroller/Assets/Scripts/SniperShoot.cs index b35efa3..62493b4 100644 --- a/Sidescroller/Assets/Scripts/SniperShoot.cs +++ b/Sidescroller/Assets/Scripts/SniperShoot.cs @@ -20,6 +20,12 @@ public class SniperShoot : MonoBehaviour hitlist = new List(); } + private void Start() + { + pauseGame = gameFlow.pauseGame; + } + + // if a player enters the collider, the object will be added to a list private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) @@ -31,6 +37,7 @@ public class SniperShoot : MonoBehaviour } } + // if the player leaves the collider it is removed from the list private void OnTriggerExit2D(Collider2D collision) { if (collision.CompareTag("Player")) diff --git a/Sidescroller/Assets/Scripts/TimeKeeper.cs b/Sidescroller/Assets/Scripts/TimeKeeper.cs index dcfc13c..0e211be 100644 --- a/Sidescroller/Assets/Scripts/TimeKeeper.cs +++ b/Sidescroller/Assets/Scripts/TimeKeeper.cs @@ -19,10 +19,12 @@ public class TimeKeeper : MonoBehaviour } } + // This function updates the time every frame, and changes the text accordingly void Timer() { seconds += Time.deltaTime; + // If a time value reaches 60, reset it to 0 and increase the next largest value if (seconds >= 60) { minutes++; @@ -44,6 +46,7 @@ public class TimeKeeper : MonoBehaviour hours = 0; } + // Return the total time elapsed in one number public int TimeElapsed() { return (hours*10000 + minutes*100 + ((int)seconds));