Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning AndEngine

You're reading from   Learning AndEngine Design and create Android games with the simple but powerful tool AndEngine

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher
ISBN-13 9781783985968
Length 286 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Martin Varga Martin Varga
Author Profile Icon Martin Varga
Martin Varga
Arrow right icon
View More author details
Toc

Game events


There are a handful of events that we need to handle: the player jumps out of the screen, a new platform or enemy is added, a platform or enemy is removed, and a player dies. The player's character can die in two ways: when it collides with the enemy, which we already implemented, and when it falls off the screen. We also want to reward the player with a score when he or she reaches a new height.

There is one more special event we need to cover. When the player's character exits the screen on the left or right side, we want it to reappear on the other side. We want to create a wrapped world. Same with platforms and later enemies when we make them move.

The chase camera

When the camera is following the main character, it is called a chase camera in AndEngine. Any camera can be chasing any entity by simply calling the following function:

camera.setChaseEntity(entity);

However, in our case, this is not exactly what we want. We need the camera to follow only the upward movement of the...

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
Banner background image