I wanted an excuse to try disabling and enabling components of a GameObject dynamically. I came up with the idea of implementing the dreaded Elephant.

I’ve created a monster.

Double Collision

Elephants were slightly overpowered.

I first tried to implement the Elephant’s field of anger using two BoxColllider2Ds. That didn’t work out, because there’s no way to determine which BoxCollider2D was triggered in the callback. This meant that Elephants could be injured by a bullet intersecting its much larger field of anger.

The solution that ended up working was to implement a check against the player using Vector2.Distance.

The player watching code ended up very similar to the AIMovement code. I’m feeling an abstraction coming on.

Time Lapse

Today’s time lapse spans two days of development. iMovie is great for quick edits.

GIF Grab Bag

Left to right or top to bottom: Activate Elephant on damage. Invulnerable murdersome elephant. Skittish Elephant escapes.

Up Next

Grouping is helping.

Today’s post was brought to you by the hash, fc3d54.

< Previous Post | Next Post >