Search icon CANCEL
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
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
Francesco Sapio Francesco Sapio
Author Profile Icon Francesco Sapio
Francesco Sapio
Abdelrahman Elsayegh Abdelrahman Elsayegh
Author Profile Icon Abdelrahman Elsayegh
Abdelrahman Elsayegh
Arrow right icon
View More author details
Toc

Using pathfinding for enemies


Since our scene is AI ready, we can start adding AI characters in order to test what we have done so far.

Shaping our soldier

First, drag the sprite of the enemy character into the scene. For instance, you can use roguelikeChar_transparent 1_21, which resembles a soldier figure and can be found in the RPG Pack/Characters/Spritesheet/roguelikeChar_transparent 1 folder. You can see it in the following image:

This is the sprite that we will use in this chapter. Once we are in the scene, rename the gameObject to Soldier, and set its position to (-0.4,2.25,0) and its scale to (3,3,3).

Then, add a circle collider and a rigid body to our soldier by setting the same variable values that we already set in our player object. The only difference is that we need to set the rigid body's IsKinematic value to true, since we will be moving the character by a script that doesn't require any input from the player, unlike the player gameObject. You can see the final settings in...

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 €18.99/month. Cancel anytime