Difference between revisions of "Beginner C++ Game Programming Tutorial 5"
(→Homework) |
|||
Line 13: | Line 13: | ||
The solution will be given in a future video. | The solution will be given in a future video. | ||
+ | |||
+ | === Solution Errata === | ||
+ | In the solution, Chili declares (in <code>Game</code>) the <code>bool</code> variable <code>controlIsPressed</code> to signal that the shape should be changed. First of all, the key being pressed is the SHIFT key, so this is confusing. | ||
+ | |||
+ | A better name for this variable would have been isBoxMode, since the drawing code doesn't really care what key was actually pressed, all it wants to know is what shape it should be drawing. This doesn't affect the behavior of the program in any way, but it makes it more logically coherent. | ||
== See also == | == See also == | ||
* [[Beginner C++ Game Programming Tutorial 6|Next in series (Tutorial 6)]] | * [[Beginner C++ Game Programming Tutorial 6|Next in series (Tutorial 6)]] | ||
* [[Beginner C++ Game Programming Series]] | * [[Beginner C++ Game Programming Series]] |
Revision as of 10:44, 23 August 2016
Comparison and Boolean logic operators. Operators galore! Make if
statements great again! Let the int
dick measuring contests begin!
Concepts Taught
- Comparison operators (
>
,<
,==
,>=
,<=
,!=
) - Boolean operators (
&&
,||
,!
) - Using parentheses to change order of evaluation (effectively changing what an operator works on)
Video Timestamp Index
Coming soon!
Homework
Draw two targeting boxes, one controlled with the arrow keys and one stationary, and have the color of the mobile targeting box change whenever the targeting boxes overlap.
The solution will be given in a future video.
Solution Errata
In the solution, Chili declares (in Game
) the bool
variable controlIsPressed
to signal that the shape should be changed. First of all, the key being pressed is the SHIFT key, so this is confusing.
A better name for this variable would have been isBoxMode, since the drawing code doesn't really care what key was actually pressed, all it wants to know is what shape it should be drawing. This doesn't affect the behavior of the program in any way, but it makes it more logically coherent.