Beta 2: Edit > Scripting > Persist, name, class, superclass
by Alex Rice · in Torque Game Builder · 04/15/2006 (2:12 pm) · 2 replies
The new persist-across levels feature is pretty useful. Has anyone come up with interesting uses for the Class and Superclass fields on the Edit > Scripting panel? Seems like it could be real useful I just don't grok it yet what the benefits are.
About the author
Torque 3D Owner Stephen Zepp
Enemy 1:
Superclass = Enemy;
Class = LowbieEnemy;
Enemy 2:
Superclass = Enemy;
Class = BossEnemy;
These two objects give you the following namespaces to work with (as well as the default ones):
Enemy::
LowbieEnemy::
BossEnemy::
So you can have a function such as:
Enemy::moveRandomly()
{
// do random movement when no detection of player has occured
}
LowbieEnemy::onDetectPlayer()
{
// do something specific for this enemy type when you are told you detect the player
// maybe fire weak weapon
}
BossEnemy::onDetectPlayer()
{
// do something superbly awesome when you detect the enemy
// maybe spawn into 20 LowbieEnemy--up to you!
}
Does that help?
BossEnemy::onDetectPlayer()