Book Image

Cocos2d-x Cookbook

By : Akihiro Matsuura
Book Image

Cocos2d-x Cookbook

By: Akihiro Matsuura

Overview of this book

Table of Contents (18 chapters)
Cocos2d-x Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Getting the property of the object in the tiled map


Now, you can move the Tiled map. However, you might notice the object on the map. For example, if there is a wood or wall in the direction of movement, you can't move in that direction beyond that object. In this recipe, you will notice the object on the map by getting the property of it.

Getting ready

In this recipe, you will make a new property of the tree object and set a value to it.

  1. Launch the Tiled application and reopen the desert.tmx file.

  2. Select the tree object in the Tilesets window.

  3. Add a new property by clicking on the plus icon in the lower left corner in the Properties window. Then, a window will pop up specifying the property's name. Enter isTree in the text area.

  4. After you name the new property, it will be shown in the properties list. However, you will find that its value is empty. So, you have to set the new value to it. In this case, you need to set a true value as shown in the following image:

  5. Save it and update desert.tmx...