Summary of "3-1"
Lesson Overview
This video is the third lesson in a 2D Game Programming course, focusing on creating a movable character on a tile-based map, similar to classic 8-bit RPGs like Dragon Quest or Final Fantasy.
The instructor begins by addressing classroom logistics—explaining the large room size and suggesting students move closer or use earphones for better audio during the lesson.
Key Content and Technical Highlights
Character Class Implementation
- The lesson provides a step-by-step walkthrough of implementing a character class that inherits from an existing entity class, which itself extends a pictogram class responsible for handling image data.
- Character sprites are stored as multiple “chips” (small image parts) within a single image file.
- The process covers how to:
- Load the sprite sheet image.
- Slice it into individual chips.
- Animate or change the character’s direction by switching which chip is drawn.
Sprite Sheet Details
- The character sprite sheet (
charchip01.png) contains multiple characters:- A girl
- A white cat
- A chicken
- A boy with a blue hat
- The chip size and the number of chips horizontally are calculated by dividing the image width by the chip size.
Character Class Constructor
- Takes parameters such as:
- Game pointer
- Name
- Bitmap (sprite sheet)
- Chip size
- Position
Drawing Logic
- Calculates which portion of the sprite sheet to draw based on the chip number.
- Uses division and modulo operations to find the row and column of the chip.
- Adjusts the drawing origin to the center of the character rather than the top-left corner for better alignment.
- Implements a draw method using Direct2D functions to render the correct chip portion with full opacity.
Testing and Animation
- The character is tested by creating an instance in the main scene and displaying it.
- The displayed character can be switched by changing the chip number (e.g.,
3for the cat). - The sprite sheet layout:
- Rows correspond to character facing directions (front, left, right, back).
- Columns represent different characters and walking animation frames (legs up/down).
- Walking animation is created by cycling through these frames.
Additional Information
- The instructor shares downloadable resources and code snippets via Slack and Blackboard to help students follow along and recover from errors.
- Throughout the lesson, the instructor adds light humor and casual remarks, such as a tangent about the English origin of the word “source” and sauces on Japanese dishes, making the technical content more engaging.
Conclusion and Next Steps
The session ends with a promise to continue character movement and animation in the next lesson, followed by a break before resuming.
Personalities Appearing
- Main Instructor/Lecturer: Leads the lesson, explains concepts in detail, and interacts with students.
Category
Entertainment