
The course requires experience with Unity and C#, isn't for complete beginners, and features long coding sessions with downloadable resources to compare your code, using Unity 2020.1.3.8f1 (or 2021 LTS).
Learn to resolve issues in Unity 2D and C# by reading error messages, checking code for typos, and using the lecture code link to compare and fix problems.
Ask for help in the Q&A section if something isn’t clear, and receive a detailed written explanation or a new lecture explaining the topic within three days.
Initialize a new Unity project from the core template, set location and name, create assets and scripts folders, and open Visual Studio for script editing and play mode.
Download and unzip the pixel assets zip from GitHub, organize models and sounds into your survival 2D project's assets folder, and create a resources folder with links.txt for later use.
Import environment tilesets, configure the tile map with the tile palette, paint grass and flowers, and place a central altar prop to shape your game environment.
Add a player by importing the night idle sprite, using the sprite editor to slice animations, creating a player object, and aligning layers and scaling for proper positioning.
Create a new player controller script in Unity and implement frame-by-frame movement by updating the player's transform with a vector3 and delta time.
Learn how to use the player's transform and Vector3 coordinates to move in a Unity 2D scene, adjusting x and y with delta time for smooth movement.
Create a follow camera script in Unity that tracks the player's transform with an offset and distance, updating in late update for smooth camera movement.
Learn to implement the new input system in Unity to read keyboard input and drive player movement with a Vector2 from the move action, including diagonals.
Create a scriptable object input reader to forward movement vectors from arrow keys to the player controller, enabling persistent, shareable input data across UI and gameplay components.
Shows how to create scriptable objects as reusable data containers and wire them into the player input handler and follow camera in Unity for shared values.
Learn to implement action delegates in Unity 2D by creating a move event that passes a Vector2 input from the input reader to the player controller.
Compute player movement by reading movement input, forming a movement vector from input x and y, scaling by target speed and delta time, and applying it to the player's transform.
Expose a public target speed on the player controller to adjust movement in the Unity editor, and fine tune how fast the player moves during gameplay.
Explore creating idle and running animations for the knight by slicing sprites, making animation clips, and attaching an animator controller to the knight game object, with adjustable frame samples.
Create and integrate a running animation for the Night Idol character by adding a new clip, arranging samples on the timeline, and setting the default state to run.
Switch between idle and run animations by blending the movement blend value with the target speed using linear interpolation, driven by movement input and time delta.
Create a 1d blend tree in Unity's animator, add a speed parameter, and blend between idle and run animations for locomotion as speed changes.
Create a player behavior script that updates the animator's speed parameter from the movement blend, enabling automatic idle and run transitions based on player movement.
Implement a reusable character behavior in Unity that flips the sprite as the player moves. Extend this to enemies via a base behavior and adjust animator speed during movement.
Implement sprite flipping for the 2D character by adding a public isFacingLeft flag and a flip method that toggles sprite flip X during left or right movement.
Set up a skeleton enemy in Unity by importing a skeleton sprite pack, slicing sprites with the sprite editor, and creating a walk animation with an animator controller.
Create a skeleton enemy behavior in Unity 2D using a state machine with follow player and attack states, actions, and conditions that trigger animation changes when the player is close.
Build a Unity state machine using a scriptable object state and a separate state class, test the first skeletal enemy state with lifecycle methods and debug logs.
Move the state script object into the state machine folder. Create a core state class in a new core folder, rename it to state machine core, and adjust the namespace.
Turn the state machine into functional states with on enter, on exit, and on update lifecycle methods, using a factory and origin script object to create get state instances.
Initialize all states with a private _states array sized to the states table and set the current state to zero, then call enter on start and update the current state.
Define and initialize state actions within a state machine, showing how each state holds multiple actions and uses enter, update, and exit via scriptable objects to control behavior.
Create a follow player state action in the enemy state machine to make the enemy chase the player, wiring a follow player script and asset menu in Unity.
Initialize and wire state actions in a Unity 2D C# skeleton state, creating and loading action instances, iterating updates, and overriding follow player behavior with debug logs.
Explore the state machine core driving a skeleton enemy, initialize states and actions, and update the follow player action each frame in Unity.
Implement the awake lifecycle to pass the state machine core to actions, access the enemy transform, and expose the enemy position during the follow player action for debugging and movement.
Implement a singleton game manager in Unity to provide a single accessible instance for the player and other scripts, with a public static instance and a null-check to prevent duplicates.
Learn to access the player via the game manager by exposing a player behavior field and a get player method, then read player and enemy positions from transforms.
Implement enemy movement towards the player by updating the enemy transform with moveTowards using the player position and delta time, after obtaining the player position in the game manager.
Add a public speed modifier to the script table object and access it from the origin follow player, then apply it to the enemy's move towards behavior to adjust speed.
Set capsule colliders on the player and enemy and add rigidbody components to enable proper collisions in 2d physics. Adjust gravity scale and mass to control collision response.
Set a distance to keep between the player and enemy using a distance threshold, adjust in the inspector, and prevent collisions by returning early in the enemy's follow logic.
Learn to create and manage multiple enemy instances using prefabs and prefab variants, attach shared components on the main prefab, and customize specific variants without duplicating work.
Apply the prefab workflow to the player by creating a dedicated player folder, turning the knight body into a prefab, and creating a prefab variant from it.
Implement collision handling for OnCollisionEnter2D and OnCollisionExit2D in Unity 2D with capsule colliders, using a player tag and collision attack string on prefabs.
Create a damageable system with a damage double script on player and enemy prefabs, enabling collision-based take damage. Learn to fetch the damageable component on collision and apply damage safely.
Apply a damageable component to players and enemies, and implement a damage interval using a damage timer and delta time to limit damage to one hit per interval.
Implement a sprite flash damage effect in Unity by swapping the player's sprite renderer material to a damage flash material for a brief moment, then revert to the original material.
Implement a non blocking damage flash by swapping the sprite renderer material to a red flash on damage and restoring the original material after a short wait with a coroutine.
Explore customizing the damage flash color by passing a color parameter to the flesh damage method, updating the material color, and applying the effect to various objects.
Implement a new state action flip in player direction to make enemies face the player by flipping orientation based on relative position, integrated into the enemy state machine in Unity.
Implement an enemy flip by comparing player and enemy x positions and turning left when the enemy is on the right side. Obtain positions via game manager and character behavior.
Add a blood splash particle effect to the player prefab using a particle system, and tune size, lifetime, speed, color, and rendering order to align with the enemy's movement.
Enable the blood particle to emit when the player is hit by the enemy, using a public particle system in the damageable script and assign it to the player prefab.
Tweak the blood splash particle in the player prefab by shrinking the shape to 0.05 and lowering emissions. Adjust start lifetime and speed to balance visibility, then test in game.
Create a health bar on a world-space canvas for the player using a slider, background, and health fill image, setting max value to 100, and position it on the player.
Create a scriptable object int value to hold health, with initial and runtime values, organized under assets/values/int value, featuring a reset and sterilization lifecycle.
Explore how sterilized and non-sterilized fields in Unity drive runtime values, using on after serialize and on before serialize to update and reset values in the editor.
Learn to initialize and track player and enemy health in Unity with private fields, Awake initialization, and per-entity health values using scriptable objects.
Display player's health using a Unity slider and a C# script. Create a UI slider bar, expose current and max values, attach to the health bar, and initialize to 100.
Learn to build a health bar in Unity by extending a slider bar, tracking current and max health, and updating the user interface every frame as damage is inflicted.
Display damage text on the canvas to show player or enemy damage, building on the health bar, and set up TextMeshPro with a Pixel Unicode font and centered alignment.
Animate the damage container to pop up the damage text, move it upward, enlarge the font, and fade it out. Learn recording keyframes, adjusting speed, and camera zoom for visibility.
Create an empty animation state and a transition to show the damage text only once, then use an on exit state machine behavior to destroy it.
Create a UI manager to instantiate a damage text prefab inside the damage canvas, display damage when the game runs, and destroy the text after its animation finishes.
Display damage above enemies or the player using a UI manager and a damage display script; render the damage value on a canvas.
Learn to position a damage display above enemies by converting world to screen coordinates to canvas local space using the main camera and RectTransformUtility, updated each frame.
What is Unity?
Unity is a versatile cross-platform game engine, with editor support for Windows, macOS, and Linux. The engine itself allows game development for over 25 platforms, including mobile, desktop, consoles, and virtual reality.
What Will We Build?
Prepare for an immersive journey as we dive into the creation of a compelling 2D survival game with a top-down perspective, aptly named "Undead Survival." Throughout this course, you'll not only build a game but gain invaluable insights into various game development aspects.
Project - Undead Survival:
The primary focus of this course is to guide participants in constructing an entire game from the ground up. The game's objective is to challenge players to endure relentless waves of enemies, striving to survive for as long as possible against an unending onslaught
Here's an in-depth look at what you'll construct:
Survival Dynamics: Implement a captivating survival concept, challenging players to endure relentless waves of enemies.
Scriptable Objects: Utilize Scriptable Objects for a modular and reusable game structure.
State Machine Mastery: Dive into State Machine intricacies for dynamic NPC behaviors with adaptable state transitions.
Versatile Ability System: Develop diverse player and enemy abilities with customizable stats using scriptable objects.
Enemy Spawning: Implement a dynamic enemy spawning mechanism for an ever-evolving challenge.
UI for Game Stats: Create an intuitive UI system to display crucial game statistics in real-time.
Damage and Health System: Construct a comprehensive system for balanced player and enemy health management.
Start/Options Menu: Design a user-friendly menu with navigation and protagonist selection features.
Score Screen and Replay: Implement a score screen for player achievements and seamless replay functionality.
Focus on Reusability: Emphasize creating reusable systems and components for efficient game development.
Main Goal:
The course's primary objective is to teach the creation of reusable systems applicable to various games. Emphasis is placed on the reusability of each component, fostering a deep understanding of how to construct flexible and efficient game development systems.