Cocos2d Game Development Essentials - Ben Trengrove - E-Book

Cocos2d Game Development Essentials E-Book

Ben Trengrove

0,0
23,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

If you are a game developer with experience in Objective-C and are interested in creating games for iOS or Android, this is the book for you. It will help you to quickly get started with Cocos2D and guide you through the process of creating a game, giving you the essential skills and knowledge you need to do so.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 128

Veröffentlichungsjahr: 2015

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cocos2D Game Development Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started with Cocos2d
An introduction to Cocos2d
Installing Cocos2d
Installing Cocos2d with the installer
Creating a Hello World project
Installation for Android
Template project code breakdown
IntroScene.m
The HelloWorldScene.m class
Summary
2. Nodes, Sprites, and Scenes
The building blocks, nodes
Children nodes
Adding children
Removing children
Drawing order of the children nodes
Working with multiple coordinate systems
Sprites
Putting it into practice
Adding nodes to the scene
Detecting touches and responding
The next step
The Cocos2d update loop
Scenes
Scene life cycle
Creating a CCScene
Transitioning to another scene
Putting it into practice
Summary
3. SpriteBuilder
Creating a new project
The Main editor window
The Resource pane
The Options pane
The Timeline pane
Creating Flappy Square
Creating a new scene/layer
Linking to a SpriteBuilder scene in code
Enabling physics in SpriteBuilder
Connecting SpriteBuilder objects to Xcode properties
Creating reusable components
Moving obstacles across the screen
Detecting collisions
The next step
Summary
4. Animation with SpriteBuilder
Adding sprites to SpriteBuilder
Creating sprite frame animations
Switching out the obstacle image
Particle systems
Designing a particle system for our character
Adding a SpriteBuilder particle system in code
Final polish to Flappy Bird
Keyframe animation in SpriteBuilder
Animation in code
Moving, scaling, and rotating
Chaining actions together
Running actions simultaneously
Repeating actions
Running code on completion of an animation
Summary
5. User Interaction and Interface
Detecting touches
Getting the touch location
Dragging a node
Adding buttons to your scene
Accepting user input with form elements
Presenting data in a table with CCTableView
Creating a CCTableView data source
Adding a CCTableView node to the scene
Summary
6. Physics Engines
Introducing physics engines
Adding joints
Adding a sprite joint
Dragging an object against a spring joint
Firing objects from the catapult
Creating a motor
The next step
Summary
Index

Cocos2D Game Development Essentials

Cocos2D Game Development Essentials

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: January 2015

Production reference: 1190115

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78439-032-7

www.packtpub.com

Cover image by Ben Trengrove (<[email protected]>)

Credits

Author

Ben Trengrove

Reviewers

K. Aava Rani

Sergio Martínez-Losa Del Rincón

Allen Sherrod

Commissioning Editor

Akram Hussain

Acquisition Editor

Richard Gall

Content Development Editor

Poonam Jain

Technical Editor

Parag Topre

Copy Editor

Relin Hedly

Project Coordinator

Mary Alex

Proofreaders

Simran Bhogal

Linda Morris

Indexer

Mariammal Chettiyar

Graphics

Abhinash Sahu

Production Coordinator

Alwin Roy

Cover Work

Alwin Roy

About the Author

