Beginner C++ Game Programming Tutorial 13
Revision as of 13:26, 5 May 2022 by Chili (Talk | contribs) (Text replacement - "http://www.planetchili.net/" to "https://www.planetchili.net/")
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!).
- Default Constructor
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()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
- 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.
- The starting code for Tutorial 13 is here.
- Tutorial 13 Code
- Tutorial 13 Homework Solution Code