diff --git a/Final Platformer/Assets/Scenes/SampleScene.unity b/Final Platformer/Assets/Scenes/SampleScene.unity index 0046f52..593668b 100644 --- a/Final Platformer/Assets/Scenes/SampleScene.unity +++ b/Final Platformer/Assets/Scenes/SampleScene.unity @@ -1165,6 +1165,12 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 6159980861932227150, guid: 4f918b3422e727146ba0fc02a38e49a4, + type: 3} + propertyPath: spawner + value: + objectReference: {fileID: 6924348113856937820, guid: 926b6ed7cabf8cb40a8537d7c50ce89c, + type: 3} - target: {fileID: 7750671660153954510, guid: 4f918b3422e727146ba0fc02a38e49a4, type: 3} propertyPath: m_Offset.x @@ -2744,7 +2750,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.40732515, y: 1.2543883, z: -10} + m_LocalPosition: {x: 0.30580938, y: 1.2543883, z: -10} m_LocalScale: {x: 0.7319237, y: 0.9847197, z: 0.9847197} m_Children: [] m_Father: {fileID: 0} @@ -73300,7 +73306,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1519184531} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.40732515, y: 1.2543883, z: -10} + m_LocalPosition: {x: 0.30580938, y: 1.2543883, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 772033161} diff --git a/Final Platformer/Assets/Scripts/Bomb.cs b/Final Platformer/Assets/Scripts/Bomb.cs index ea8f975..cf5ee19 100644 --- a/Final Platformer/Assets/Scripts/Bomb.cs +++ b/Final Platformer/Assets/Scripts/Bomb.cs @@ -23,7 +23,7 @@ public class Bomb : MonoBehaviour if (other.CompareTag("Tilemap")) { - return; //destroys the bullet if it hits any part of the tilemap + return; //does not destroy object on collision with the tilemap (used for certain enemies like the bomb) } } diff --git a/Final Platformer/Assets/Scripts/Button.cs b/Final Platformer/Assets/Scripts/Button.cs index c098234..b8ce1bd 100644 --- a/Final Platformer/Assets/Scripts/Button.cs +++ b/Final Platformer/Assets/Scripts/Button.cs @@ -16,9 +16,9 @@ public class Button : MonoBehaviour { Debug.Log("SampleScene" + mainMenuName); - SceneManager.LoadScene(mainMenuName); + SceneManager.LoadScene(mainMenuName); //changes scene when button is clicked - Time.timeScale = 1f; + Time.timeScale = 1f; //makes sure the scene isn't frozen when the scene starts } } diff --git a/Final Platformer/Assets/Scripts/Door.cs b/Final Platformer/Assets/Scripts/Door.cs index 6824069..d5b3bcd 100644 --- a/Final Platformer/Assets/Scripts/Door.cs +++ b/Final Platformer/Assets/Scripts/Door.cs @@ -10,7 +10,7 @@ public class Door : MonoBehaviour // Start is called before the first frame update void OnTriggerEnter2D(Collider2D other) { - Destroy(other.gameObject); + Destroy(other.gameObject); //destroys the object when collided with the door StartCoroutine(Win()); } @@ -18,7 +18,7 @@ public class Door : MonoBehaviour IEnumerator Win() { yield return new WaitForSeconds(5f); - SceneManager.LoadScene(winScene); + SceneManager.LoadScene(winScene); //goes to the win scene } } diff --git a/Final Platformer/Assets/Scripts/MainMenuButton.cs b/Final Platformer/Assets/Scripts/MainMenuButton.cs index fcc027f..5f740e2 100644 --- a/Final Platformer/Assets/Scripts/MainMenuButton.cs +++ b/Final Platformer/Assets/Scripts/MainMenuButton.cs @@ -14,6 +14,6 @@ public class MainMenuButton : MonoBehaviour { Debug.Log("Menu" + mainMenuName); - SceneManager.LoadScene(mainMenuName); + SceneManager.LoadScene(mainMenuName); //goes to the corresponding scene when button is pressed } } diff --git a/Final Platformer/Assets/Scripts/PlayerController.cs b/Final Platformer/Assets/Scripts/PlayerController.cs index fca9a81..7c8ee99 100644 --- a/Final Platformer/Assets/Scripts/PlayerController.cs +++ b/Final Platformer/Assets/Scripts/PlayerController.cs @@ -30,15 +30,15 @@ public class PlayerController : Physicsobject void SetfuelText() { - fuelText.text = "JETPAK: " + fuel.ToString(); + fuelText.text = "JETPAK: " + fuel.ToString(); //sets the coresponding text to the following } void Awake() { - spriteRenderer = GetComponent(); - animator = GetComponent(); + spriteRenderer = GetComponent(); //gets the sprite renderer + animator = GetComponent(); //gets the animator } protected override void ComputeVelocity() @@ -47,9 +47,9 @@ public class PlayerController : Physicsobject move.x = Input.GetAxis("Horizontal"); //gives the player the velocity needed to jump - if (Input.GetKeyDown("w")) + if (Input.GetKeyDown("w")) //lets the player jump { - if (fuel >= 1) + if (fuel >= 1)//checks if there is fuel { velocity.y = jumpTakeOffSpeed; Instantiate(fly, jet.position, jet.rotation); @@ -69,7 +69,7 @@ public class PlayerController : Physicsobject } } - if (Input.GetKeyDown("s") && fuel <= 0) + if (Input.GetKeyDown("s") && fuel <= 0)//refills fuel if at 0 { fuel = fuel + 25; @@ -80,8 +80,8 @@ public class PlayerController : Physicsobject - if (move.x < 0 && facingRight) Flip(); - if (move.x > 0 && !facingRight) Flip(); + if (move.x < 0 && facingRight) Flip(); //flips the player right + if (move.x > 0 && !facingRight) Flip();//flips the player left void Flip() @@ -90,8 +90,8 @@ public class PlayerController : Physicsobject transform.Rotate(Vector2.up * 180); //flips the player } - animator.SetBool("grounded", grounded); - animator.SetFloat("velocityX", Mathf.Abs(velocity.x) / maxSpeed); + animator.SetBool("grounded", grounded); //plays the jump animation in the animator + animator.SetFloat("velocityX", Mathf.Abs(velocity.x) / maxSpeed); //plays the running animation in the animator diff --git a/Final Platformer/Assets/Scripts/Playerreadyscene.cs b/Final Platformer/Assets/Scripts/Playerreadyscene.cs index ed3b5a6..82b3bfe 100644 --- a/Final Platformer/Assets/Scripts/Playerreadyscene.cs +++ b/Final Platformer/Assets/Scripts/Playerreadyscene.cs @@ -19,4 +19,5 @@ public class Playerreadyscene : MonoBehaviour yield return new WaitForSeconds(3f); SceneManager.LoadScene(mainMenuName); } + //when the player ready scene appears, then it will start the coroutine that brings it to the main scene } diff --git a/Final Platformer/Assets/Scripts/Weapon.cs b/Final Platformer/Assets/Scripts/Weapon.cs index 69409cc..dfd0dc3 100644 --- a/Final Platformer/Assets/Scripts/Weapon.cs +++ b/Final Platformer/Assets/Scripts/Weapon.cs @@ -11,9 +11,6 @@ public class Weapon : MonoBehaviour public float fireRate; private float nextFire; - public bool facingRight = true; - - Vector3 tempLocalScale; void Start() {