Thursday, June 2, 2011

Unity: Making Stuff Happen #2

Some additions to working features. Namely pickups, and a power-up which increases player speed by an arbitrary value for an arbitrary time frame (in this case, x2 for 5 seconds). The pickups created a bit of a problem in that they're rigidbody objects (ie. they collide with stuff) which had to not collide with the player (which would cause hitches in movement), but instead act like a trigger (which detects a collision, but doesn't actually respond to it). So in short... the pickups had to be both a collider and a trigger, which isn't possible.

The solution was to parent one gameObject under another. The root is the rigidbody which collides with the world, while the child is the trigger which responds to the player.

The power-up, once the issue of collecting it was solved, was actually ridiculously easy. Coroutines are the best thing about Unity. Seriously.

Didn't get the moving platforms done tonight, but that's the next thing on my list.

Note: The playable demo has been moved to its own post. CLICK HERE TO PLAY.

Time to collect some coins!

No comments:

Post a Comment