Difference between revisions of "Beginner C++ Game Programming Tutorial 8"
From Chilipedia
Line 8: | Line 8: | ||
== Errata == | == Errata == | ||
− | At [https://youtu.be/7yqV2hyv9Cc?list=PLqCJpWy5FohcehaXlCIt8sVBHBFFRVWsx&t=650 10:50] in the video, there is a | + | At [https://youtu.be/7yqV2hyv9Cc?list=PLqCJpWy5FohcehaXlCIt8sVBHBFFRVWsx&t=650 10:50] in the video, there is a note saying that <code>isEaten = IsColliding( ... );</code> would have also been a valid approach, but this is incorrect. With direct assignment, once the condition becomes false, the <code>isEaten</code> flag gets reset (which is not the desired behavior). With the <code>if</code> statement, once the flag is set it remains <code>true</code> regardless of what <code>IsColliding( ... )</code> returns on subsequent frames. |
== Video Timestamp Index == | == Video Timestamp Index == |
Revision as of 16:41, 24 February 2020
We make our first game. So goddamn sweet. Not shitty at all.
Contents
Concepts Taught
-
+=
and-=
operators - Writing code in a constructor
-
#include <header>
- Using
std::mt19973
andstd::uniform_int_distribution<int>
to generate random numbers
Errata
At 10:50 in the video, there is a note saying that isEaten = IsColliding( ... );
would have also been a valid approach, but this is incorrect. With direct assignment, once the condition becomes false, the isEaten
flag gets reset (which is not the desired behavior). With the if
statement, once the flag is set it remains true
regardless of what IsColliding( ... )
returns on subsequent frames.
Video Timestamp Index
- Intro 0:00
- Basic game plan 0:30
- Setting up member variables for entities: dude and poo 0:50
- Dude and poo graphics 2:20
- Creating Draw functions for Dude and Poo 4:08
- Quick note on sprite coordinate origins 5:20
- Screen clamping functions 6:20
- Movement code for Dude 8:09
- Collision test code 9:03
- Win condition and Gameover screen 11:54
- Title Screen 13:20
- Randomizing poo positions 15:07
- A little bit on constructors 16:11
- Creating random number generator object 16:50
- Specifying a range for random numbers 18:23
- Random device: The importance of a seed 20:55
- Why we don't use random device as a random number generator 22:09
- Summing up what we have learned 23:04
- An important message from the power rangers 23:50
- Homework 26:33
Homework
Make the poos move around the screen and rebound when they hit the edges.
The solution is given in this video.
Image to PutPixel Tools
- fukbmp - a barebones tool by Chili
- Custom Sprites 1.5 - a nicer tool by LuX
- Tristan's PutPixel Puker - another sexy tool by Tristan