After all that hard work implementing the Pickup class, you can now go ahead and write code in the game engine to actually put some pickups into the game.
- [Instructor] Hi, this is video five,…using the pickup class.…Previously, we looked at coding a class for pickups.…In this video, we are going to take a look at…creating a couple of pickups and then…configuring and updating them.…After all that hard work implementing…the pickup class, we can now go ahead…and write code in the game engine…to actually put some pickups into the game.…The first thing we do is add an include directive…to the ZombieArena.cpp file.…
I'll just write it and save the file,…#include "Pickup.h".…Now, just before our game loop,…we'll write two lines of code,…create a couple of pickups, then Pickup healthPickup(1).…Next, Pickup ammoPickup(2).…We just added two pickup instances,…one called healthPickup and the other called ammoPickup.…We passed the values 1 and 2 respectively…into the constructor so that they are initialized…to the correct type of pickup.…
In the next leveling-up state of the keyboard handling,…within the nesting playing code block,…we have to add two lines in order to configure the pickups.…
This course was created and produced by Packt Publishing. We are honored to host this training in our library.
- Creating the main game loop
- Drawing the game background
- Handling errors
- Manipulating C++ variables
- Randomizing numbers
- Making decisions with if, else, and switch
- Moving game objects
- Pausing and restarting games
- Adding scoring and messages
- Using class enumerations and arrays
- Adding sound effects
- Object-oriented programming in C++
- C++ references
- Texture management
- Collision detection
- Implementing the HUD
- Finishing the game
Skill Level Beginner
1. C++, SFML, Visual Studio, and Starting the First Game
2. Variables, Operators, and Decisions
3. C++ Strings, SFML Time, Player Input, and HUD
4. Loops, Arrays, Switch, Enumerations, and Functions
5. Collisions, Sound, and End Conditions
6. Object-Oriented Programming, Classes, and SFML Views
7. C ++ References, Sprite Sheets, and Vertex Arrays
8. Pointers, the Standard Template Library, and Texture Management
9. Collision Detection, Pickups, and Bullets
10. Layering Views and Implementing the HUD
Updating the HUD each frame3m 24s
11. Sound Effects, File I/O, and Finishing the Game
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.