Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Unity Android Game Development by Example Beginner's Guide

You're reading from   Unity Android Game Development by Example Beginner's Guide Absolute beginners to designing games for Android will find this book is their passport to quick results. Lots of handholding and practical exercises using Unity 3D makes learning a breeze.

Arrow left icon
Product type Paperback
Published in Dec 2013
Publisher Packt
ISBN-13 9781849692014
Length 320 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 Finnegan Finnegan
Author Profile Icon Finnegan
Finnegan
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Unity Android Game Development by Example Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Saying Hello to Unity and Android FREE CHAPTER 2. Looking Good – Graphical Interface 3. The Backbone of Any Game – Meshes, Materials, and Animations 4. Setting the Stage – Camera Effects and Lighting 5. Getting Around – Pathfinding and AI 6. Specialties of the Mobile Device – Touch and Tilt 7. Throwing Your Weight Around – Physics and a 2D Camera 8. Special Effects – Sound and Particles 9. Optimization Pop Quiz Answers Index

Time for action – creating spawns


The script we will be creating in this section will keep our game world populated with all the enemies our player might want to destroy:

  1. We need another new script for this section. Once created, name it SpawnPoint.

  2. This script begins simply with a few variables. The first variable will hold a reference to our EnemyTank prefab. We need it so we can spawn duplicates.

    public GameObject tankPrefab;
  3. The second variable tracks the spawned tank. When it is destroyed we will create a new one. Using this variable we prevent the game from becoming overwhelmed with the enemy. There will only be as many tanks as spawn points.

    private GameObject currentTank;
  4. The third variable is for setting a distance from the player, to prevent spawning tanks on top of the player. If the player is outside this distance, a new tank can be spawned. If they are within, a new tank will not be spawned.

    public float minPlayerDistance = 10;
  5. The first function we will use is FixedUpdate. It will...

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 £13.99/month. Cancel anytime
Visually different images