Smart Enemies?

To spice up a game, there needs to be a variety of things. Enemy behaviors is one of them. Having multiple different enemy types is a way to spice up the way a game plays and feels. An example being: one type can take multiple hits but is relatively slow. Another can be fast but is quite fragile. The list goes on.

In this situation what I did was allow for the enemies to dodge the players lasers, making for a more complex situation for the player. When should I shoot? How do I go about getting this power up?

Raycasting is shooting out a “beam” into the world and it collects data of what is hit. Most of the time it is used to collect data for hits or collisions on colliders. A Linecast is similar to Raycast but different in the sense that Linecast is an imaginary line between two points in world space. Raycasting is making a “line” or ray using an origin and direction.
In this case, I made a line in front of my Enemy object, using it’s fire point (2 units down from the guns on the sprite) out from -1 and 1 on the X axis.

Next on the block would be getting new movement styles for the enemies.

On to the next .




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Anagram Finding app with Python Part 2: Enter Toga

Essentia May ’20 Monthly Updates

How to get your Facebook App reviewed?

Programming Language

Replicating Microsoft News with Xamarin Part 5 (NewsAPI)

Behind the curtain

Which Mobile Framework is Perfect for Your Business Application?

Let’s build a simple Stateful Widget in Flutter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Brennen Witzens

Brennen Witzens

More from Medium

Guide to Making a Beautiful Game: How I Built a Principle Office = Finale!

Benefits of Prototyping with Cubes

The Fourth Player Challenge: Problem Solving and Jumping

Pitfalls with Unity Unit Tests and [Timeout]