Beginner C++ Game Programming Tutorial 21
2D arrays are awesome because they fuckin' let us organize or data and shit. Board games like chess, strategy games like Civilization, roguelikes, RTS games, X-Com... it's all grids baby. Also, time to learn how to circular depend our shit with forward declaration (you should still avoid circ. dep. when possible tho).
Topics Covered
- Mapping from a logical 2D array to 1D array
- Using forward declaration to enable circular dependency by breaking a circular #include chain
Video Timestamp Index
Source Code Download
Homework
The goal for this video's homework is to modify Snek so that the field can contain 3 things (besides the Snek): goals, obstacles, and poison. Hitting an obstacle ends the game. Hitting a goal will grow the Snek and spawn another goal and an obstacle. Hitting a poison will speed the Snek up.
Other good modifications include: not speeding up the Snek over time or when a goal is eaten (the poison is enough for that) and adding a speedup key that can speed the Snek up to a certain speed (but never slower than its default speed).
The solution to this homework is coming soon.