Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
added comments
  • Loading branch information
ars17035 committed May 5, 2020
1 parent f16a599 commit 52d4c7a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 21 deletions.
10 changes: 8 additions & 2 deletions Final Platformer/Assets/Scenes/SampleScene.unity
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion Final Platformer/Assets/Scripts/Bomb.cs
Expand Up @@ -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)
}

}
Expand Down
4 changes: 2 additions & 2 deletions Final Platformer/Assets/Scripts/Button.cs
Expand Up @@ -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
}
}

4 changes: 2 additions & 2 deletions Final Platformer/Assets/Scripts/Door.cs
Expand Up @@ -10,15 +10,15 @@ 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());
}

// Update is called once per frame
IEnumerator Win()
{
yield return new WaitForSeconds(5f);
SceneManager.LoadScene(winScene);
SceneManager.LoadScene(winScene); //goes to the win scene
}

}
2 changes: 1 addition & 1 deletion Final Platformer/Assets/Scripts/MainMenuButton.cs
Expand Up @@ -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
}
}
20 changes: 10 additions & 10 deletions Final Platformer/Assets/Scripts/PlayerController.cs
Expand Up @@ -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<SpriteRenderer>();
animator = GetComponent<Animator>();
spriteRenderer = GetComponent<SpriteRenderer>(); //gets the sprite renderer
animator = GetComponent<Animator>(); //gets the animator
}

protected override void ComputeVelocity()
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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()
Expand All @@ -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



Expand Down
1 change: 1 addition & 0 deletions Final Platformer/Assets/Scripts/Playerreadyscene.cs
Expand Up @@ -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
}
3 changes: 0 additions & 3 deletions Final Platformer/Assets/Scripts/Weapon.cs
Expand Up @@ -11,9 +11,6 @@ public class Weapon : MonoBehaviour
public float fireRate;
private float nextFire;

public bool facingRight = true;

Vector3 tempLocalScale;

void Start()
{
Expand Down

0 comments on commit 52d4c7a

Please sign in to comment.