Game Development Community

Help Please...

by Denis Linardic · in Torque Game Builder · 10/08/2005 (5:06 pm) · 2 replies

Hi!

I am playing with scroller demo, made some content for it and now I am trying to setup somekind of "small boss" in it. This "small boss" I want to setup should appear more often between normal enemy and "The Boss" (GG made boss).

So I am playing with this code but I dont quite understand when is boss called. I tried to move "The Boss" to Type 4 (Case 4) in enemy.cs -> function constructEnemyShip, but "The Boss" don't show anymore.
So the question is, how the script calls Enemy1, Enemy2, Boss?

//-----------------------------------------------------------------------------
// Construct Ship Helper.
//-----------------------------------------------------------------------------
function constructEnemyShip( %type, %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex )
{
   if (($bossCount + $enemyCount) > $maxEnemyCount)  // OBOB city, but who cares?  Just want a rough limit to the total number of enemies.
      return 0;
   // Construct Appropriate Ship Type.
	switch( %type )
	{
		// Type #1.
		case 1:
			return constructEnemyShipType1( %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex );
			
		// Type #2.
		case 2:
			return constructEnemyShipType2( %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex );

        // Type #2.
  		case 3:
            return constructEnemyShipType3( %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex );

			
          // Boss.
		case 4:
               return constructEnemyBoss( %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex );

          // Unknown Type!
		default:
			// Invalid Enemy Ship Type.
			echo( "SpaceScroller - Invalid Enemy Ship Type" SPC %type SPC "@" SPC %position );
	}
}


And this is created "small Boss"
//-----------------------------------------------------------------------------
// Construct small boss Ship Type #3.
//-----------------------------------------------------------------------------
function constructEnemyShipType3( %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex )
{
	// Create Ship Type.
	%enemy = new fxStaticSprite2D() { scenegraph = spaceSceneGraph2D; };
	%enemy.setImageMap(alienship1ImageMap );
	%enemy.setSize( "28 14" );
	%enemy.setGroup( 3 );
	%enemy.setLayer( 15 );
	%enemy.setCollisionActive( true, true );
	%enemy.setCollisionMaterial( standardMaterial );
	%enemy.setCollisionPolyCustom( 5, "-0.9 0 0 -0.6 1 -0.3 1 0.3 0 0.5" );
	%enemy.setCollisionMasks( $playerCollisionGroups, $playerCollisionLayers );
	%enemy.setCollisionCallback( true );
	%enemy.shipType = 3;
	%enemy.tag = "enemyship";
    %enemy.shields = 200;
	// Choose whether to fire torpedo and at what time.
	if ( getRandom() < 0.75 )
		%enemy.schedule( 250 + mFloor(getRandom()*1500), "enemyFireTorpedo" );

	// Schedule a potential missile fire.
	%enemy.schedule( 250 + mFloor(getRandom()*1500), "enemyFireMissle" );

	// Attach Thruster.
	attachThruster( %enemy, "0.8 -0.12", 180 );
	attachThruster( %enemy, "0.8 0.18", 180 );

	// Create and attach to waveform.
	%waveform = createWaveformObject( %enemy, %position, %velocity, %waveformAmp, %waveformSpeed, %waveformIndex );

	// Increase Enemy Count.
	//$enemyCount++;

 // Return waveform itself.
	return %waveform;
}

Thanks in advance!

#1
10/08/2005 (5:11 pm)
I mess up the boss ...
// Increase Enemy Count.

//$enemyCount++; <- Error was here

// Return waveform itself.

But the "small boss" still don't show up! Any Idea?
#2
10/09/2005 (7:15 am)
OK, I figured out, I was looking in wrong place.