diff --git a/Assembly-CSharp.pidb b/Assembly-CSharp.pidb index 414f88a..f9d02a2 100644 Binary files a/Assembly-CSharp.pidb and b/Assembly-CSharp.pidb differ diff --git a/Assets/ControlScreen.unity b/Assets/ControlScreen.unity new file mode 100644 index 0000000..596a4e6 Binary files /dev/null and b/Assets/ControlScreen.unity differ diff --git a/Assets/Credits.unity b/Assets/Credits.unity new file mode 100644 index 0000000..f1f8360 Binary files /dev/null and b/Assets/Credits.unity differ diff --git a/Assets/Level1.unity b/Assets/Level1.unity new file mode 100644 index 0000000..e58eaef Binary files /dev/null and b/Assets/Level1.unity differ diff --git a/Assets/Level2.unity b/Assets/Level2.unity new file mode 100644 index 0000000..c3c3cc5 Binary files /dev/null and b/Assets/Level2.unity differ diff --git a/Assets/Level3.unity b/Assets/Level3.unity new file mode 100644 index 0000000..c45eff1 Binary files /dev/null and b/Assets/Level3.unity differ diff --git a/Assets/Materials/BACKGROUND 1.mat b/Assets/Materials/BACKGROUND 1.mat new file mode 100644 index 0000000..0300471 Binary files /dev/null and b/Assets/Materials/BACKGROUND 1.mat differ diff --git a/Assets/Materials/BACKGROUND1.mat b/Assets/Materials/BACKGROUND1.mat new file mode 100644 index 0000000..4b283d5 Binary files /dev/null and b/Assets/Materials/BACKGROUND1.mat differ diff --git a/Assets/Materials/BACKGROUND2.mat b/Assets/Materials/BACKGROUND2.mat new file mode 100644 index 0000000..ea011da Binary files /dev/null and b/Assets/Materials/BACKGROUND2.mat differ diff --git a/Assets/Materials/BACKGROUND3.mat b/Assets/Materials/BACKGROUND3.mat new file mode 100644 index 0000000..c8286f9 Binary files /dev/null and b/Assets/Materials/BACKGROUND3.mat differ diff --git a/Assets/Materials/BACKGROUND4.mat b/Assets/Materials/BACKGROUND4.mat new file mode 100644 index 0000000..83e6290 Binary files /dev/null and b/Assets/Materials/BACKGROUND4.mat differ diff --git a/Assets/Materials/BACKGROUNDbw.mat b/Assets/Materials/BACKGROUNDbw.mat new file mode 100644 index 0000000..4b5c7fd Binary files /dev/null and b/Assets/Materials/BACKGROUNDbw.mat differ diff --git a/Assets/Materials/nme.mat b/Assets/Materials/Glasses.mat similarity index 90% rename from Assets/Materials/nme.mat rename to Assets/Materials/Glasses.mat index 4198994..3a06d02 100644 Binary files a/Assets/Materials/nme.mat and b/Assets/Materials/Glasses.mat differ diff --git a/Assets/Materials/Ground.mat b/Assets/Materials/Ground.mat index 5f21fd9..c938092 100644 Binary files a/Assets/Materials/Ground.mat and b/Assets/Materials/Ground.mat differ diff --git a/Assets/Materials/Lightning 1.mat b/Assets/Materials/Lightning 1.mat new file mode 100644 index 0000000..44f8dd4 Binary files /dev/null and b/Assets/Materials/Lightning 1.mat differ diff --git a/Assets/Materials/Player.mat b/Assets/Materials/Player.mat index c4fac33..c92bf2d 100644 Binary files a/Assets/Materials/Player.mat and b/Assets/Materials/Player.mat differ diff --git a/Assets/Materials/PlayerSpriteSheet.mat b/Assets/Materials/PlayerSpriteSheet.mat index 3bdea2b..3f57cd9 100644 Binary files a/Assets/Materials/PlayerSpriteSheet.mat and b/Assets/Materials/PlayerSpriteSheet.mat differ diff --git a/Assets/Materials/PlayerSpriteSheet2.mat b/Assets/Materials/PlayerSpriteSheet2.mat index ffef250..9707318 100644 Binary files a/Assets/Materials/PlayerSpriteSheet2.mat and b/Assets/Materials/PlayerSpriteSheet2.mat differ diff --git a/Assets/Materials/PortalWeapon.mat b/Assets/Materials/PortalWeapon.mat new file mode 100644 index 0000000..f87895c Binary files /dev/null and b/Assets/Materials/PortalWeapon.mat differ diff --git a/Assets/Materials/Splash.mat b/Assets/Materials/Splash.mat new file mode 100644 index 0000000..7f434e9 Binary files /dev/null and b/Assets/Materials/Splash.mat differ diff --git a/Assets/Materials/bgTemp.mat b/Assets/Materials/bgTemp.mat index 8c3eefe..21b8524 100644 Binary files a/Assets/Materials/bgTemp.mat and b/Assets/Materials/bgTemp.mat differ diff --git a/Assets/Materials/blankBG.mat b/Assets/Materials/blankBG.mat new file mode 100644 index 0000000..6f14928 Binary files /dev/null and b/Assets/Materials/blankBG.mat differ diff --git a/Assets/Materials/colorBG.mat b/Assets/Materials/colorBG.mat new file mode 100644 index 0000000..d29d097 Binary files /dev/null and b/Assets/Materials/colorBG.mat differ diff --git a/Assets/Prefabs/Background.prefab b/Assets/Prefabs/Background.prefab index 206a67a..55e5e2e 100644 Binary files a/Assets/Prefabs/Background.prefab and b/Assets/Prefabs/Background.prefab differ diff --git a/Assets/Prefabs/Background1.prefab b/Assets/Prefabs/Background1.prefab new file mode 100644 index 0000000..df4f14b Binary files /dev/null and b/Assets/Prefabs/Background1.prefab differ diff --git a/Assets/Prefabs/Background2.prefab b/Assets/Prefabs/Background2.prefab new file mode 100644 index 0000000..4f9aaff Binary files /dev/null and b/Assets/Prefabs/Background2.prefab differ diff --git a/Assets/Prefabs/Background3.prefab b/Assets/Prefabs/Background3.prefab new file mode 100644 index 0000000..1f8e67b Binary files /dev/null and b/Assets/Prefabs/Background3.prefab differ diff --git a/Assets/Prefabs/Background4.prefab b/Assets/Prefabs/Background4.prefab new file mode 100644 index 0000000..0add873 Binary files /dev/null and b/Assets/Prefabs/Background4.prefab differ diff --git a/Assets/Prefabs/BlankBG.prefab b/Assets/Prefabs/BlankBG.prefab new file mode 100644 index 0000000..93d6089 Binary files /dev/null and b/Assets/Prefabs/BlankBG.prefab differ diff --git a/Assets/Prefabs/Cat.prefab b/Assets/Prefabs/Cat.prefab new file mode 100644 index 0000000..7cff52d Binary files /dev/null and b/Assets/Prefabs/Cat.prefab differ diff --git a/Assets/Prefabs/FlyingEnemy.prefab b/Assets/Prefabs/FlyingEnemy.prefab index 35189b1..baced84 100644 Binary files a/Assets/Prefabs/FlyingEnemy.prefab and b/Assets/Prefabs/FlyingEnemy.prefab differ diff --git a/Assets/Prefabs/Ground.prefab b/Assets/Prefabs/Ground.prefab index 121812f..5f53077 100644 Binary files a/Assets/Prefabs/Ground.prefab and b/Assets/Prefabs/Ground.prefab differ diff --git a/Assets/Prefabs/GroundEnemy.prefab b/Assets/Prefabs/GroundEnemy.prefab index 4c0e470..90846fe 100644 Binary files a/Assets/Prefabs/GroundEnemy.prefab and b/Assets/Prefabs/GroundEnemy.prefab differ diff --git a/Assets/Prefabs/Lighting.prefab b/Assets/Prefabs/Lighting.prefab index d064a9c..96dd4ad 100644 Binary files a/Assets/Prefabs/Lighting.prefab and b/Assets/Prefabs/Lighting.prefab differ diff --git a/Assets/Prefabs/Main Camera.prefab b/Assets/Prefabs/Main Camera.prefab index 490bbcf..ea6079c 100644 Binary files a/Assets/Prefabs/Main Camera.prefab and b/Assets/Prefabs/Main Camera.prefab differ diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index c9310c4..089e9f8 100644 Binary files a/Assets/Prefabs/Player.prefab and b/Assets/Prefabs/Player.prefab differ diff --git a/Assets/Prefabs/PortalIn.prefab b/Assets/Prefabs/PortalIn.prefab index 1a8d7c4..15ea9ad 100644 Binary files a/Assets/Prefabs/PortalIn.prefab and b/Assets/Prefabs/PortalIn.prefab differ diff --git a/Assets/Prefabs/Powerup.prefab b/Assets/Prefabs/Powerup.prefab index 7c8a096..575b543 100644 Binary files a/Assets/Prefabs/Powerup.prefab and b/Assets/Prefabs/Powerup.prefab differ diff --git a/Assets/Prefabs/PowerupCoat.prefab b/Assets/Prefabs/PowerupCoat.prefab new file mode 100644 index 0000000..543c023 Binary files /dev/null and b/Assets/Prefabs/PowerupCoat.prefab differ diff --git a/Assets/Prefabs/PowerupGlasses.prefab b/Assets/Prefabs/PowerupGlasses.prefab new file mode 100644 index 0000000..bbd604c Binary files /dev/null and b/Assets/Prefabs/PowerupGlasses.prefab differ diff --git a/Assets/Prefabs/StaticBulletCeil.prefab b/Assets/Prefabs/StaticBulletCeil.prefab new file mode 100644 index 0000000..c0e6eac Binary files /dev/null and b/Assets/Prefabs/StaticBulletCeil.prefab differ diff --git a/Assets/Prefabs/StaticBulletFloor.prefab b/Assets/Prefabs/StaticBulletFloor.prefab new file mode 100644 index 0000000..7d85aca Binary files /dev/null and b/Assets/Prefabs/StaticBulletFloor.prefab differ diff --git a/Assets/Prefabs/StaticBulletSide.prefab b/Assets/Prefabs/StaticBulletSide.prefab new file mode 100644 index 0000000..2cadf91 Binary files /dev/null and b/Assets/Prefabs/StaticBulletSide.prefab differ diff --git a/Assets/Prefabs/StaticShooterCeil.prefab b/Assets/Prefabs/StaticShooterCeil.prefab new file mode 100644 index 0000000..b483de4 Binary files /dev/null and b/Assets/Prefabs/StaticShooterCeil.prefab differ diff --git a/Assets/Prefabs/StaticShooterFloor.prefab b/Assets/Prefabs/StaticShooterFloor.prefab new file mode 100644 index 0000000..1d97f5b Binary files /dev/null and b/Assets/Prefabs/StaticShooterFloor.prefab differ diff --git a/Assets/Prefabs/StaticShooterSide.prefab b/Assets/Prefabs/StaticShooterSide.prefab new file mode 100644 index 0000000..3a97823 Binary files /dev/null and b/Assets/Prefabs/StaticShooterSide.prefab differ diff --git a/Assets/Prefabs/WeaponPortalPrefab.prefab b/Assets/Prefabs/WeaponPortalPrefab.prefab new file mode 100644 index 0000000..8bdaade Binary files /dev/null and b/Assets/Prefabs/WeaponPortalPrefab.prefab differ diff --git a/Assets/Prefabs/colorBG.prefab b/Assets/Prefabs/colorBG.prefab new file mode 100644 index 0000000..7a3c751 Binary files /dev/null and b/Assets/Prefabs/colorBG.prefab differ diff --git a/Assets/Prefabs/monoBG.prefab b/Assets/Prefabs/monoBG.prefab new file mode 100644 index 0000000..bd69e87 Binary files /dev/null and b/Assets/Prefabs/monoBG.prefab differ diff --git a/Assets/Scripts/Anim2D.cs b/Assets/Scripts/Anim2D.cs index 3282bb7..e6739f7 100644 --- a/Assets/Scripts/Anim2D.cs +++ b/Assets/Scripts/Anim2D.cs @@ -2,136 +2,90 @@ using System.Collections; public class Anim2D : MonoBehaviour { - - // calculation variables - private Vector3 tempVector; - private Vector3 tempVector2; - private int i; - - // animation variables (variables used for processing aniamtion) - public float sheetRows = 5; // Total columns in sprite sheet public float sheetColumns = 4; // Total Rows in sprite sheet - - public float FrameRate = 11f; // how many frames to play per second - + public float frameRate = 11f; // how many frames to play per second + private float frameNum = 1; // the current frame being played, - private string currentAnim; // the ID of the current animation being played + [HideInInspector] + public string currentAnim; // the ID of the current animation being played private float currentStart = 0; //Dynamic variable that tells the animation system what the first frame of the current animation is private float currentEnd = 0; private bool loopCheck; //Does this animation loop? - private float AnimTime = 0f; // time to pass before playing next animation + private float animTime = 0f; // time to pass before playing next animation private Vector2 sheetPos; // the X, Y position of the frame private Vector2 sheetOffset; // the offset value of the X, Y coordinate for the texture - - + //This Class allows us to create a bunch of data and store it in this specific container [System.Serializable] - public class AnimClass - { - public string Name; - public bool looping; - public int anim_Min; - public int anim_Max; + public class AnimClass { + public string name; + public bool looping; + public int anim_Min; + public int anim_Max; } public AnimClass[] Animz; - - - - // Use this for initialization - void Start () { - + void Start() { //Telling this controller that Idle is the default animation so that it doesn't throw an error currentAnim = "Idle"; } - - void Update () { - - HandleAnimation(); - KeyCommands(); - - } - - void HandleAnimation () // handles all animation - { - + void Update() { FindAnimation(currentAnim); ProcessAnimation(); - } - - //Here we decide - void FindAnimation (string currentAnim) - { - for (var i = 0; i < Animz.Length; i++){ - if ( Animz[i].Name == currentAnim){ - + //Here we decide + void FindAnimation(string currentAnim) { + for (int i = 0; i < Animz.Length; i++){ + if ( Animz[i].name == currentAnim){ loopCheck = Animz[i].looping; currentStart = Animz[i].anim_Min; currentEnd = Animz[i].anim_Max; - i = Animz.Length; } } } - - //These are dummy key input sensors. You should have a seperate player controller (or AI controller) that declares "currentAnim" to this script - void KeyCommands(){ - if (Input.GetKeyDown(KeyCode.UpArrow)){ - currentAnim = "Idle"; - } - if (Input.GetKeyDown(KeyCode.RightArrow)){ - currentAnim = "Kill"; - } + + public void SetAnim(string anim) { + currentAnim = anim; } - - - void ProcessAnimation () - { - + + public string GetAnim() { + return currentAnim; + } + + void ProcessAnimation() { // AnimTime -= Time.deltaTime; subtract the number // of seconds passed since the last frame, if the game // is running at 30 frames per second the variable will // subtract by 0.033 of a second (1/30) - - AnimTime -= Time.deltaTime; - - if (AnimTime <= 0) - { + animTime -= Time.deltaTime; + + if (animTime <= 0) { frameNum += 1; // one play animations (play from start to finish) - + frameNum = Mathf.Clamp(frameNum,currentStart,currentEnd+1); - - if ( loopCheck == true){ + + if (loopCheck == true){ if (frameNum > currentEnd){ frameNum = currentStart; } } - // if the FrameRate is 11, 1/11 is one eleventh of a second, that is the time we are waiting before we //play the next frame. - - AnimTime += (1/FrameRate); + animTime += (1/frameRate); } + + sheetPos.y = Mathf.Floor(frameNum/sheetRows); + + sheetPos.x = (frameNum % sheetRows) - 1; // find the X coordinate of the frame to play - sheetPos.y = 0; - - // find the number of frames down the animation is and set the y coordinate accordingly - for (i=(int)frameNum; i > 5; i-=5) - { - sheetPos.y += 1; - } - - sheetPos.x = i - 1; // find the X coordinate of the frame to play - sheetOffset = new Vector2(1 - (sheetPos.x/sheetRows),1 -(sheetPos.y/sheetColumns)); // find the X and Y coordinate of the frame to display - - renderer.material.SetTextureOffset ("_MainTex", sheetOffset); // offset the texture to display the correct frame - } - -} + sheetOffset = new Vector2(1-(sheetPos.x/sheetRows), 1-(sheetPos.y/sheetColumns)); // find the X and Y coordinate of the frame to display + renderer.material.SetTextureOffset("_MainTex", sheetOffset); // offset the texture to display the correct frame + } +} \ No newline at end of file diff --git a/Assets/Scripts/CatScript.cs b/Assets/Scripts/CatScript.cs new file mode 100644 index 0000000..abf6899 --- /dev/null +++ b/Assets/Scripts/CatScript.cs @@ -0,0 +1,135 @@ +using UnityEngine; +using System.Collections; + +[RequireComponent(typeof(BoxCollider))] +public class CatScript : MonoBehaviour { + + + public LayerMask collisionMask; + private BoxCollider colliderX; + private Vector3 s; + private Vector3 c; + public float EnemySpeed; + public float gravity; + private float skin = .005f; + private float dirX; + private float dirY; + private float direction = 1; + private Vector3 movement; + private Vector3 originalSize; + private Vector3 originalCenter; + private float colliderScaleX; + + [HideInInspector] + public bool grounded; + [HideInInspector] + public bool movementStopped; + + Ray rayV; + Ray rayD; + Ray rayH; + RaycastHit hit; + + void Start(){ + //audio.Play (); + colliderX = GetComponent(); + s = colliderX.size; + c = colliderX.center; + colliderScaleX = transform.localScale.x; + SetCollider (s, c); + } + + public void move(Vector2 moveAmt) { + + float deltaY = moveAmt.y *Time.deltaTime; + float deltaX = moveAmt.x; + Vector2 p = transform.position; + + grounded= false; + for (int i = 0; i <3; i++) { + dirY = Mathf.Sign (deltaY); + float x = (p.x + c.x - s.x/2) + s.x/2 * i; + float y = p.y + c.y +s.y/2 * dirY; + + rayV = new Ray(new Vector2(x,y), new Vector2(0,dirY)); + Debug.DrawRay (rayV.origin, rayV.direction); + if (Physics.Raycast (rayV,out hit, Mathf.Abs (deltaY) + skin, collisionMask)) { + + float dst = Vector3.Distance (rayV.origin, hit.point); + + + if (dst > skin) { + deltaY = -dst - skin * dirY; + } + else{ + deltaY = 0; + } + grounded = true; + break; + + } + } + + movementStopped = false; + for (int i = 0; i <3; i++) { + dirX = Mathf.Sign (deltaX); + float x = p.x + c.x + s.x/2 * dirX; + float y = (p.y + c.y - s.y/2) + s.y/2 * i; + + rayH = new Ray(new Vector2(x,y), new Vector2(dirX,0)); + Debug.DrawRay (rayH.origin, rayH.direction); + if (Physics.Raycast (rayH,out hit, Mathf.Abs (deltaX) + skin, collisionMask)) { + + float dst = Vector3.Distance (rayH.origin, hit.point); + + + if (dst > skin) { + deltaX = dst * dirX - skin * dirX; + } + else{ + //deltaX = 0; + } + movementStopped = true; + break; + + } + } + if (!grounded && !movementStopped) { + Vector3 playerDir = new Vector3(deltaX,deltaY); + Vector3 o = new Vector3((p.x + c.x + s.x/2 * dirX),(p.y + c.y +s.y/2 * dirY)); + Debug.DrawRay (o, playerDir.normalized); + rayD = new Ray(o, playerDir.normalized); + if(Physics.Raycast (rayD,Mathf.Sqrt (deltaX*deltaX + deltaY*deltaY),collisionMask)){ + grounded = true; + deltaY = 0; + } + } + + Vector2 finalTransform = new Vector2 (deltaX,deltaY); + transform.Translate(finalTransform, Space.World); + //movement = new Vector3(finalTransform.x, finalTransform.y, 0); + } + + + void Update () { + move (movement); + if (transform.position.x > 11){SelfDestruct ();} + float amtToMove = EnemySpeed * Time.deltaTime * direction; + + movement.x = amtToMove; + movement.y -= gravity * Time.deltaTime; + + } + + void SelfDestruct(){ + DestroyObject (this.gameObject); + } + + public void SetCollider(Vector3 size, Vector3 center){ + colliderX.size = size; + colliderX.center= center; + + s = size * colliderScaleX; + c = center * colliderScaleX; + } +} \ No newline at end of file diff --git a/Assets/Scripts/ClickThroughMenu.cs b/Assets/Scripts/ClickThroughMenu.cs new file mode 100644 index 0000000..06b778c --- /dev/null +++ b/Assets/Scripts/ClickThroughMenu.cs @@ -0,0 +1,19 @@ +using UnityEngine; +using System.Collections; + +public class ClickThroughMenu : MonoBehaviour { + public Texture backgroundTexture; + public int nextScene; + // Use this for initialization + void Start () { + + } + void OnGUI(){ + GUI.DrawTexture (new Rect(0,0,Screen.width,Screen.height), backgroundTexture); + } + void Update () { + if(Input.GetMouseButtonDown(0)){ + Application.LoadLevel (nextScene); + } + } +} diff --git a/Assets/Scripts/EnemyPhysics.cs b/Assets/Scripts/EnemyPhysics.cs index b4755cf..ee9f15e 100644 --- a/Assets/Scripts/EnemyPhysics.cs +++ b/Assets/Scripts/EnemyPhysics.cs @@ -19,6 +19,18 @@ public class EnemyPhysics : MonoBehaviour { private float direction = -1; private Vector3 movement; public GameObject PowerupPrefabz; + public GameObject bullet; + public bool isFlying = false; + public float shootOffset = 0; + public float shootSpeedN; + private Vector3 spawnPoint; + private float shootSpeed; + private bool closeToCam = false; + private Vector3 originalSize; + private Vector3 originalCenter; + private float colliderScaleX; + public AudioClip sound; + private bool dead = false; [HideInInspector] public bool grounded; @@ -34,8 +46,15 @@ public class EnemyPhysics : MonoBehaviour { colliderX = GetComponent(); s = colliderX.size; c = colliderX.center; + colliderScaleX = transform.localScale.x; + SetCollider (s, c); + shootSpeed = shootSpeedN/100; + + spawnPoint = transform.position; + Invoke ("startFiring", shootOffset); } + public void move(Vector2 moveAmt) { float deltaY = moveAmt.y *Time.deltaTime; @@ -122,13 +141,25 @@ public class EnemyPhysics : MonoBehaviour { if (hasPowerup){ Instantiate (PowerupPrefabz, transform.position, Quaternion.identity); } - DestroyObject (this.gameObject); + audio.PlayOneShot (sound); + CancelInvoke ("spawnBullet"); + renderer.enabled = false; + Invoke("selfDestruct", sound.length ); + } } + void selfDestruct(){ + + dead = true; + DestroyObject(this.gameObject); + } + void Update () { - + if(spawnPoint.x - Camera.main.transform.position.x < 11){ + closeToCam=true; + } if (lastHit == "Backboard"){ Invoke ("SelfDestruct", 3); offScreen= true; @@ -143,8 +174,9 @@ public class EnemyPhysics : MonoBehaviour { movement.x = amtToMove; movement.y -= gravity * Time.deltaTime; - - move (movement); + if(closeToCam && !dead){ + move (movement); + } if (this.transform.position.y < -6){ SelfDestruct(); @@ -154,4 +186,17 @@ public class EnemyPhysics : MonoBehaviour { void SelfDestruct(){ DestroyObject (this.gameObject); } + + void startFiring(){InvokeRepeating ("spawnBullet", shootSpeed, shootSpeed);} + void spawnBullet(){ + Instantiate (bullet, transform.position, Quaternion.identity); + } + + public void SetCollider(Vector3 size, Vector3 center){ + colliderX.size = size; + colliderX.center= center; + + s = size * colliderScaleX; + c = center * colliderScaleX; + } } diff --git a/Assets/Scripts/GameCamera.cs b/Assets/Scripts/GameCamera.cs index b6bf5bd..2dbbab6 100644 --- a/Assets/Scripts/GameCamera.cs +++ b/Assets/Scripts/GameCamera.cs @@ -5,8 +5,6 @@ public class GameCamera : MonoBehaviour { private Transform target; private float maxX = 0f; - private int buttonWidth = 400; - private int buttonHeight = 100; private bool buttonShown=false; public int currentLevel = 0; public int nextLevel = 0; @@ -24,7 +22,7 @@ public class GameCamera : MonoBehaviour { Invoke ("showButton", 1.55f); } if (buttonShown && !target){ - if (GUI.Button (new Rect(Screen.width /2 - buttonWidth/2, Screen.height /2 - buttonHeight/2, buttonWidth, buttonHeight), "YOU HAVE DIED", gStyle)) { + if (GUI.Button (new Rect(0f,0f, Screen.width, Screen.height), "YOU HAVE DIED", gStyle)) { Application.LoadLevel (currentLevel); } } @@ -33,7 +31,7 @@ public class GameCamera : MonoBehaviour { } } else{ - if (GUI.Button (new Rect(Screen.width /2 - buttonWidth/2, Screen.height /2 - buttonHeight/2, buttonWidth, buttonHeight), "LEVEL COMPLETE", gStyle)) { + if (GUI.Button (new Rect(0f,0f, Screen.width, Screen.height), "LEVEL COMPLETE", gStyle)) { Application.LoadLevel (nextLevel); } diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index 5cdc83e..4353258 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -5,6 +5,7 @@ public class GameManager : MonoBehaviour { public GameObject player; public GameObject portal; + public GameObject catPrefab; private GameCamera cam; // Use this for initialization @@ -17,6 +18,7 @@ public class GameManager : MonoBehaviour { private void SpawnStart () { Instantiate (portal, portal.transform.position, portal.transform.rotation); + Instantiate (catPrefab, player.transform.position, player.transform.rotation); Invoke ("SpawnPlayer", 1.5f); } diff --git a/Assets/Scripts/MainMenu.cs b/Assets/Scripts/MainMenu.cs index b9ed5f8..c36d23e 100644 --- a/Assets/Scripts/MainMenu.cs +++ b/Assets/Scripts/MainMenu.cs @@ -22,8 +22,11 @@ public class MainMenu : MonoBehaviour { GUI.DrawTexture (new Rect(0,0,Screen.width,Screen.height), backgroundTexture); //GUI.Label (new Rect(10,10,240,200),instructionText); - if (GUI.Button (new Rect(Screen.width /2 - buttonWidth/2, Screen.height /2 - buttonHeight/2, buttonWidth, buttonHeight), "Start Game")) { - Application.LoadLevel (1); + if (GUI.Button (new Rect(Screen.width /2 - buttonWidth/2, Screen.height /2 - buttonHeight/2 , buttonWidth, buttonHeight), "Start Game")) { + Application.LoadLevel (2); + } + if (GUI.Button (new Rect(Screen.width /2 - buttonWidth/2, Screen.height /2 - buttonHeight/2 + Screen.height/4, buttonWidth, buttonHeight), "Credits")) { + Application.LoadLevel (7); } } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 0c6b0e6..8e1ff84 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -19,17 +19,26 @@ public class PlayerController : MonoBehaviour { private GameObject currentPortal; private bool gotHit=false; private bool gotPower=false; - + private bool recharged = true; + private float wepRechargeTime = 3.0f; + public Texture crosshairTexture; + private Anim2D animControl; + public AudioClip sound; void Start () { - + Screen.showCursor = false; playerPhysics = GetComponent(); + animControl = GetComponent(); + //sound = GetComponent(); } void OnGUI(){ + + GUI.DrawTexture (new Rect(Event.current.mousePosition.x - (crosshairTexture.width/2), Event.current.mousePosition.y - (crosshairTexture.height/2), crosshairTexture.width, crosshairTexture.height), crosshairTexture); + if (gotHit){ GUI.TextField (new Rect (0, 0, 90, 20), "Hit by enemy!", 25); } if (gotPower){ - GUI.TextField (new Rect (0, 0, 60, 20), "Powerup!", 25); + GUI.TextField (new Rect (0, 0, 100, 20), "Powerup! +1 HP", 25); } } void OnTriggerEnter(Collider other) { @@ -39,19 +48,22 @@ public class PlayerController : MonoBehaviour { gotPower=true; Invoke ("resetPower", 1f); playerHP++; - //Debug.Log ("Powered up!"); + //powerup sound? } else if (derp == "EndPortal"){ DestroyObject (this.gameObject); - //Debug.Log ("hit portal"); + } - else if (derp == "Backboard"){} + else if (derp == "Backboard" || derp == "Shooter"){} else{ + + audio.PlayOneShot (sound); + gotHit=true; Invoke ("resetHit", 1f); playerHP--; - //Debug.Log ("phit"); + //add player hurt sound } } void resetHit(){ @@ -61,20 +73,26 @@ public class PlayerController : MonoBehaviour { gotPower=false; } void playerDead() { - DestroyObject(this.gameObject); + renderer.enabled=false; + Invoke ("selfDestruct", sound.length); pDead = true; } + + void selfDestruct(){DestroyObject(this.gameObject);} + void Update () { - + if (transform.position.y <= -6) {playerDead ();} + Screen.showCursor = false; if (playerHP <= 0) { playerDead (); } - + float amtToMove = Input.GetAxisRaw ("Horizontal") * PlayerSpeed * Time.deltaTime; - + if(playerPhysics.grounded) { movement.y = 0; + if(Input.GetButtonDown ("Jump")) { movement.y = jumpHeight; } @@ -83,28 +101,37 @@ public class PlayerController : MonoBehaviour { movement.x = amtToMove; movement.y -= gravity * Time.deltaTime; - - playerPhysics.move (movement); + if (movement.x == 0 && playerPhysics.grounded) { animControl.SetAnim ("Idle");} + else if(!playerPhysics.grounded) {animControl.SetAnim ("Jump");} + else { + if (animControl.currentAnim != "Walk" && playerPhysics.grounded) { animControl.SetAnim ("Walk");} + } + if (!pDead){ + playerPhysics.move (movement); + } CastRayToWorld (); - if(Input.GetMouseButtonDown(0)){ + if(Input.GetMouseButtonDown(0) && recharged){ if (portalExist) {DestroyObject(currentPortal.gameObject);} //Vector3 position = new Vector3(transform.position.x, transform.position.y + (transform.localScale.y / 2), 0); currentPortal = (Instantiate (WeaponPortal, mousePos, Quaternion.identity) as GameObject); portalExist = true; - //Debug.Log (mousePos); + recharged = false; + Invoke ("recharge", wepRechargeTime); + } } - + void recharge(){recharged=true;} + void CastRayToWorld() { Ray ray= Camera.main.ScreenPointToRay(Input.mousePosition); Vector3 point= ray.origin + (ray.direction); mousePos = new Vector3(point.x, point.y, 0.0f); - //Debug.Log( "World point " + pointZero); + } -} +} \ No newline at end of file diff --git a/Assets/Scripts/PlayerPhysics.cs b/Assets/Scripts/PlayerPhysics.cs index 57ed17e..d67804a 100644 --- a/Assets/Scripts/PlayerPhysics.cs +++ b/Assets/Scripts/PlayerPhysics.cs @@ -11,8 +11,15 @@ public class PlayerPhysics : MonoBehaviour { private Vector3 c; private float skin = .005f; - private float dirX; private float dirY; + [HideInInspector] + public float dirX; + + private Vector3 originalSize; + private Vector3 originalCenter; + + private float colliderScaleX; + //private float colliderScaleY; [HideInInspector] public bool grounded; @@ -26,9 +33,11 @@ public class PlayerPhysics : MonoBehaviour { void Start(){ colliderX = GetComponent(); - s = new Vector3(1f,1f,1f); - c = colliderX.center; - + colliderScaleX = transform.localScale.x; + //colliderScaleY = transform.localScale.y; + originalSize = colliderX.size; + originalCenter = colliderX.center; + SetCollider (originalSize, originalCenter); } public void move(Vector2 moveAmt) { @@ -63,7 +72,7 @@ public class PlayerPhysics : MonoBehaviour { movementStopped = false; for (int i = 0; i <3; i++) { - dirX = Mathf.Sign (deltaX); + dirX = Mathf.Sign (deltaX); float x = p.x + c.x + s.x/2 * dirX; float y = (p.y + c.y - s.y/2) + s.y/2 * i; @@ -100,4 +109,11 @@ public class PlayerPhysics : MonoBehaviour { transform.Translate(finalTransform, Space.World); } + public void SetCollider(Vector3 size, Vector3 center){ + colliderX.size = size; + colliderX.center= center; + + s = size * colliderScaleX; + c = center * colliderScaleX; + } } \ No newline at end of file diff --git a/Assets/Scripts/Powerups.cs b/Assets/Scripts/Powerups.cs index 434b00f..441dce4 100644 --- a/Assets/Scripts/Powerups.cs +++ b/Assets/Scripts/Powerups.cs @@ -2,10 +2,17 @@ using System.Collections; public class Powerups : MonoBehaviour { - + public AudioClip sound; + private bool able; + void OnTriggerEnter(Collider other) { - if (other.tag=="Player" || other.tag=="Enemy"){ - DestroyObject (this.gameObject); + Invoke ("setAble", 2); + if (other.tag=="Player" || other.tag=="Enemy" && able){ + audio.PlayOneShot (sound); + renderer.enabled=false; + Invoke("selfDestruct", sound.length ); } } + void setAble(){able=true;} + void selfDestruct(){DestroyObject (this.gameObject);} } diff --git a/Assets/Scripts/SplashScreen.cs b/Assets/Scripts/SplashScreen.cs new file mode 100644 index 0000000..3010a32 --- /dev/null +++ b/Assets/Scripts/SplashScreen.cs @@ -0,0 +1,29 @@ +using UnityEngine; +using System.Collections; + +public class SplashScreen : MonoBehaviour { + //public Texture backgroundTexture; + + void Start () { + Color color = renderer.material.color; + color.a = 0f; + renderer.material.color = color; + Invoke ("loadMenu", 3.0f); + } + // Update is called once per frame + void OnGUI () { + + //GUI.DrawTexture (new Rect(0,0,Screen.width,Screen.height), backgroundTexture); + } + + void loadMenu(){ + Application.LoadLevel (1); + } + + void Update () { + Color color = renderer.material.color; + color.a += Time.deltaTime * 1f / 2.0f; + renderer.material.color = color; + } + +} diff --git a/Assets/Scripts/StaticBullet.cs b/Assets/Scripts/StaticBullet.cs new file mode 100644 index 0000000..464039d --- /dev/null +++ b/Assets/Scripts/StaticBullet.cs @@ -0,0 +1,51 @@ +using UnityEngine; +using System.Collections; + +public class StaticBullet : MonoBehaviour { + //public float bulletSpeed=1; + public float ProjectileSpeed; + private Transform myTransform; + private string lastHit; + public bool onFloor = true; + private string oppSide; + private int dir; + public bool horizontal; + + // Use this for initialization + void Start () { + if (onFloor){ + oppSide="ceil"; + dir = -1; + }else{ + oppSide="floor"; + dir = 1; + } + + //DestroyObject (this.gameObject, 3); + myTransform=transform; + } + + + // Update is called once per frame + void Update () { + if(transform.position.y < -7){DestroyObject (this.gameObject);} + if (!horizontal){ + float amtToMove = ProjectileSpeed * Time.deltaTime * dir; + myTransform.Translate (Vector3.down * amtToMove, Space.World); + } + else{ + float amtToMove = ProjectileSpeed * Time.deltaTime * dir; + myTransform.Translate (Vector3.left * amtToMove, Space.World); + } + } + + void OnTriggerEnter(Collider other) { + lastHit = other.tag; + if (lastHit =="Backboard"){ + //Debug.Log (lastHit); + } + else if (lastHit=="Weapon" || lastHit == "Player" || lastHit== oppSide){ + DestroyObject (this.gameObject); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/StaticShooter.cs b/Assets/Scripts/StaticShooter.cs new file mode 100644 index 0000000..aa4da2d --- /dev/null +++ b/Assets/Scripts/StaticShooter.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using System.Collections; + +public class StaticShooter : MonoBehaviour { + public GameObject bullet; + public float shootOffset = 0; + public float shootSpeedN; + //private Vector3 spawnPoint; + private float shootSpeed; + public float Xoffset = 0; + private Vector3 off; + public float Yoffset = 0; + + void Start () { + off = new Vector3(Xoffset, Yoffset, 0f); + shootSpeed = shootSpeedN/100; + //spawnPoint =new Vector3(transform.position.x,bullet.transform.position.y,0.0f); + Invoke ("startFiring", shootOffset); + } + + void startFiring(){InvokeRepeating ("spawnBullet", shootSpeed, shootSpeed);} + void spawnBullet(){ + Instantiate (bullet, transform.position + off, bullet.transform.rotation); + } +} \ No newline at end of file diff --git a/Assets/Scripts/WeaponPortal.cs b/Assets/Scripts/WeaponPortal.cs new file mode 100644 index 0000000..9d04228 --- /dev/null +++ b/Assets/Scripts/WeaponPortal.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections; + +public class WeaponPortal : MonoBehaviour { + private Vector3 endScale; + + private Vector3 startPos; + public int rotateSpeed = -20; + // Use this for initialization + void Start () { + endScale = new Vector3(2f,2f,2f); + startPos = transform.position; + } + + // Update is called once per frame + void Update () { + transform.position = startPos; + Vector3 rotateZ = new Vector3(0f,0f,0f); + rotateZ.z = rotateSpeed; + transform.Rotate(rotateZ, Space.World); + if (transform.localScale.x < endScale.x){ + Vector3 scaleBy = new Vector3(0.015f,0.015f,0.015f); + Vector3 newScale = transform.localScale + scaleBy; + transform.localScale = newScale; + } + } +} diff --git a/Assets/Sounds/Chipper Doodle v2.mp3 b/Assets/Sounds/Chipper Doodle v2.mp3 new file mode 100644 index 0000000..bcb7f7c Binary files /dev/null and b/Assets/Sounds/Chipper Doodle v2.mp3 differ diff --git a/Assets/Sounds/Player death.wav b/Assets/Sounds/Player death.wav new file mode 100644 index 0000000..434315b Binary files /dev/null and b/Assets/Sounds/Player death.wav differ diff --git a/Assets/Sounds/Powerup.wav b/Assets/Sounds/Powerup.wav new file mode 100644 index 0000000..3b8c9bc Binary files /dev/null and b/Assets/Sounds/Powerup.wav differ diff --git a/Assets/Sounds/Robot Death.wav b/Assets/Sounds/Robot Death.wav new file mode 100644 index 0000000..814b3fa Binary files /dev/null and b/Assets/Sounds/Robot Death.wav differ diff --git a/Assets/Sounds/Shooting.wav b/Assets/Sounds/Shooting.wav new file mode 100644 index 0000000..0da7c67 Binary files /dev/null and b/Assets/Sounds/Shooting.wav differ diff --git a/Assets/Sounds/cat5.mp3 b/Assets/Sounds/cat5.mp3 new file mode 100644 index 0000000..df4abbd Binary files /dev/null and b/Assets/Sounds/cat5.mp3 differ diff --git a/Assets/SplashScreen.unity b/Assets/SplashScreen.unity new file mode 100644 index 0000000..59a42c1 Binary files /dev/null and b/Assets/SplashScreen.unity differ diff --git a/Assets/StoryScreen.unity b/Assets/StoryScreen.unity new file mode 100644 index 0000000..b0c9ddd Binary files /dev/null and b/Assets/StoryScreen.unity differ diff --git a/Assets/TestLevel.unity b/Assets/TestLevel.unity index 48a787b..5882ff9 100644 Binary files a/Assets/TestLevel.unity and b/Assets/TestLevel.unity differ diff --git a/Assets/TestLevel2.unity b/Assets/TestLevel2.unity index 92ce832..1bf8d39 100644 Binary files a/Assets/TestLevel2.unity and b/Assets/TestLevel2.unity differ diff --git a/Assets/Textures/BACKGROUND 1.png b/Assets/Textures/BACKGROUND 1.png new file mode 100644 index 0000000..1aca043 Binary files /dev/null and b/Assets/Textures/BACKGROUND 1.png differ diff --git a/Assets/Textures/BACKGROUND 1.psd b/Assets/Textures/BACKGROUND 1.psd new file mode 100644 index 0000000..dd6dd3a Binary files /dev/null and b/Assets/Textures/BACKGROUND 1.psd differ diff --git a/Assets/Textures/BACKGROUND1.png b/Assets/Textures/BACKGROUND1.png new file mode 100644 index 0000000..31cb763 Binary files /dev/null and b/Assets/Textures/BACKGROUND1.png differ diff --git a/Assets/Textures/BACKGROUND2.png b/Assets/Textures/BACKGROUND2.png new file mode 100644 index 0000000..a325e51 Binary files /dev/null and b/Assets/Textures/BACKGROUND2.png differ diff --git a/Assets/Textures/BACKGROUND3.png b/Assets/Textures/BACKGROUND3.png new file mode 100644 index 0000000..dfc09e6 Binary files /dev/null and b/Assets/Textures/BACKGROUND3.png differ diff --git a/Assets/Textures/BACKGROUND4.png b/Assets/Textures/BACKGROUND4.png new file mode 100644 index 0000000..fb0d6ab Binary files /dev/null and b/Assets/Textures/BACKGROUND4.png differ diff --git a/Assets/Textures/BACKGROUNDbw.png b/Assets/Textures/BACKGROUNDbw.png new file mode 100644 index 0000000..5191e83 Binary files /dev/null and b/Assets/Textures/BACKGROUNDbw.png differ diff --git a/Assets/Textures/BGcolors.png b/Assets/Textures/BGcolors.png new file mode 100644 index 0000000..a4c39bc Binary files /dev/null and b/Assets/Textures/BGcolors.png differ diff --git a/Assets/Textures/BGcolors.psd b/Assets/Textures/BGcolors.psd new file mode 100644 index 0000000..c6247fc Binary files /dev/null and b/Assets/Textures/BGcolors.psd differ diff --git a/Assets/Textures/BlankBG.png b/Assets/Textures/BlankBG.png new file mode 100644 index 0000000..310ab30 Binary files /dev/null and b/Assets/Textures/BlankBG.png differ diff --git a/Assets/Textures/BlankBG.psd b/Assets/Textures/BlankBG.psd new file mode 100644 index 0000000..21b789b Binary files /dev/null and b/Assets/Textures/BlankBG.psd differ diff --git a/Assets/Textures/Character Sprite Sheet.png b/Assets/Textures/Character Sprite Sheet.png new file mode 100644 index 0000000..c7eb062 Binary files /dev/null and b/Assets/Textures/Character Sprite Sheet.png differ diff --git a/Assets/Textures/CharacterSpriteAligned.png b/Assets/Textures/CharacterSpriteAligned.png new file mode 100644 index 0000000..a1c4648 Binary files /dev/null and b/Assets/Textures/CharacterSpriteAligned.png differ diff --git a/Assets/Textures/CharacterSpriteAligned.psd b/Assets/Textures/CharacterSpriteAligned.psd new file mode 100644 index 0000000..49990a8 Binary files /dev/null and b/Assets/Textures/CharacterSpriteAligned.psd differ diff --git a/Assets/Textures/ControlScreen.png b/Assets/Textures/ControlScreen.png new file mode 100644 index 0000000..2b6cf9a Binary files /dev/null and b/Assets/Textures/ControlScreen.png differ diff --git a/Assets/Textures/ControlScreen.psd b/Assets/Textures/ControlScreen.psd new file mode 100644 index 0000000..c5fd64b Binary files /dev/null and b/Assets/Textures/ControlScreen.psd differ diff --git a/Assets/Textures/CreditsScreen.png b/Assets/Textures/CreditsScreen.png new file mode 100644 index 0000000..18e3fbe Binary files /dev/null and b/Assets/Textures/CreditsScreen.png differ diff --git a/Assets/Textures/CreditsScreen.psd b/Assets/Textures/CreditsScreen.psd new file mode 100644 index 0000000..e36bdf4 Binary files /dev/null and b/Assets/Textures/CreditsScreen.psd differ diff --git a/Assets/Textures/CrossHair.png b/Assets/Textures/CrossHair.png new file mode 100644 index 0000000..a965488 Binary files /dev/null and b/Assets/Textures/CrossHair.png differ diff --git a/Assets/Textures/Crosshair.psd b/Assets/Textures/Crosshair.psd new file mode 100644 index 0000000..a4e21ec Binary files /dev/null and b/Assets/Textures/Crosshair.psd differ diff --git a/Assets/Textures/Glasses.png b/Assets/Textures/Glasses.png new file mode 100644 index 0000000..d78f90e Binary files /dev/null and b/Assets/Textures/Glasses.png differ diff --git a/Assets/Textures/LabCoat.png b/Assets/Textures/LabCoat.png new file mode 100644 index 0000000..48fd447 Binary files /dev/null and b/Assets/Textures/LabCoat.png differ diff --git a/Assets/Textures/Lightning.png b/Assets/Textures/Lightning.png new file mode 100644 index 0000000..0c7ec04 Binary files /dev/null and b/Assets/Textures/Lightning.png differ diff --git a/Assets/Textures/Lightning.psd b/Assets/Textures/Lightning.psd new file mode 100644 index 0000000..2bb0167 Binary files /dev/null and b/Assets/Textures/Lightning.psd differ diff --git a/Assets/Textures/StoryScreen.png b/Assets/Textures/StoryScreen.png new file mode 100644 index 0000000..fb735c4 Binary files /dev/null and b/Assets/Textures/StoryScreen.png differ diff --git a/Assets/Textures/StoryScreen.psd b/Assets/Textures/StoryScreen.psd new file mode 100644 index 0000000..2c6e553 Binary files /dev/null and b/Assets/Textures/StoryScreen.psd differ diff --git a/Assets/Textures/TSK.png b/Assets/Textures/TSK.png index d25c497..1003856 100644 Binary files a/Assets/Textures/TSK.png and b/Assets/Textures/TSK.png differ diff --git a/Assets/Textures/UconnSplash.png b/Assets/Textures/UconnSplash.png new file mode 100644 index 0000000..3946572 Binary files /dev/null and b/Assets/Textures/UconnSplash.png differ diff --git a/Assets/Textures/backgroundPH.jpg b/Assets/Textures/backgroundPH.jpg new file mode 100644 index 0000000..29afa9d Binary files /dev/null and b/Assets/Textures/backgroundPH.jpg differ diff --git a/Assets/Textures/colorBG.png b/Assets/Textures/colorBG.png new file mode 100644 index 0000000..eb1b8e9 Binary files /dev/null and b/Assets/Textures/colorBG.png differ diff --git a/Assets/Textures/wormhole2.png b/Assets/Textures/wormhole2.png new file mode 100644 index 0000000..61f76b7 Binary files /dev/null and b/Assets/Textures/wormhole2.png differ diff --git a/Builds/Builds.html b/Builds/Builds.html new file mode 100644 index 0000000..ec96a9a --- /dev/null +++ b/Builds/Builds.html @@ -0,0 +1,136 @@ + + + + + Unity Web Player | Platformer + + + + + + +

Unity Web Player | Platformer

+
+
+
+ + Unity Web Player. Install now! + +
+
+ + Unity Web Player. Install now! Restart your browser after install. + +
+
+
+ + + diff --git a/Builds/Builds.unity3d b/Builds/Builds.unity3d new file mode 100644 index 0000000..4b468b1 Binary files /dev/null and b/Builds/Builds.unity3d differ diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 55ced49..f6dbb96 100644 Binary files a/ProjectSettings/EditorBuildSettings.asset and b/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 0cfe188..323509e 100644 Binary files a/ProjectSettings/InputManager.asset and b/ProjectSettings/InputManager.asset differ diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 15a3950..4dd7a3d 100644 Binary files a/ProjectSettings/TagManager.asset and b/ProjectSettings/TagManager.asset differ diff --git a/SpaceKitten.userprefs b/SpaceKitten.userprefs new file mode 100644 index 0000000..d72dce3 --- /dev/null +++ b/SpaceKitten.userprefs @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file