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
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d-X Game Development Blueprints

You're reading from   Cocos2d-X Game Development Blueprints Build a plethora of games for various genres using one of the most powerful game engines, Cocos2d-x

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher Packt
ISBN-13 9781783985265
Length 392 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Karan Sequeira Karan Sequeira
Author Profile Icon Karan Sequeira
Karan Sequeira
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. A Colorful Start FREE CHAPTER 2. How to Fly a Dragon! 3. Not Just a Space Game 4. Back to the Drawing Board 5. Let's Get Physical! 6. Creativity with Textures 7. Old is Gold! 8. Box2D Meets RUBE 9. The Two Towers 10. Cross-platform Building Index

Defining the properties of the enemy


The typical enemy will have the following characteristics:

  • It will have health, armor (to prevent physical damage), and magic resistance (to prevent magic damage)

  • It will have a certain movement speed

  • It will do certain amounts of damage if it reaches the base

  • It will have certain rewards on being killed

Based on these characteristics, we will define the following properties for an enemy in our game:

  • Health

  • Armor

  • Magic resistance

  • Speed

  • Damage

  • Reward

Let's now take a look at an excerpt from the enemy_data.xml file to see how we define the XML structure for the enemy data:

<EnemyDataList>
  <EnemyData animation="enemy_1" health="20" armor="0" magic_resistance="0" speed="0.8" damage="1" reward="10" />
  .
  .
  .
</EnemyDataList>

The root element of the document titled EnemyDataList defines a list of EnemyData tags, one for each type of enemy. The only property that we didn't discuss earlier is the one titled animation. This is nothing but the name of...

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