Reader small image

You're reading from  Hands-On Game Development without Coding

Product typeBook
Published inNov 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781789538335
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Lucas Bertolini
Lucas Bertolini
author image
Lucas Bertolini

Lucas Bertolini has 10+ years' experience as a video game software developer. He has worked on three major projects: for Pollux Ltd. (Hong Kong) as a game developer and designer; for Schell Games (Pittsburgh, US) where he moved and worked as a developer until the project was completed; and for Globant as a developer. He has worked in technical education for 5+ years and has taught a variety of programming courses. He is the cofounder of NGA and Bytenarchy Studios, both digital services development companies that use Unity as their main technology. Lucas has written Hands-On Game Development without Coding, available from Packt.
Read more about Lucas Bertolini

Right arrow

Enemy Components and Behaviors

In the last chapter, we were introduced to the types of enemy AI and how each type operates depending on which state it is in.

In this chapter, we will learn in detail how to use and change the enemy behavior by understanding its components and variables. Then, we are going to use this information to play around and twist some values in order to get the enemy behavior closer to what our game requires.

The following topics will be covered in this chapter:

  • Basic 2D enemies' components
  • Basic 3D enemies' components

2D Game Kit enemies

Following on from our 2D game development experience, we need to understand the enemies in depth, their components and behaviors, and how to modify them.

In this section, we will focus on the following components of the chomper:

  • Character Controller 2D
  • Damageable
  • Enemy behavior

In addition to this, we will learn about the following components of the spitter:

  • Spitter BT

After that, we will take a look at the enemy spawner and how it works.

Chomper

The Chomper is the most common enemy of the game, and we will find that it is pretty simple in its AI. The behaviors behind this enemy can be seen by clicking on the Chomper prefab under Assets | 2DGamkit | Prefabs | Enemies, as shown in the following screenshot...

3D Game Kit enemies

Moving on to the next topic of the 3D game development experience, we will learn about our enemies in depth by understanding their components and behaviors, and the best way to modify their properties.

In this section, we will focus on the following components of the Chomper:

  • Chomper Behavior
  • Damageable
  • Replace With Ragdoll
  • Enemy Controller

In addition to these Chomper components, we will learn about following components of the Spitter:

  • Damageable
  • Replace With Ragdoll
  • Enemy Controller
  • Spitter Behavior

Chomper

The chomper is one of the main enemies of the game, and its AI is very simple. Click on the Chomper prefab under Assets | 3DGamekit | Prefabs | Characters | Enemies. The behaviors of this enemy...

Summary

Know your enemy. This was the main focus of this chapter, knowing our enemies.

The chapter was focused on learning about the behaviors of the chomper and the Spitter, what they can do, how they are able to see the player, when they will react, and so on. By knowing this information, we are going to be able to create different types of enemies, because we can duplicate the enemies' prefabs and change the values of their behaviors, which will finally end up in them having different behaviors.

This will enhance the challenge level of the our game, making our level more fun and challenging to play. We need to keep in mind that the player's attention and interest must be sustained at all time.

In the next chapter, we will face our demons by looking at the level boss, the most powerful enemy of all. We will look at how we can manage its power and use it to our advantage...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Hands-On Game Development without Coding
Published in: Nov 2018Publisher: PacktISBN-13: 9781789538335
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.
undefined
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 €14.99/month. Cancel anytime

Author (1)

author image
Lucas Bertolini

Lucas Bertolini has 10+ years' experience as a video game software developer. He has worked on three major projects: for Pollux Ltd. (Hong Kong) as a game developer and designer; for Schell Games (Pittsburgh, US) where he moved and worked as a developer until the project was completed; and for Globant as a developer. He has worked in technical education for 5+ years and has taught a variety of programming courses. He is the cofounder of NGA and Bytenarchy Studios, both digital services development companies that use Unity as their main technology. Lucas has written Hands-On Game Development without Coding, available from Packt.
Read more about Lucas Bertolini