In this video tutorial we start making a Super Mario Clone!!! I’ll cover Pixel Art with Gimp, Sprites, Setting up a New Game, Cleaning up Images, Slicing Sprite Sheets, Designing Scenes, Tracking Chracters with a Camera, and Much More.
All of the code used follows the video below. Here is a link to all the Sounds and Images I use in this series.
If you like videos like this consider donating $1 or simply turn off AdBlock. Either helps a lot 🙂
[googleplusone]
Download all of my Unity game files so far for Pong, Space Invaders, Tetris and Mario
CameraMove.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraMove : MonoBehaviour { // Put Manny here to track his movement public Transform cameraTarget; // How quickly the camera moves towards Manny public float cameraSpeed; // Min and max X and Y movements public float minX; public float minY; public float maxX; public float maxY; // Update used when dealing with Rigid Bodies void FixedUpdate(){ // Make sure the camera has a target if (cameraTarget != null) { // Lerp smoothes movement from the starting position // to the targets position var newPos = Vector2.Lerp (transform.position, cameraTarget.position, Time.deltaTime * cameraSpeed); // Define the cameras new postion var vect3 = new Vector3 (newPos.x, newPos.y, -10f); // Clamp gets the cameras x position and clamps // it between the min and max value var clampX = Mathf.Clamp (vect3.x, minX, maxX); var clampY = Mathf.Clamp (vect3.y, minY, maxY); // Move the camera transform.position = new Vector3(clampX, clampY, -10f); } } } |
Leave a Reply