Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
SFML Blueprints

You're reading from   SFML Blueprints Sharpen your game development skills and improve your C++ and SFML knowledge with five exciting projects

Arrow left icon
Product type Paperback
Published in May 2015
Publisher Packt
ISBN-13 9781784398477
Length 298 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Turning our application to an Asteroid clone

Asteroid is an arcade "shoot 'em up" game created in 1979 by Atari Inc., and is considered a classic. The player controls a spaceship in an asteroid field with some flying saucers appearing on the screen from time to time, attacking it. The goal of this game is to destroy all the asteroids and saucers by shooting at them. Each level increases the number of asteroids in the field, and the game becomes harder and harder.

To build this game, we will use our actual application as a base, but we need to add a lot of things to it.

The Player class

The player is represented as a spaceship. The spaceship has the ability to rotate left and right, to shoot, and the spaceship can also give itself a boost. The player can also send the ship into hyperspace, causing it to disappear and reappear in a random location on the screen, at the risk of self-destructing or appearing on top of an asteroid.

The player starts with three lives, and on every...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime