My progress so far: 4 games/demos

So I’ve finished the snowboarding game on Unity Game Developer 2D course. But in-between course sections i decided to do my own projects. I give each project about a week my 4th one is what i liking most so far.

Progress video

For my 4th project it started on the 28th I decided to rewrite my code for project 2 to make it much better fix the bugs that were in it and add new features clean and comment the code. Granted the code has gotten dirty again from adding features but hopefully I can clean it by weeks end. I also made all the art on project 4 myself as I’m learning to do pixel art for my games too.

Let me guy know what you think: https://www.youtube.com/watch?v=Ij3AbAta1KM

GIF 5-2-2022 8-37-21 PM

Also here’s my script for the player controller if anyone see any glaring flaws please let me know. (I realize as I post this for spawning smoke I should have made it its own method that gets called instead of calling all 3 spawns at once)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    //{ Movement code
    [SerializeField] float baseSpeed;
    [SerializeField] float sprintSpeed;
    private float moveSpeed;
    private Rigidbody2D rb;
    private float moveInput;
    // Movement Code}

    //{ Jump Code
    [SerializeField] float jumpForce;
    [SerializeField] bool isGrounded;
    [SerializeField] Transform groundCheck;
    [SerializeField] float checkRadius;
    [SerializeField] LayerMask whatIsGround;
    [SerializeField] GameObject jumpSmoke1;
    [SerializeField] GameObject jumpSmoke2;
    [SerializeField] GameObject jumpSmoke3;
    [SerializeField] GameObject smokeSpot1;
    [SerializeField] GameObject smokeSpot2;
    [SerializeField] GameObject smokeSpot3;
    // Jump Code}

    //{ Extra Jump Code
    [SerializeField] int extraJumpsAmount;
    private int extraJumps;
    // Extra Jump Code}

    //{ Wall Jump Code
    [SerializeField] bool isGroundedWall;
    [SerializeField] Transform wallCheck;
    [SerializeField] float checkRadiusWall;
    [SerializeField] LayerMask whatIsWall;
    [SerializeField] int extraWallJumpsAmount;
    private int extraWallJumps;
    // Wall Jump Code}

    //{ Sprite Code
    SpriteRenderer spriterenderer;
    private bool lookingRight;
    // Sprite Code}

    //{ Audio Controller
    [SerializeField] AudioClip jumpSFX;
    // Audio Controller}

    private void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        spriterenderer = GetComponent<SpriteRenderer>();
        extraJumps = extraJumpsAmount; // sets jump amount
        extraWallJumps = extraWallJumpsAmount; // sets wall jump amount
        moveSpeed = baseSpeed; // sets base speed

    }

    private void FixedUpdate()
    {
        
        isGrounded = Physics2D.OverlapCircle(groundCheck.position, checkRadius, whatIsGround); // Raidus check for ground object
        isGroundedWall = Physics2D.OverlapCircle(wallCheck.position, checkRadiusWall, whatIsWall); // Raidus check for wall object
    }

    private void Update()
    {

        movementControl();
        //{ Sprite Flip to face proper direction.
        if (rb.velocity.x > 0 && lookingRight == false) // checks Rigidbody2D to see what way the player is moving
        {
            transform.Rotate(0f, -180f, 0f);
            lookingRight = true;
        }
        else if (rb.velocity.x < 0  && lookingRight == true) // checks Rigidbody2D to see what way the player is moving
        {
            transform.Rotate(0f, 180f, 0f);
            lookingRight = false;
        }
        // Sprite Flip to face proper direction.}

        extraJump(); // Load jump code
        wallJump(); // Load wall jump code
    }


    void movementControl()
    {
        moveInput = Input.GetAxisRaw("Horizontal"); // Gets movement keys from unity engine
        if (Input.GetKeyDown(KeyCode.LeftShift) && isGrounded == true)
        {
            moveSpeed = sprintSpeed; // Applies speed
        }
        else if (Input.GetKeyUp(KeyCode.LeftShift))
        {
            moveSpeed = baseSpeed; // Applies speed
        }

        if (Input.GetKeyDown(KeyCode.S)) //Set grav to high to groundpound
        {
            rb.gravityScale = 5;
        }
        else if (Input.GetKeyUp(KeyCode.S)) // sets grav back to normal
        {
            rb.gravityScale = 1;
        }

        rb.velocity = new Vector2(moveInput * moveSpeed, rb.velocity.y); // Applies speed

    }
    
    void extraJump() //Controller for Jumping
    {
        if (isGrounded == true) //Check to see if Grounded to reset extra jumps
        {
            extraJumps = extraJumpsAmount;           
        }

        if (Input.GetKeyDown(KeyCode.W) && extraJumps > 0 && isGroundedWall == false) //Starts the double jump then take one off counter
        {
            rb.velocity = Vector2.up * jumpForce;
            GetComponent<AudioSource>().PlayOneShot(jumpSFX);  //Plays selceted audio in editor
            Instantiate(jumpSmoke1, smokeSpot1.transform.position, smokeSpot1.transform.rotation); //spawns smoke cloud under you on jump
            Instantiate(jumpSmoke2, smokeSpot2.transform.position, smokeSpot2.transform.rotation); //spawns smoke cloud under you on jump
            Instantiate(jumpSmoke3, smokeSpot3.transform.position, smokeSpot3.transform.rotation); //spawns smoke cloud under you on jump
            extraJumps--;
        }
        else if (Input.GetKeyDown(KeyCode.W) && extraJumps == 0 && isGrounded == true) // Check if grounded to do base jump wihtout taking extra jump
        {
            rb.velocity = Vector2.up * jumpForce;
            GetComponent<AudioSource>().PlayOneShot(jumpSFX);  //Plays selceted audio in editor
            Instantiate(jumpSmoke1, smokeSpot1.transform.position, smokeSpot1.transform.rotation); //spawns smoke cloud under you on jump
            Instantiate(jumpSmoke2, smokeSpot2.transform.position, smokeSpot2.transform.rotation); //spawns smoke cloud under you on jump
            Instantiate(jumpSmoke3, smokeSpot3.transform.position, smokeSpot3.transform.rotation); //spawns smoke cloud under you on jump
        }
    }

    void wallJump() //Controller for Wall Jumping
    {
        if (isGroundedWall == false) //Check to see if Grounded to reset extra jumps
        {
            extraWallJumps = extraWallJumpsAmount;
        }

        if (Input.GetKeyDown(KeyCode.W) && extraWallJumps > 0 && isGroundedWall == true)
        {
            rb.velocity = Vector2.up * jumpForce;
            GetComponent<AudioSource>().PlayOneShot(jumpSFX); //Plays selceted audio in editor
            extraWallJumps--;
            Instantiate(jumpSmoke1, smokeSpot1.transform.position, transform.rotation); //spawns smoke cloud under you on jump
            Instantiate(jumpSmoke2, smokeSpot2.transform.position, transform.rotation); //spawns smoke cloud under you on jump
            Instantiate(jumpSmoke3, smokeSpot3.transform.position, transform.rotation); //spawns smoke cloud under you on jump
        }
    }
}