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 .

--

--

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