Ejemplo n.º 1
0
	//
	//	add a number of parts
	//
	void Serpent::addParts(int numParts )
	{
		int partsToAdd = numParts;
		if( partsToAdd <= 0 )
		{
			return;
		}

		//	se adauga parti pana la limita maxima

		if( getLength() + numParts > maxlength )
		{
			partsToAdd = maxlength - getLength();
		}

		for( int i=0; i<partsToAdd; i++ )
		{
			BodyPart * myBodyPart = new BodyPart();
			myBodyPart->setSize( spawnBodyPartSize );
			System::Diagnostics::Trace::WriteLine("Adding bodypart; size=" + spawnBodyPartSize.x + "," + spawnBodyPartSize.y );

			bodyParts.add( myBodyPart );

			this->onAddedBodyPart();
		}
	}