Simpler Way to Offset

The way the Cactus was getting finessed in this video just felt overly complex. I offset mine with two lines of code.

I setup a new variable for the offset that I wanted, my cactus just needed to be raised 0.25 on the y-axis:

Vector2 defSpawnOffset = new Vector2(0, 0.25f);

Then, I added the offset to the Instantiation.

Instantiate(defender, roundedPos + defSpawnOffset, Quaternion.identity)

This may cause an issue with other defenders in the future however, which I’ll need to add some extra code to differentiate between defenders and their offsets.

Privacy & Terms