Sponsored By

A Quick and Simple Example of Reusing Assets.

A quick example of one way you can reuse Assets to save time and energy.

Mike Troup, Blogger

July 13, 2016

2 Min Read
Game Developer logo in a gray background | Game Developer

 

In expanding my game Wrong Dimension, I decided to add an explosive 'crate' of sorts that adds environmental hazards, and also gives the ability to hide things underneath. I'll talk about how I did that by only creating one single assets, and reusing the others.

This won't be a large article, or a complicated one, but it will hopefully shine light one how easy it can be to reuse assets if you just look in the right direction. 

The basic behavior of the crate is this: Sit there > If damage taken > explode. 

Simple. Now, I could have writtena s imple script to detect the collision of the laser blast or the player's sword. That would have been simple too.

If collided > Minus X amount of health > Chek health level: If <=0 > Die > Spawn Explosion Prefab

However, I realized that that is pretty much the exact behavior that I have the simple enemies (The Grunts) do, except they walk, and spawn blood when they die.

So what I did was assign the same "Enemy Health" script to the crate, disabled the boolean that controls walking. I also made the Crate's RigidBody (required by the script) kinematic so it wouldn't move. 

And then, my favorite part, in the "Blood Splatter" GameObject prefab spot, I added an explosion I already had for bombs so the crate "bleeds" explosions instead of blood. 

Again, not complicated, but doing it this way allowed me to make an exploding crate in under 10 minutes, and save clutter on not making a new script or explosion prefab. 

I hope this has helped someone realize that the solutions can be very simple sometimes. All of this was done in Unity. Thanks for reading.

You can follow my game development 'company' on twitter @StartUp_Studios or check out my website where I talk about this One Dimensional game.

-Mike T. 

Read more about:

Blogs

About the Author

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like