Ben Trengrove is an experienced iOS developer who started developing with the release of the first iOS SDK. He spent 3 years as the senior developer at Shiny Things (http://getshinythings.com), where he lead the creation of all Shiny Things games using Cocos2d. These apps have been featured as the editor's choice by Apple around the world. Today, Ben runs a mobile app agency that is based out of Canberra, Australia—Stripy Sock (http://stripysock.com.au).

I would like to thank my gorgeous wife for her patience during several weekends that I spent writing.

About the Reviewers

K. Aava Rani is the cofounder of CulpzLab Pvt Ltd, a software company, with 10 years of experience in game technologies. A successful blogger and a technologist, she switched her focus to game development in the year 2004. Since then, she has produced a number of game titles and has provided art and programming solutions to Unity developers across the globe. She is based in New Delhi, India. Aava Rani has been the recipient of several prestigious awards, including Adobe for Game Technology Expert 2012 and SmartFoxServer, for her articles. She has immense experience in different technologies and has reviewed Creating E-learning games with Unity3D, Packt Publishing.

Founded in 2010, CulpzLab has proven itself to be a reliable technology partner for its clients. Currently, CulpzLab employs over 50 people and has its office based out of New Delhi in India. CulpzLab is a leading-edge custom-process-driven software solutions provider that has helped and partnered with many reputed brands, start-up ventures, and offshore IT companies. It has helped them realize and deliver effective, efficient, and on-time digital solutions. Thanks to its diverse technology background, industry expertise, and a client footprint that extends to more than 14 countries, CulpzLab has worked with a plethora of clients on a global platform. It is well positioned to help organizations derive maximum value from their IT investments and fully support their business aims. CulpzLab's core business purpose is to invent, engineer, and deliver technology solutions that drive business value, create social value, and improve the lives of customers.

I would like to acknowledge the creators of Unity3D program, an amazing tool that allows ultimate digital experience and creative expression. I'd also like to thank my clients for being part of the fun! Many of you have become good friends through my creative successes. Finally, I'd like to thank R.K.Rajanjan who taught me how to fall in love with technologies.

Sergio Martínez-Losa Del Rincón is a computer engineer. He was fond of programming languages since his high school days, when he learned programming and computer interaction. He is always learning and discovering something new everyday.

He likes all kinds of programming languages, but his main area of focus is mobile development with native languages, such as Objective-C (iPhone), Java (Android), and Xamarin (C#). He also builds Google Glass applications, as well as mobile applications for iPhone and Android devices. Sergio also develops games for mobile devices with Cocos2d-x and Cocos2d. He also likes cross-platform applications and has reviewed Learning Xamarin Studio, Packt Publishing.

Sergio loves challenging problems and is always keen to work with new technologies. Visit www.linkedin.com/in/sergiomtzlosa for more details and information about his experiences.

Allen Sherrod is a lifelong gamer with a passion for programming and video game development, which he has been involved in for the past 10 years. When he is not helping people run raids on Destiny (video game) developed by Bungie, he is working hard by programming various tools and mobile video game applications. Currently, Allen is a mobile software engineer at Disney Interactive, which is one of the best companies to work for. He has also reviewed books such as Instant New iPad Features in iOS 6 How-to and Instant Apple iBooks How-to, Packt Publishing.

I'd like to thank Packt Publishing for giving me the opportunity to review this title. I would also like to thank the author for doing a great job in putting together this book. Book writing is no easy task, so it is always good to see something come together.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Preface

Cocos2d is a cross-platform game engine for iOS and Android devices. Coding in Objective-C and using the rich graphical editor, you can push your game to both iOS and Android devices without any extra work. Cocos2d is packed with features that make game development simple, including integrated physics, particle engines, and a graphical editor for laying out your scenes and designing animations. Game development is about working out how to solve unique problems using the tools in your development toolbox. This book will help you to build this tool box, cover essential skills, and provide a solid foundation on which to grow your game development talent.

This book will introduce and develop your understanding of the core concepts and tools involved in developing games using Cocos2d, including the graphical development environment, SpriteBuilder, the built-in physics engine, the skills to show smooth-flowing animations, and techniques to develop easy to use and functional user interfaces.

Each chapter will introduce you to a new core skill. To practice this skill, in each chapter, you will develop a mini game that runs on both Android and iOS devices. Your skillset will evolve as you move through each chapter, and develop increasingly complex games.

What this book covers

Chapter 1, Getting Started with Cocos2d, discusses how to build your first cross-platform app using Cocos2d. We will install Cocos2d and get you all set up to create Cocos2d games. We will then walk through the template code and look at how it works.

Chapter 2, Nodes, Sprites, and Scenes, discusses the fundamental knowledge required to build any Cocos2d app. You will learn how to display a variety of content on the screen and transition between scenes. Here, you will discover how to lay the foundations of your game.

Chapter 3, SpriteBuilder, discusses how to create apps using the graphical Cocos2d editor. We will lay out scenes and build animations in the graphical editor.

Chapter 4, Animation with SpriteBuilder, covers a comprehensive overview of animations and actions and how to create them in code. We will also look at how to ease the animations to create an attractive and professional look.

Chapter 5, User Interaction and Interface, discusses, and, takes a look at, how to accept input from the user in a variety of ways. We will look at touches and gestures, accelerometer and interface controls.

Chapter 6, Physics Engines, discusses the location where we combine all our knowledge so far, with working physics to create fun physics-based apps. We will look at some basic physics concepts such as forces and joints, and then put it altogether in a scene and see what effects physics have on an app.

What you need for this book

In order to create games in Cocos2D-Swift, you will need a Mac computer with Xcode installed. If you want to put apps on an iOS device, you will need a paid iOS developer account from Apple. To put apps on an Android device, you will need an Android device running (at least Android 4.0 or a paid Apportable account) that allows apps to be built for Android 2.0+.

Who this book is for

This book is for developers with experience in Objective-C and iOS development who are looking to create a game for iOS or Android in Objective-C. It assumes that you understand the basic concepts of game development and just need an understanding of the framework. It covers the essential topics on how to create a game with Cocos2d v3. This would be a good book for someone with previous experience in Cocos2d and wants to learn about the changes in v3.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots / diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/B03446_ColoredImages.pdf

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the erratasubmissionform