[WIP] 2d platform

Dear friends,

I am working on my 2nd game to help me learn unity. This is going to be a simple 2d platform. I want to scope very small with working mechanic and playable demo for next feedback firday.

I will present my idea shortly and my new game dev document.

Thank you.

Dear friends, I would like to present idea for my first 2d platform as i get to grip with unity.

I would like to focus on mechanics for this. If possible i will get my friend to complete the art at later stage as she is quite handy with krita. I would like to create engaging fast paced platformer for one level. At the moment am not sure how easy or hard this will be my aim is to complete soon for review on feedback friday.

Thanks.

Might want to start from scratch would be my suggestion. You already have assets made for game and people will need steps on how to make those too

Thank you sir, my friend she makes all art for me.

Few more updates, WAITING ON FRIEND TO SEND ME OVER HER ARTWORK FILES.

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

public class CameraScript : MonoBehaviour
{

     //offset from the viewport center to fix damping
    public float m_DampTime = 10f;
    public Transform m_Target;
    public float m_XOffset = 0;
    public float m_YOffset = 0;

    private float margin = 0.1f;

    void Start () {
        if (m_Target==null){
            m_Target = GameObject.FindGameObjectWithTag("Player").transform;
        }
    }

    void FixedUpdate() {
        if(m_Target) {
            float targetX = m_Target.position.x + m_XOffset;
            float targetY = m_Target.position.y + m_YOffset;

            if (Mathf.Abs(transform.position.x - targetX) > margin)
                targetX = Mathf.Lerp(transform.position.x, targetX, 1/m_DampTime * Time.deltaTime);

            if (Mathf.Abs(transform.position.y - targetY) > margin)
                targetY = Mathf.Lerp(transform.position.y, targetY, m_DampTime * Time.deltaTime);
        
            transform.position = new Vector3(targetX, targetY, transform.position.z);
        }
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class PlayerController : MonoBehaviour
{

 

    public float speed;
    public float jumpForce;
    private float moveInput;

    private bool facingRight = true;

    private Rigidbody2D rb;

    private bool isGrounded;

    private bool isDead;



    public Transform startPos;

    public Transform groundCheck;
    public float checkRadius;
    public LayerMask whatIsGround;
    public LayerMask whatIsDead;

    private int extraJumps;
    public int extraJumpsValue;



    // Start is called before the first frame update
    void Start()
    {
        extraJumps = extraJumpsValue;
        rb = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    void FixedUpdate()
    {



        isGrounded = Physics2D.OverlapCircle(groundCheck.position, checkRadius, whatIsGround);

        isDead = Physics2D.OverlapCircle(groundCheck.position, checkRadius, whatIsDead);


        moveInput = Input.GetAxis("Horizontal");
        rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);

        if(facingRight == false && moveInput > 0){
            Flip();
        }
        else if(facingRight == true && moveInput < 0){
            Flip();
        }

    }

    void Update(){


        if(isDead == true){
            Debug.Log("you dided");

            //now reset player pos
            this.transform.position = startPos.transform.position;

            isDead = false;

        }

        if(isGrounded == true){
            extraJumps = extraJumpsValue;
        }

        if(Input.GetButton("Fire1")&& extraJumps > 0){

        

            rb.velocity = Vector2.up * jumpForce;
            extraJumps--;
        }
         else if(Input.GetButton("Fire1") && extraJumps == 0 && isGrounded == true ){
     
             rb.velocity = Vector2.up * jumpForce;
         }
    }


    void Flip()
    {
        facingRight = !facingRight;
        Vector3 Scaler = transform.localScale;
        Scaler.x *= -1;
        transform.localScale = Scaler;
    }


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

public class Patrol : MonoBehaviour
{
 
    public float speed;
    private bool movingRight = true;
    public Transform groundDetection;


    void Update()
    {
        transform.Translate(Vector2.right * speed * Time.deltaTime);

        RaycastHit2D groundInfo = Physics2D.Raycast(groundDetection.position, Vector2.down,2f);
        if(groundInfo.collider == false)
        {
            if(movingRight == true){
                transform.eulerAngles = new Vector3(0,-180,0);
                movingRight = false;
            }else{
                transform.eulerAngles = new Vector3(0,0,0);
                movingRight = true;
            }
        }
    }


}

Today I complete, smooth camera follow, die and respawn, simple enemy ai. If time for tomorrow will hope to work on character animation with friend.