Game Development Community

Implementing Power Ups?

by Victor Ferenzi · in Torque X Platformer Kit · 12/28/2008 (6:07 am) · 3 replies

Hi,

I am new to using the Torque X PSK and would like to find out 'How to implement a Power Up'. My project is a Mario style 2D game.

In looking at the samples and going through the documentation I have a couple of thoughts on how to go about this.

Using the T2DCollisionComponent and setting the onCollision method or taking from the Platform Demo create a Collectable class and implement it that way.

If anyone has suggestions, comments, or samples I would really appreciate it.

Thanks,
Victor

#1
01/02/2009 (7:46 am)
OK here is what I have so far:

Added some methods to the CashCollectableComponent to hold the amount of this item as well as a property that marks it as a power up type.

Added a property to the DragonActorComponent to hold the power up state (on or off). This property is set in the confirm pickup method of the cash component. Also added mounting an effect to the player.

In the enemy trigger code added checking for the player to be in power up state in order to kill the enemy on contact.

In the DragonActorComponent added a _preUpdate method to determine when to switch the power off.

My question is on the _preUpdate method. Is this the best method to use to check the powerup state?

I will post the code on this shortly for reference.
#2
01/05/2009 (11:55 am)
If your taking about an object similar to the "Star" in super mario, then the _preUpdate is fine.
#3
01/06/2009 (6:27 am)
Thanks Vishal. That is the type of power up I am implementing.