Difference between revisions of "Beginner C++ Game Programming Tutorial 21"
(Created page with "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...") |
(→Homework) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Topics Covered == | == Topics Covered == | ||
− | * Mapping from logical 2D array to 1D array | + | * Mapping from a logical 2D array to a 1D array |
* Using forward declaration to enable circular dependency by breaking a circular #include chain | * Using forward declaration to enable circular dependency by breaking a circular #include chain | ||
+ | |||
+ | == Notes == | ||
+ | |||
+ | Here's an article I found that I like. I like it because it shits in the mouth of <code>[][]</code> multidimensional arrays, which I am no fan of. I maybe wouldn't agree with 100% of what this dude is saying, but it's mostly valid points: [http://www.cplusplus.com/forum/articles/17108/ fuck MD arrays forever]. | ||
+ | |||
+ | Also see this discussion here: [http://forum.planetchili.net/viewtopic.php?f=3&t=4011&start=10#p24518 Chili talks about <code>[][]</code> arrays]. | ||
== Video Timestamp Index == | == Video Timestamp Index == | ||
− | [https://youtu.be/ | + | [https://youtu.be/Zbw58vTotok Tutorial 21] |
== Source Code Download == | == Source Code Download == | ||
Line 15: | Line 21: | ||
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. | 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 | + | 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 current normal speed). |
− | The solution to this homework is | + | The solution to this homework is [https://www.youtube.com/edit?o=U&video_id=Vcb_Z2C7Pfc here]. |
== See also == | == See also == |
Latest revision as of 15:24, 12 May 2017
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).
Contents
Topics Covered
- Mapping from a logical 2D array to a 1D array
- Using forward declaration to enable circular dependency by breaking a circular #include chain
Notes
Here's an article I found that I like. I like it because it shits in the mouth of [][]
multidimensional arrays, which I am no fan of. I maybe wouldn't agree with 100% of what this dude is saying, but it's mostly valid points: fuck MD arrays forever.
Also see this discussion here: Chili talks about [][]
arrays.
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 current normal speed).
The solution to this homework is here.