04-13-2018, 08:29 AM
A bit of a leap this month as we finally get a game (of sorts) up and running. Most of the explanations for what is happening are in the source code as the article needs to describe what we're doing rather than spell out the code.
Using what we learned previously about creating objects and giving them graphics we can arrange for a playfield to be displayed and populate it with items which we set up at the beginning and also create as the game is in progress.
This is our first proper use of inheritance and creating objects in the free space memory using the new keyword. It also means we need to take responsibility for removing items we make when we are done with them which brings us to the delete keyword. These 2 keywords should always balance up.
We will also see that even though we are making a game, it clearly suffers from some issues, especially speed. Next month we need to look into why a project that is working fine, isn't working fast and what we can do about that.
Using what we learned previously about creating objects and giving them graphics we can arrange for a playfield to be displayed and populate it with items which we set up at the beginning and also create as the game is in progress.
This is our first proper use of inheritance and creating objects in the free space memory using the new keyword. It also means we need to take responsibility for removing items we make when we are done with them which brings us to the delete keyword. These 2 keywords should always balance up.
We will also see that even though we are making a game, it clearly suffers from some issues, especially speed. Next month we need to look into why a project that is working fine, isn't working fast and what we can do about that.
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's