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 5.x 2D Game Development Blueprints

You're reading from   Unity 5.x 2D Game Development Blueprints Explore the features of Unity 5 for 2D game development by building three amazing game projects

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781784393106
Length 252 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
 Sapio Sapio
Author Profile Icon Sapio
Sapio
Abdelrahman Elsayegh Abdelrahman Elsayegh
Author Profile Icon Abdelrahman Elsayegh
Abdelrahman Elsayegh
Arrow right icon
View More author details
Toc

Waypoints for enemies


Now, the first thing to finish is how the enemies move around the map. In Chapter 7, Tower Defense Basics, we saw how to script them in order to make them move from one waypoint to another. As a short recap, a waypoint is a special point on the map where the enemies change their direction to move towards another waypoint. They can contain logic to actually lead the character to specific places that change over time, such as next to the player. They can also perform part of the decision-making process. For example, imagine a Tower Defense game where the path of the enemies splits in two. In this case, the waypoints can be used to decide which direction a particular enemy should take. The advantage of waypoints is that, in some cases, they can be more efficient than implementing a complete Pathfinding algorithm.

Here, we don't need to implement a particular logic behind the waypoints. However, they are a useful tool since they allow us to move enemies around the map easily...

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