
Create a 2d platformer in Unity 2020 using design patterns. Refactor to a state-based character controller, implement jump, camera follow, ladders, weapons, pickups, UI, and enemy interactions.
The course uses a CC0 assets pack with various asset types for any project, plus free CC0 sounds and music; future videos cover project files and Q&A.
Access the project files and per-video scripts, download and open them in Unity hub, and use the questions and answers section or GitHub links to ask questions and compare scripts.
Open the linked GitHub repo to verify this video's scripts against mine, view red/green change highlights, and download the full Unity project to inspect editor settings and inspector issues.
Rate the course, provide feedback to improve future Unity 2d platformer design-pattern lessons, and learn the Udemy 30-day refund process.
Set up a starter Unity 2D platformer project in Unity Hub with Unity 2020 LTS, import the starter package, and configure the universal rendering pipeline and a follow camera.
Explore preparing assets in Unity and building a tile palette. Learn to draw ground, set a background, and manage layering while configuring the camera for a future character controller.
Explore configuring 2d assets in Unity 2020 for a platformer, including sprite type, sprite mode, pixels per unit, filter, compression, and sprite editor slicing.
Set up a tilemap in Unity 2020 by creating a grid and a rectangular ground tilemap, then use a tile palette to paint and arrange sprites.
Edit tilemaps in Unity 2020 by using the selection and move tools to fix tile slicing and assemble a house from a corrected tile palette.
Create and shape the ground for your 2d platformer by painting tiles with the tile palette, brush, and flood fill, using flip, rotate, and eraser tools for precise layout.
Add a multi-layer background with sky and sea sprites, set pixel per unit and filter mode, and configure sorting layers and order in layer for proper depth.
Learn how sorting layers and order in layers control rendering in Unity, and create layers such as background, agents, player, weapons, and UI to ensure proper visual stacking.
Configure the main camera for a pixel-art 2d platformer with a fixed resolution and aspect ratio, using orthographic projection and a suitable size, and disable anti-aliasing and the skybox.
Learn to build a basic character movement system by prepping a sprite with a collider and rigidbody, handling player input, moving the avatar, and setting up animations with Unity Mecanim.
Create a player agent and its avatar in a 2d Unity platformer, assign a sprite, and add Rigidbody2D and a ground collider to enable proper physics and collisions.
Add a ground collider using a 2D composite collider with a static rigidbody, then use layers to ensure ground collides only with the agent collider.
Implement a Unity 2020 2d platformer player input script to capture keyboard input, expose a movement vector, and relay actions via delegates and unity events for flexible movement.
Master the player input script using multicast delegates and events for actions like attack. Define movement events with vector2 parameters and map keys for jump, attack, and menu in Unity.
Create a robust player input system in Unity by implementing get movement input, jump input, attack input, weapon swap, and menu input in the player input script, with null-conditional calls.
Create a reusable agent script in Unity 2020 that moves the player by subscribing to the movement event and applying horizontal velocity to the rigidbody while gravity handles vertical motion.
Create idle and run animations for the player in Unity 2020 using the meconium animation system, build and assign an animator controller, and prepare to drive them via script.
Create and control run and idle animations in Unity using an agent animations script and an enum-driven switch to trigger the animator play method based on movement velocity.
Learn to flip a 2D Unity 2020 platformer character by flipping the agent’s x-scale based on left or right input, and wire a face-direction method to player input.
Fix the wall-sticking by applying a 2d physics material with zero friction and no bounce to the agent in Unity; assign it to prevent sticking and allow falling.
Explore why our current movement system is insufficient and refactor with the state pattern to keep behavior extendible, enabling future jumping, clambering, and attack logic.
See how a high-level agent script bundled with low-level movement creates tangled jumping and climbing logic, highlighting the need for refactoring and a future state pattern.
Explore how the state pattern enables a Unity 2d platformer character to change behavior with state transitions, using a context agent and concrete states for movement, jumping, and animations.
Create a reusable state pattern in Unity by designing an abstract state class with enter and exit hooks, shared data, and overridable updates for a responsive 2d platformer.
Implement an idle state in a Unity 2D platformer using the state pattern, play idle animation, halt movement, and transition to a movement state on input.
Create a movement state in Unity for a 2D platformer, using a movement data object to share speed and velocity across states, implement acceleration, and plan transitions to idle.
Learn how to add acceleration to a 2d platformer movement state in Unity. Calculate speed and horizontal direction, update velocity with movement data, delta time, and preserve gravity in rigidbody.
Refactor the agent script to use a state pattern, wiring idle and movement states for input handling, state transitions, and per-state updates, with debug state display.
Explore implementing a jump mechanic in a 2D Unity platformer by building a grounded detector, gizmo, and custom collider, and design a state-based jump and fall system with transitions.
Create and integrate jump and fall animations using sprite frames in Unity 2020, then connect them in the player animator and loop them while testing in the project.
Set up jump and fall animations by selecting frames 11–13 and 14–16 in the animation window, then adjust the timeline; plan a ground detector script in the next video.
Create a grounded detector in Unity using a box cast to detect ground contact and a custom collider at the feet, enabling jumping only when grounded.
design a unity ground detector using a box cast offset from the collider, with a ground mask and gizmos that visualize with red and green colors when grounded.
Implement a ground detector using a box cast to determine if the agent is grounded, expose results via a detector component, and integrate checks in update and fixed update.
Learn a state-driven movement system for a 2d platformer, implementing idle, move, jump, and fall states with grounded checks and default transitions.
Create a jump state in Unity by converting movement state methods from private to protected, enabling inheritance, and implement jump animation trigger when entering the jump state.
Override the jump state to trigger the jump animation, access the agent and animation manager to play jump and fall, and set velocity with jump force to control height.
Implement a better jump by using jump pressed to control height, apply maximum initial force, add extra gravity when released, and transition to fall state when not grounded.
Test the jump state by configuring transitions, setting acceleration and speed, and implementing default jump behavior in the abstract state, then verify grounded transitions and spacebar input.
Implement the fall state in Unity by adding a gravity modifier to control fall speed, extend movement state for horizontal movement, and override state methods to prevent jump transitions.
override fall state logic to play animation, apply gravity, and compute horizontal movement, then transition to idle or movement when grounded to complete the full state behavior.
Finish fall state transitions in a 2d Unity platformer using design patterns. Move to the full state when not grounded and assign full state references across movement, idle, and jump.
Use a scriptable object named agent data to centralize movement, jump, and gravity parameters. This asset, editable from the inspector, lets states share data for a data-driven workflow.
In section six, set up a cinema camera to follow the player avatar, adjust virtual camera settings to improve look and feel, and confine the camera to the play area.
Implement a 2d Cinemachine camera in Unity to follow the player avatar using a virtual camera, assign follow and look at targets, and adjust the orthographic size for optimal view.
Tune the cinema camera in Unity to achieve smooth follow with dead zone, soft zone and dampening, and enable pixel perfect extension for crisp pixel graphics in a 2d platformer.
Use the cinema camera package confiner to restrict the camera to a polygon collider boundary, and configure collision layers so the camera follows the player without unwanted collisions.
Begin section seven by recalling ground and map setup for level one, then introduce onboarding, platform creation, platform component tweaks, climbing prep, map details, and parallax to create 3d illusion.
Expand the map with more ground and platforms to test jumping and onboarding, using the tile palette and grid tools to paint and copy map sections.
Edit and place ground tiles for a 2d Unity platformer, test the map with spacebar jumps, and refine visuals using brush, eraser, and color picker while planning one-way collider platforms.
Create a background tile map to render background platforms behind the ground. Set up a one-way collider so the player can jump onto them without colliding from below.
Apply the platform effector to a composite collider to create one-way platforms and improve jumping, then adjust grounded checks and the surface arc to fix edge collisions.
Design and implement a 2d platformer map in Unity 2020, adding ground platforms and a ladder with a trigger collider to enable climbing. Test jumps and collision layers.
Paint ground tiles and background details in a Unity 2d platformer, test jumps and gaps, and adjust layer orders to reveal foreground details before adding parallax in a future video.
Implement a parallax effect by moving the background sea and islands slower than the main camera to create a 3d-like depth, using a custom parallax effect script.
Develop a climbing mechanic in a 2d platformer: build a climbing animation, detector near ladders, and a climbing state that ignores gravity while integrating with the state pattern for transitions.
Create a looping climbing animation from four ladder sprites, add it to the animator as 'climbing', connect it to the avatar’s animation script, and enable ladder detection to trigger climbing.
Create a climbing detector in Unity to detect proximity to ladders using a layer mask and a can climb flag, and toggle climbing with trigger events.
Implement a climbing state in a Unity 2d platformer, wire in the climbing detector, and manage gravity, jumping, and state transitions to idle when climbing ends.
Implement the climbing state by suspending gravity, enabling controlled movement, transitioning to idle when climbing isn't possible, and using the animation manager to start and stop climbing.
Implement transitions from idle, jump, and fall states to the climbing state in Unity, enabling climbing near ladders by pressing up or down and refining movement.
Design a simple player UI in Unity with a main canvas, health and points UI, using TextMesh Pro, and implement UI logic via scripts and a master player UI class.
Set up a reusable player UI with Unity's canvas component, choosing world space or overlay render modes. Configure the canvas scaler to 1920x1080 to keep UI elements consistent.
Learn to set up Text Mesh Pro in Unity, import the essentials, create a custom font atlas, and apply it to UI text as a replacement for legacy text.
Create and customize a health UI in Unity 2020 by building a panel, anchoring to the top-left, using sliced sprites, and arranging heart icons with a horizontal layout group.
Create a top-right points UI panel in Unity, with a bowl image and points text, placed side by side using a horizontal layout group, and fit to the panel.
Create a new points UI panel in the player UI, positioned top-right with offsets, and add an image and a 'points' text in the homespun sdf one font.
Implement and manage a health user interface in Unity by creating life element UI components, instantiating prefabs, and updating full or empty sprites through a Health UI script.
Create a points UI script in Unity that updates a TextMeshPro field, triggers a text change event, and connects with the health UI for centralized player UI control.
Create a player UI script in Unity to manage health and points displays, initialize health, set health, and wire UI components via Awake for responsive gameplay.
Create a response system with a response point class and a response point manager to detect player reach events, then place points for retries after the pit.
Explore the idea behind a response point system in a Unity 2D platformer, respawning the player near failed obstacles, deducting a life, and resetting with full lives.
Create and configure a respawn system in Unity 2020 by building a spawn point prefab, a trigger-based collider, and a response point script with Unity events.
Create a respawn point manager in unity that gathers child respawn points, tracks the current point, and offers methods to update, trigger a respawn, and reset points for level restarts.
Create a pit collider underneath the map to detect when the player falls, triggering the spawn point manager and agent death handling using a box cast and layer mask.
Learn to implement a respawn mechanism by wiring an agent died event to a response manager, using design patterns for loosely coupled code and spawn-point testing in Unity.
Configure multiple spawn points for a Unity 2d platformer by creating reusable prefabs, organizing them under a spawn point manager, and wiring Unity events to update the active spawn point.
Create a response helper to call the response manager from the player prefab. Enable level-wide spawning via spawn points and prefabs across levels.
Making games is fun but there is nothing more frustrating than adding new code to create a new game mechanic just to have the old code break. At this point it stops being fun and bug search begin - which honestly is the least fun thing to do when you could instead design a new level for your game. That is why it is so important to learn how to create maintainable and extensible code base for your game. If you search for a solution you will find Design patterns and SOLID principles. If you have every tried to learn design patterns you surely know that it is not intuitive when to use it. Each presents a solution but requires time and additional code to work. Implementing them just for the sake of it is just a waste of time - so when should we use them? The answer is - when adding new features or extending the old ones seems like a lot of work and effort.
In this course you will learn how to use state pattern as a base to create your character controller and how to refactor your code to other design patterns when you can see that adding new feature starts to be "painful" and unintuitive. At the end you will know the way of thinking behind the refactoring process and behind the decision when to use design patterns.
You will learn how to write decoupled classes - meaning that class A doesn't rely on Class B but if they both exist they can communicate witch each other to create our desired game mechanics.
This is an Intermediate course about creating a maintainable and extensible codebase and in effect a full 2d platformer game. You should know your way around Unity and feel comfortable coding in C# using Visual Studio IDE.
You will learn how to:
Create a character that can move and jump and extend it's character controller with new features like: climbing behaviour, attack logic etc.
How to reuse players character controller for enemies
How to create 3 types of enemies as well as a end level boss
How to use factor method pattern to make your code more maintainable
How to use Strategy pattern to implement simple AI system
Specific platformer features that we will implement:
picking up resources
respawn system
adding platforms with one-way collider
creating parallax effect for our level
melee and throwable weapons
and much more!
If for any reason you don't enjoy the course you have 30 days from the purchased date to get your money back - no questions asked.
I hope to see you in the course :)
-Peter