2D Side Scroller

In this quest, you will build a 2D Side Scrolling game – think Super Mario Brothers on NES.

Product of Learning

In this quest, you must build a 2D Side Scrolling game. You may “fork” your shadow bots game if you’d like, or you can build something new from scratch. One suggestion is to consider using a silhouette effect for your characters to save time. One of the hardest parts of this game will be figuring out the camera script.
You will have to build your game for playability and complete the reflection below.


You are welcome to use any resources you want. The list below is simply a starting point and in no way represents a chronological list of steps. You WILL have to conduct research to figure out how this works.

The Loughran Camera Script

Directions: Add the script below to your Main Camera. This script allows you to set minimum and maximum X, Y, and Z coordinates to a 2D side scroller to prevent the camera from moving to far left, right, up, and down. The script also adds a drift effect after your player stops moving.

Notice: if using unity’s 2D Standard Assets, deactivate the Camera2DFollow script on the main camera. The two do not work together.

using UnityEngine;
using System.Collections;
public class CameraControl : MonoBehaviour {
    private Vector2 velocity;
    public float smoothTimeY;
    public float smoothTimeX;
    public GameObject player;
    public bool bounds;
    public Vector3 minCameraPos;
    public Vector3 maxCameraPos;
    void Start () {
        player = GameObject.FindGameObjectWithTag ("Player");
    void FixedUpdate()
        float posX = Mathf.SmoothDamp (transform.position.x, player.transform.position.x, ref velocity.x, smoothTimeX);
        float posY = Mathf.SmoothDamp (transform.position.y, player.transform.position.y, ref velocity.y, smoothTimeY);
        transform.position = new Vector3 (posX, posY, transform.position.z);
        if (bounds)
            transform.position = new Vector3 (Mathf.Clamp (transform.position.x, minCameraPos.x, maxCameraPos.x),
                Mathf.Clamp (transform.position.y, minCameraPos.y, maxCameraPos.y),
                Mathf.Clamp (transform.position.z, minCameraPos.z, maxCameraPos.z));

Mario Speed Run