Save this video free

CS50 2D - Lecture 5 - Legend of Zelda

CS50 · 2:05:04 · Watch on YouTube

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

CS50 Lecture 5 builds a top-down Zelda-style game in LÖVE 2D, combining entity states, AABB collision, sword hitboxes, switches, and transitions between procedurally connected dungeon rooms. The implementation also demonstrates data-driven entity definitions, stencil masking for doorway depth, and a queue-based dungeon generator that can be stepped through with Lua coroutines.

Key takeaways

Chapters

0:00 From NES Zelda to a Top-Down Dungeon Game
4:37 Demo: Combat, Switches, Hearts, and Room Transitions
7:08 Day Zero: Top-Down Movement and Player States
9:00 Sprite Sheets, Animation Frames, and Player Dimensions
10:45 Entity Definitions and Data-Driven Animations
17:46 Graphics State Push and Fixed HUD Coordinates
20:48 Reading the Zelda Tile Sheet and Indexing Tiles
24:23 Rendering a Room with Randomized Wall and Floor Tiles
29:41 Room Boundaries and Extending Inherited Movement
34:14 Dungeon Structure: Current Room and Next Room
39:58 Hitboxes and Hurtboxes Have Different Roles
43:28 Sword Attacks: Directional Hitboxes and Animation States
50:43 Adding Enemies and Room-Level Entity Management
55:19 Damage, Health, and Temporary Invulnerability
59:02 Switches as Triggers for Opening Dungeon Doors
1:01:44 Doorway Geometry and Open or Closed Tile Variants
1:09:31 Screen Scrolling as a Room-to-Room Camera Transition
1:12:32 Dispatching Doorway Events from the Player Walk State
1:17:57 Tweening the Camera and Swapping Dungeon Rooms
1:26:01 Stencil Buffers Mask the Player Behind Doorway Arches
1:34:32 LÖVE 11 and LÖVE 12 Stencil Implementations
1:42:33 Visualizing a Queue-Based Dungeon Generator
1:50:37 Queue Traversal, Room Limits, and Dungeon Connectivity
1:54:00 Lua Coroutines for Stepping Through Generation
1:58:33 Data-Driven Design and the Low-Level NES Era
2:01:26 Assignment 5 and the Next Physics Lecture

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:20 Hello world, this is CS 52D Lecture 5. Today we're gonna be looking at the Legend of Zelda, which is a favorite franchise of mine amidst Mario. I like Mario quite a bit as well, but this was one of the first series that I have memory certainly playing, and also we styled it based on the original cartridge for the NES was actually colored gold, so was its sequel, which I thought was kind of a cool thing. This is what the original Zelda looks like, and this is sort of like a famous line that people quote online all the time. It gets referenced in various games. It's a throwback and sort of this is the very first thing you see when you go into the game. You start off, you see this cave, you go in, you grab a sword. It at its time was one of the only games that sort of had this early idea of an open world that you could go out and explore, and it accomplished this via having a bunch of sort of. separate screens that you could transition in and across.

1:11 This is a screenshot of a dungeon. You would also go and navigate sort of these labyrinth type structures, and in today's codebase we'll be primarily focused on this sort of view of what Zelda looks like looking at a dungeon that gets generated and then we can traverse it and we won't have all the bells and whistles per se, but we'll have the sort of famous scrolling and some monsters and the ability to swing your sword and so on and so forth. This was the first Zelda that I played as a kid. This is linked to the past for the Super Nintendo, which took the formula and sort of expanded on it,

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, CS50.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.