Difference between revisions of "Beginner C++ Game Programming Tutorial 13"
From Chilipedia
(→Downloads) |
m (Text replacement - "http://www.planetchili.net/" to "https://www.planetchili.net/") |
||
(One intermediate revision by one other user not shown) | |||
Line 35: | Line 35: | ||
== Downloads == | == Downloads == | ||
− | * The starting code for Tutorial 13 is [ | + | * The starting code for Tutorial 13 is [https://www.planetchili.net/downloads/T13-Poo.zip here]. |
− | * [https:// | + | * [https://planetchili.net/downloads/apworks/13/Beginner%20Tutorial%2013%20Code.zip Tutorial 13 Code] |
− | * [https:// | + | * [https://planetchili.net/downloads/apworks/13/Beginner%20Tutorial%2013%20HW%20Code.zip Tutorial 13 Homework Solution Code] |
== See also == | == See also == |
Latest revision as of 13:26, 5 May 2022
In this lesson we learn about the bomb-ass data structure known as the array, the granddaddy of them all. We also learn about boring shit like the automatically-generated default constructor (BOOOOORIIIIING! NEEEEEERRRD!).
Concepts Taught
- Arrays
- Default Constructor
- Using
assert
s
Video Timestamp Index
- Intro 0:00
- Mean average code example: local variables analysis in debugger 0:54
- Arrays visualization in memory, arrays anatomy 2:37
- Declaring an array in C++ 5:19
- Array size must be known at compile time 7:20
- What's so good about arrays: Using arrays in loops 8:23
- Array size limit 11:22
- Refactoring Poo Game: Using arrays 13:20
- Useful logic pattern for determining if all elements "return true" 15:25
- Constructing array of objects: default constructor 18:30
- Note: There are special member functions in C++ 19:54
- Initializing poos 21:39
- Disadvantage of initializing poos this way (
Init()
funciton): breaks encapsulation 23:53 - Making it a little better: 25:07
- Another, bigger disadvantage of initializing poos using
Init()
funciton:Init()
is separate from object construction, and thus could be easily desynchronized. 28:18 - Solving above issue 29:07
- Safety checks: Is it worth it? 30:28
- In the future we will learn about vectors, a better solution for above problems 31:05
- Homework 31:41
Homework
- Make it so that touching the poo is game over and the goal is to reach a square.
- Make the square's color pulsate and make a meter that keeps track of how many times the goal was reached.
The solution is given in this video.
Downloads
- The starting code for Tutorial 13 is here.
- Tutorial 13 Code
- Tutorial 13 Homework Solution Code