aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nGJ2019/Assets/Scripts.meta8
-rw-r--r--nGJ2019/Assets/Scripts/LevelScrolling.cs66
-rw-r--r--nGJ2019/Assets/Sprites.meta8
-rw-r--r--nGJ2019/Assets/Sprites/bg.pngbin0 -> 529233 bytes
-rw-r--r--nGJ2019/Assets/Sprites/bg.png.meta90
-rw-r--r--nGJ2019/Assets/Sprites/longcat.pngbin0 -> 202556 bytes
-rw-r--r--nGJ2019/Assets/Sprites/longcat.png.meta90
7 files changed, 262 insertions, 0 deletions
diff --git a/nGJ2019/Assets/Scripts.meta b/nGJ2019/Assets/Scripts.meta
new file mode 100644
index 0000000..8ce1629
--- /dev/null
+++ b/nGJ2019/Assets/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d40e59778bbb441d29ef2b013583c511
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/nGJ2019/Assets/Scripts/LevelScrolling.cs b/nGJ2019/Assets/Scripts/LevelScrolling.cs
new file mode 100644
index 0000000..dd413f8
--- /dev/null
+++ b/nGJ2019/Assets/Scripts/LevelScrolling.cs
@@ -0,0 +1,66 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+public class LevelScrolling : MonoBehaviour
+{
+ public int updateRate = 1;
+ public Transform longcat;
+ public Transform background;
+
+ private Vector3 initialBgPos;
+ private float[] backgroundSize;
+
+ // Start is called before the first frame update
+ void Start()
+ {
+ ResizeBackground();
+ }
+
+ // Update is called once per frame
+ void Update()
+ {
+
+ }
+
+ void FixedUpdate()
+ {
+ MoveBackground();
+ MoveLongcat();
+ }
+
+ private void ResizeBackground()
+ {
+ var sr = background.GetComponent<SpriteRenderer>();
+ if (sr == null) return;
+
+ background.localScale = new Vector3(1, 1, 1);
+
+ var width = sr.sprite.bounds.size.x;
+ var height = sr.sprite.bounds.size.y;
+
+ var worldScreenHeight = Camera.main.orthographicSize * 2.0;
+ var worldScreenWidth = worldScreenHeight / Screen.height * Screen.width;
+
+ var finalHeight = (float)(worldScreenHeight / height);
+ var finalWidth = (float)(worldScreenWidth / width);
+
+ background.localScale = new Vector3(finalHeight, finalHeight, 1);
+
+ var viewportX = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, 0)).x;
+ background.position = new Vector3(viewportX * -1, 0, 0);
+ initialBgPos = background.position;
+ }
+
+ private void MoveLongcat()
+ {
+ longcat.Translate(new Vector2(0.1f * updateRate, 0));
+ }
+
+ private void MoveBackground()
+ {
+ if (background.position.x > -initialBgPos.x)
+ background.Translate(new Vector2(0.1f * updateRate, 0));
+ else background.position = initialBgPos;
+ }
+}
diff --git a/nGJ2019/Assets/Sprites.meta b/nGJ2019/Assets/Sprites.meta
new file mode 100644
index 0000000..49c60d8
--- /dev/null
+++ b/nGJ2019/Assets/Sprites.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c601bba674d654ddbb9a933a31821269
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/nGJ2019/Assets/Sprites/bg.png b/nGJ2019/Assets/Sprites/bg.png
new file mode 100644
index 0000000..2205025
--- /dev/null
+++ b/nGJ2019/Assets/Sprites/bg.png
Binary files differ
diff --git a/nGJ2019/Assets/Sprites/bg.png.meta b/nGJ2019/Assets/Sprites/bg.png.meta
new file mode 100644
index 0000000..9263b00
--- /dev/null
+++ b/nGJ2019/Assets/Sprites/bg.png.meta
@@ -0,0 +1,90 @@
+fileFormatVersion: 2
+guid: f961209db19f64f58a67ad7f0554c561
+TextureImporter:
+ internalIDToNameTable: []
+ 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: -1
+ 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: 100
+ 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
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: b7532254506b94714a087a332a95f2b3
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/nGJ2019/Assets/Sprites/longcat.png b/nGJ2019/Assets/Sprites/longcat.png
new file mode 100644
index 0000000..e688f50
--- /dev/null
+++ b/nGJ2019/Assets/Sprites/longcat.png
Binary files differ
diff --git a/nGJ2019/Assets/Sprites/longcat.png.meta b/nGJ2019/Assets/Sprites/longcat.png.meta
new file mode 100644
index 0000000..9beb047
--- /dev/null
+++ b/nGJ2019/Assets/Sprites/longcat.png.meta
@@ -0,0 +1,90 @@
+fileFormatVersion: 2
+guid: f0c6b650c6eb34367a41045093051665
+TextureImporter:
+ internalIDToNameTable: []
+ 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: -1
+ 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: 100
+ 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
+ spriteSheet:
+ serializedVersion: 2
+ sprites: []
+ outline: []
+ physicsShape: []
+ bones: []
+ spriteID: b040b8360c8964439871fd5251c4bd74
+ internalID: 0
+ vertices: []
+ indices:
+ edges: []
+ weights: []
+ secondaryTextures: []
+ spritePackingTag:
+ pSDRemoveMatte: 0
+ pSDShowRemoveMatteOption: 0
+ userData:
+ assetBundleName:
+ assetBundleVariant: