Пример #1
0
		internal void ShowNinjaOnGround(Ninja theNinja)
		{


			if (theNinja == currentBodyNode)
			{ //make sure the currentBodyNode is the same ninja that hit the ground

				Schedule(MakeNinjaStaticOnGround, 1.0f / 60.0f);

				// do anything else you want when the ninja hits the ground

				currentBodyNode.ScheduleOnce(currentBodyNode.FadeThenRemove, 2.0f);      //I like to fade out the sprite after a couple seconds

			}
		}
Пример #2
0
		internal void ShowNinjaImpactingStack(Ninja theNinja)
		{


			if (theNinja == currentBodyNode)
			{ //make sure the currentBodyNode is the same ninja that hit the stack

				currentBodyNode.SpriteInRollStateWithAnimationFirst();  //if you have animated frames you want to include use this

				// do anything you want when the ninja hits any stack object
				//maybe you want extra audio

			}

		}
Пример #3
0
		void MoveNextNinjaIntoSling(float delta)
		{

			if (!somethingJustScored)
			{ //dont move a ninja unless we are done scoring

				Unschedule(MoveNextNinjaIntoSling);

				ninjaBeingThrown++;

				if (ninjaBeingThrown <= ninjasToTossThisLevel && pointTotalThisRound < pointsToPassLevel)
				{

					switch (ninjaBeingThrown)
					{
						case 2:
							currentBodyNode = ninja2;
							break;
						case 3:
							currentBodyNode = ninja3;
							break;
						case 4:
							currentBodyNode = ninja4;
							break;
						case 5:
							currentBodyNode = ninja5;
							break;

					}

					b2Vec2 locationInMeters = b2Vec2.Zero;
					locationInMeters.Set(ninjaStartPosition1.X / Constants.PTM_RATIO, ninjaStartPosition1.Y / Constants.PTM_RATIO);
					currentBodyNode.Body.SetTransform(locationInMeters, CCMacros.CCDegreesToRadians(0));

					currentBodyNode.SpriteInSlingState();

					throwInProgress = false;

				}
				else if (ninjaBeingThrown > ninjasToTossThisLevel || pointTotalThisRound >= pointsToPassLevel)
				{


					ScheduleOnce(ResetOrAdvanceLevel, 2.0f);
				}

			}
		}
Пример #4
0
		internal void ProceedToNextTurn(Ninja theNinja)
		{ //if ninja hit the ground

			if (theNinja == currentBodyNode)
			{

				//CCLog.Log("the current ninja has hit the ground");

				Unschedule(TimerAfterThrow); // unschedule this since the ninja has hit the ground we won't need it
				Schedule(MoveNextNinjaIntoSling, 1.0f);

			}
			else
			{

				// CCLog.Log( "disregard: some other ninja not in play has hit the ground somehow");

			}

		}
Пример #5
0
		protected override void AddedToScene()
		{
			base.AddedToScene();

			layerInstance = this;

			//get screen size
			screenSize = Window.WindowSizeInPixels; //CCDirector::sharedDirector()->getWinSize();



			//INITIAL VARIABLES.... (D O N T    E D I T )

			// enable touches
#if XBOX || OUYA
            TouchEnabled = false;
            GamePadEnabled = true;
#else
			//TouchEnabled = true;

			CCEventListenerTouchAllAtOnce tListener = new CCEventListenerTouchAllAtOnce();

			tListener.OnTouchesBegan = TouchesBegan;
			//tListener.OnTouchesCancelled = TouchesCancelled;
			tListener.OnTouchesEnded = TouchesEnded;
			tListener.OnTouchesMoved = TouchesMoved;

			AddEventListener(tListener, this);

#endif


			// enable accelerometer
			//AccelerometerEnabled = false;

#if iPHONE || iOS
			IS_IPAD = MonoTouch.UIKit.UIDevice.CurrentDevice.UserInterfaceIdiom 
				== MonoTouch.UIKit.UIUserInterfaceIdiom.Pad;

			IS_RETINA = MonoTouch.UIKit.UIScreen.MainScreen.Bounds.Height 
				* MonoTouch.UIKit.UIScreen.MainScreen.Scale >= 1136;
#endif
#if WINDOWS || MACOS || MONOMAC || LINUX || OUYA || XBOX
			IS_IPAD = true;
			IS_RETINA = true;
#endif

			IS_IPHONE = !IS_IPAD;

			// ask director for the window size
			screenWidth = (int)screenSize.Width;
			screenHeight = (int)screenSize.Height;

			throwInProgress = false; //is a throw currently in progress, as in, is a ninja in midair (mostly used to prevent tossing two ninjas, one right after another)
			areWeInTheStartingPosition = true;  //is the world back at 0 on the X axis (if yes, then we can put a ninja in the sling)

			throwCount = 0;
			dotTotalOnOddNumberedTurn = 0;
			dotTotalOnEvenNumberedTurn = 0;

			currentLevel = GameData.SharedData.Level;  // use currentLevel =  0 for testing new shapes, will call [self buildLevelWithAllShapes];

			pointTotalThisRound = 0;
			pointsToPassLevel = GameData.SharedData.PointsToPassLevel;
			bonusPerExtraNinja = GameData.SharedData.BonusPerExtraNinja;

			CCLog.Log(string.Format("The level is {0}, you need {1} to move up a level", currentLevel, pointsToPassLevel));

			//PREFERENCE VARIABLES....

			openWithMenuInsteadOfGame = false; // start with the menu opening the game

			continuePanningScreenOnFingerRelease = true; // if the screen panning is midway between either the sling or targets, when you release your finger the screen will continue panning the last direction it moved (jumpy on iPhone if set to NO)
			reverseHowFingerPansScreen = false; //switch to yes to reverse. 
			topRightTouchEnablesDebugMode = true;  //SET TO NO IN FINAL BUILD
			useImagesForPointScoreLabels = true; //IF NO, means you use Marker Felt text for scores

			//set up background art

			backgroundLayerClouds = new CCSprite(GameData.SharedData.BackgroundCloudsFileName);  // will return the background clouds file for a particular level
			AddChild(backgroundLayerClouds, Constants.DepthClouds);

			backgroundLayerHills = new CCSprite(GameData.SharedData.BackgroundHillsFileName);  // will return the background hills file for a particular level
			AddChild(backgroundLayerHills, Constants.DepthHills);
			backgroundLayerHills.ScaleX = 1.05f;

			slingShotFront = new CCSprite("slingshot_front");
			AddChild(slingShotFront, Constants.DepthSlingShotFront);

			strapFront = new CCSprite("strap");
			AddChild(strapFront, Constants.DepthStrapFront);


			strapBack = new CCSprite("strapBack");
			AddChild(strapBack, Constants.DepthStrapBack);

			strapEmpty = new CCSprite("strapEmpty");
			AddChild(strapEmpty, Constants.DepthStrapBack);


			strapBack.Visible = false;  //visible only when stretching
			strapFront.Visible = false; //visible only when stretching



			//setup positions and variables for iPad devices or iPhones

			if (IS_IPAD)
			{
				areWeOnTheIPad = true;

				//vars 

				maxStretchOfSlingShot = 75; //best to leave as is, since this value ties in closely to the image size of strap.png. (should be 1/4 the size of the source image)
				multipyThrowPower = 1; // fine tune how powerful the sling shot is. Range is probably best between .5 to 1.5, currently for the iPad 1.0 is good

				worldMaxHorizontalShift = -(screenWidth);  // This determines how far the user can slide left or right to see the entire board. Always a negative number. 
				maxScaleDownValue = 1.0f; //dont change
				scaleAmount = 0; // increment to change the scale of the entire world when panning  
				initialPanAmount = 30; //how fast the screen pan starts
				extraAmountOnPanBack = 10; // I like a faster pan back. Adding a bit more
				adjustY = 0; // best to leave at 0 for iPad (moves the world down when panning)

				//background stuff

				backgroundLayerClouds.Position = new CCPoint(screenWidth, screenHeight / 2);
				backgroundLayerHills.Position = new CCPoint(screenWidth, screenHeight / 2);

				if (!IS_RETINA)
				{


					//non retina adjustment


				}
				else
				{

					//retina adjustment

					backgroundLayerClouds.Scale = 2.0f;
					backgroundLayerHills.Scale = 2.0f;
				}


				menuStartPosition = new CCPoint(130, screenSize.Height - 24);
				currentScoreLabelStartPosition = new CCPoint(200, screenSize.Height - 60);
				highScoreLabelStartPosition = new CCPoint(200, screenSize.Height - 80);

				fontSizeForScore = 22;

				//ground plane and platform

				groundPlaneStartPosition = new CCPoint(screenWidth, 50);
				platformStartPosition = new CCPoint(340, 190);

				//sling shot
				slingShotCenterPosition = new CCPoint(370, 255);

				slingShotFront.Position = new CCPoint(374, 240);
				strapFront.Position = new CCPoint(slingShotCenterPosition.X, slingShotCenterPosition.Y);
				strapBack.Position = new CCPoint(slingShotCenterPosition.X + 33, slingShotCenterPosition.Y - 10);
				strapEmpty.Position = new CCPoint(378, 235);

				//ninja

				ninjaStartPosition1 = new CCPoint(380, 250);
				ninjaStartPosition2 = new CCPoint(300, 155);
				ninjaStartPosition3 = new CCPoint(260, 155);
				ninjaStartPosition4 = new CCPoint(200, 120);
				ninjaStartPosition5 = new CCPoint(160, 120);

			}

			else if (IS_IPHONE)
			{
				//CCLOG (@"this is an iphone");

				areWeOnTheIPad = false;

				//vars 
				maxStretchOfSlingShot = 75; //best to leave as is, since this value ties in closely to the image size of strap.png. (should be 1/4 the size of the source image)
				multipyThrowPower = 1.0f; // fine tune how powerful the sling shot is. Range is probably best between .5 to 1.5, and a little goes a long way

				worldMaxHorizontalShift = -(screenWidth); // This determines how far the user can slide left or right to see the entire board. Always a negative number
				maxScaleDownValue = 0.65f; //range should probably be between 0.75 and 1.0;
				scaleAmount = .01f; // increment to change the scale of the entire world when panning
				adjustY = -34;

				initialPanAmount = 20; //how fast the screen pan starts
				extraAmountOnPanBack = 0; // best to leave at 0 on iPhone

				//background stuff



				if (!IS_RETINA)
				{

					//non retina adjustment

					backgroundLayerClouds.Position = new CCPoint(screenWidth, 192);
					backgroundLayerClouds.Scale = .7f;
					backgroundLayerHills.Position = new CCPoint(screenWidth, 245);
					backgroundLayerHills.Scale = .7f;

				}
				else
				{

					//retina adjustment

					backgroundLayerClouds.Position = new CCPoint(screenWidth, 192);
					backgroundLayerClouds.Scale = 1.7f;
					backgroundLayerHills.Position = new CCPoint(screenWidth, 265);
					backgroundLayerHills.Scale = 1.7f;
				}



				menuStartPosition = new CCPoint(70, screenSize.Height - 17);
				currentScoreLabelStartPosition = new CCPoint(140, screenSize.Height - 50); //score label
				highScoreLabelStartPosition = new CCPoint(140, screenSize.Height - 70);
				fontSizeForScore = 18;

				//ground plane and platform

				groundPlaneStartPosition = new CCPoint(screenWidth, -25);
				platformStartPosition = new CCPoint(130, 120);

				//sling shot

				slingShotCenterPosition = new CCPoint(160, 185);
				slingShotFront.Position = new CCPoint(164, 170);
				strapFront.Position = new CCPoint(slingShotCenterPosition.X, slingShotCenterPosition.Y);
				strapBack.Position = new CCPoint(slingShotCenterPosition.X + 33, slingShotCenterPosition.Y - 10);
				strapEmpty.Position = new CCPoint(168, 163);

				//ninja

				ninjaStartPosition1 = new CCPoint(170, 175);
				ninjaStartPosition2 = new CCPoint(110, 82);
				ninjaStartPosition3 = new CCPoint(65, 82);
				ninjaStartPosition4 = new CCPoint(90, 65);
				ninjaStartPosition5 = new CCPoint(43, 65);



			}

			SetUpParticleSystemSun();

			CCMenuItemImage button1 = new CCMenuItemImage("gameMenu", "gameMenu", ShowMenu);

			MenuButton = new CCMenu(button1);
			MenuButton.Position = menuStartPosition;
			AddChild(MenuButton, Constants.DepthScore);



			// assign CCPoints to keep track of the starting positions of objects that move relative to the entire layer.

			hillsLayerStartPosition = backgroundLayerHills.Position;
			cloudLayerStartPosition = backgroundLayerClouds.Position;

			// Define the gravity vector.

			yAxisGravity = -9.81f;

			b2Vec2 gravity = b2Vec2.Zero;
			gravity.Set(0.0f, yAxisGravity);


			// Construct a world object, which will hold and simulate the rigid bodies.
			world = new b2World(gravity);

			world.AllowSleep = false;

			world.SetContinuousPhysics(true);

			//EnableDebugMode();


			// Define the ground body.
			var groundBodyDef = new b2BodyDef();  // Make sure we call 
			groundBodyDef.position.Set(0, 0); // bottom-left corner

			// Call the body factory which allocates memory for the ground body
			// from a pool and creates the ground box shape (also from a pool).
			// The body is also added to the world.
			b2Body groundBody = world.CreateBody(groundBodyDef);

			// Define the ground box shape.
			b2EdgeShape groundBox = new b2EdgeShape();

			int worldMaxWidth = screenWidth * 4; //If you ever want the BOX2D world width to be more than it is then increase this  (currently, this should be plenty of extra space)
			int worldMaxHeight = screenHeight * 3; //If you ever want the BOX2D world height to be more  than it is then increase this (currently, this should be plenty of extra space)

			// bottom
			groundBox.Set(new b2Vec2(-4, 0), new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, 0));
			groundBody.CreateFixture(groundBox, 0);

			// top
			groundBox.Set(new b2Vec2(-4, worldMaxHeight / Constants.PTM_RATIO), new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, worldMaxHeight / Constants.PTM_RATIO));
			groundBody.CreateFixture(groundBox, 0);

			// left
			groundBox.Set(new b2Vec2(-4, worldMaxHeight / Constants.PTM_RATIO), new b2Vec2(-4, 0));
			groundBody.CreateFixture(groundBox, 0);

			// right
			groundBox.Set(new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, worldMaxHeight / Constants.PTM_RATIO), new b2Vec2(worldMaxWidth / Constants.PTM_RATIO, 0));
			groundBody.CreateFixture(groundBox, 0);

			//Contact listener 
			contactListener = new ContactListener();
			world.SetContactListener(contactListener);

			//Set up the ground plane

			theGroundPlane = new GroundPlane(world, groundPlaneStartPosition, GameData.SharedData.GroundPlaneFileName);
			AddChild(theGroundPlane, Constants.DepthFloor);


			//Set up the starting platform

			thePlatform = new StartPlatform(world, platformStartPosition, "platform");
			AddChild(thePlatform, Constants.DepthPlatform);

			//Set up ninjas

			ninjaBeingThrown = 1; //always starts at 1 (first ninja, then second ninja, and so on) 
			ninjasToTossThisLevel = GameData.SharedData.NumberOfNinjasToTossThisLevel;  //total number of ninjas to toss for this level



			ninja1 = new Ninja(world, ninjaStartPosition1, @"ninja");
			AddChild(ninja1, Constants.DepthNinjas);

			currentBodyNode = ninja1;

			currentBodyNode.SpriteInSlingState();

			if (ninjasToTossThisLevel >= 2)
			{

				ninja2 = new Ninja(world, ninjaStartPosition2, @"ninjaRed");
				AddChild(ninja2, Constants.DepthNinjas);
				ninja2.SpriteInStandingState();

			}
			if (ninjasToTossThisLevel >= 3)
			{

				ninja3 = new Ninja(world, ninjaStartPosition3, @"ninjaBlue");
				AddChild(ninja3, Constants.DepthNinjas);
				ninja3.SpriteInStandingState();
			}
			if (ninjasToTossThisLevel >= 4)
			{

				ninja4 = new Ninja(world, ninjaStartPosition4, @"ninjaBrown");
				AddChild(ninja4, Constants.DepthNinjas);
				ninja4.SpriteInStandingState();
			}
			if (ninjasToTossThisLevel >= 5)
			{

				ninja5 = new Ninja(world, ninjaStartPosition5, @"ninjaGreen");
				AddChild(ninja5, Constants.DepthNinjas);
				ninja5.SpriteInStandingState();
			}

			//Build the Stack. 

			stack = new TheStack(world);
			AddChild(stack, Constants.DepthStack);


			//give the stack a moment to drop, then switches every pieces to static (locks it into position, until the first slingshot)...
			ScheduleOnce(SwitchAllStackObjectsToStatic, 1.0f);

			currentScoreLabel = new CCLabelTtf(String.Format("{0}: Needed", pointsToPassLevel), "MarkerFelt", fontSizeForScore);
			AddChild(currentScoreLabel, Constants.DepthScore);
			currentScoreLabel.Color = new CCColor3B(255, 255, 255);
			currentScoreLabel.Position = currentScoreLabelStartPosition;
			currentScoreLabel.AnchorPoint = new CCPoint(1, .5f);
			// HighScoreForLevel
			highScoreLabel = new CCLabelTtf(String.Format("High Score: {0}", GameData.SharedData.HighScoreForLevel), "MarkerFelt", fontSizeForScore);
			AddChild(highScoreLabel, Constants.DepthScore);
			highScoreLabel.Color = new CCColor3B(255, 255, 255);

			highScoreLabel.Position = currentScoreLabel.Position - new CCPoint(0, highScoreLabel.ContentSize.Height);// highScoreLabelStartPosition;
			highScoreLabel.AnchorPoint = new CCPoint(1, .5f);
			highScoreLabelStartPosition = highScoreLabel.Position;


			var levelString = string.Format("Level: {0}", currentLevel);
			ShowBoardMessage(levelString);

			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("The art and animation in this template is copyright CartoonSmart LLC");
			CCLog.Log("You must make significant changes to the art before submitting your game to the App Store");
			CCLog.Log("Please create your own characters, backgrounds, etc and spend the time to make the game look totally unique");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("The Video guide for this template is at https://vimeo.com/cartoonsmart/angryninjasguide  ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log(" ");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log("/////////////////////////////////////////////////////");
			CCLog.Log(" ");
			CCLog.Log(" ");




			GameSounds.SharedGameSounds.IntroTag();

			if (GameData.SharedData.Level == 1)
			{

				GameSounds.SharedGameSounds.PlayBackgroundMusic(AmbientFXSounds.Frogs);

			}
			else
			{

				GameSounds.SharedGameSounds.PlayBackgroundMusic(AmbientFXSounds.Insects);
			}

			if (GameData.SharedData.FirstRunEver && openWithMenuInsteadOfGame)
			{
				CCLog.Log("First run ever");
				Schedule(ShowMenuFromSelector, 2f);
				GameData.SharedData.FirstRunEver = false;
			}

			// Always do this last.
			this.Schedule(Tick);
		}
Пример #6
0
        public override void BeginContact(b2Contact contact)
        {
            //base.BeginContact (contact);

            b2Body   bodyA     = contact.GetFixtureA().Body;
            b2Body   bodyB     = contact.GetFixtureB().Body;
            BodyNode bodyNodeA = (BodyNode)bodyA.UserData;
            BodyNode bodyNodeB = (BodyNode)bodyB.UserData;

            ////////////////////////////////////////
            ////////////////////////////////////////
            //NINJA NODES WITH GROUNDPLANE

            if (bodyNodeA is Ninja && bodyNodeB is GroundPlane)
            {
                Ninja theNinja = (Ninja)bodyNodeA;
                //GroundPlane* theGroundPlane = (GroundPlane*)bodyNodeB;


                TheLevel.SharedLevel.StopDotting();
                TheLevel.SharedLevel.ShowNinjaOnGround(theNinja);
                TheLevel.SharedLevel.ProceedToNextTurn(theNinja);
            }
            else if (bodyNodeA is GroundPlane && bodyNodeB is Ninja)
            {
                Ninja theNinja = (Ninja)bodyNodeB;
                // GroundPlane* theGroundPlane = (GroundPlane*)bodyNodeA;

                TheLevel.SharedLevel.StopDotting();
                TheLevel.SharedLevel.ShowNinjaOnGround(theNinja);
                TheLevel.SharedLevel.ProceedToNextTurn(theNinja);
            }

            ////////////////////////////////////////
            ////////////////////////////////////////
            //NINJA NODES WITH StackObject

            if (bodyNodeA is Ninja && bodyNodeB is StackObject)
            {
                //[[GameSounds sharedGameSounds] playStackImpactSound];

                Ninja       theNinja       = (Ninja)bodyNodeA;
                StackObject theStackObject = (StackObject)bodyNodeB;

                TheLevel.SharedLevel.StopDotting();
                TheLevel.SharedLevel.ShowNinjaImpactingStack(theNinja);

                theStackObject.PlayBreakAnimationFromNinjaContact();

                if (theStackObject.PointValue != 0)                   // if it has a score value for impact with Ninja

                {
                    TheLevel.SharedLevel.ShowPoints(theStackObject.PointValue, theStackObject.Position, theStackObject.SimpleScoreVisualFX); //show points
                    theStackObject.MakeUnScoreable();                                                                                        //prevents scoring off same object twice
                }
            }
            else if (bodyNodeA is StackObject && bodyNodeB is Ninja)
            {
                //[[GameSounds sharedGameSounds] playStackImpactSound];

                Ninja       theNinja       = (Ninja)bodyNodeB;
                StackObject theStackObject = (StackObject)bodyNodeA;

                TheLevel.SharedLevel.StopDotting();
                TheLevel.SharedLevel.ShowNinjaImpactingStack(theNinja);

                theStackObject.PlayBreakAnimationFromNinjaContact();

                if (theStackObject.PointValue != 0)                   // if it has a score value for impact with Ninja

                {
                    TheLevel.SharedLevel.ShowPoints(theStackObject.PointValue, theStackObject.Position, theStackObject.SimpleScoreVisualFX); //show points
                    theStackObject.MakeUnScoreable();                                                                                        //prevents scoring off same object twice
                }
            }


            ////////////////////////////////////////
            ////////////////////////////////////////
            //NINJA NODES WITH Enemy

            if (bodyNodeA is Ninja && bodyNodeB is Enemy)
            {
                Ninja theNinja = (Ninja)bodyNodeA;
                Enemy theEnemy = (Enemy)bodyNodeB;

                TheLevel.SharedLevel.StopDotting();
                TheLevel.SharedLevel.ShowNinjaImpactingStack(theNinja);                  //applies to stack objects or enemies



                if (theEnemy.BreaksOnNextDamage)
                {
                    if (theEnemy.PointValue != 0)                       // if it has a score value for impact with Ninja

                    {
                        TheLevel.SharedLevel.ShowPoints(theEnemy.PointValue, theEnemy.Position, theEnemy.SimpleScoreVisualFX); //show points
                        theEnemy.MakeUnScoreable();                                                                            //prevents scoring off same object twice
                    }
                    theEnemy.BreakEnemy();
                }
                else
                {
                    theEnemy.DamageEnemy();
                }
            }
            else if (bodyNodeA is Enemy && bodyNodeB is Ninja)
            {
                Ninja theNinja = (Ninja)bodyNodeB;
                Enemy theEnemy = (Enemy)bodyNodeA;

                TheLevel.SharedLevel.StopDotting();
                TheLevel.SharedLevel.ShowNinjaImpactingStack(theNinja);                  //applies to stack objects or enemies


                if (theEnemy.BreaksOnNextDamage)
                {
                    if (theEnemy.PointValue != 0)                       // if it has a score value for impact with Ninja

                    {
                        TheLevel.SharedLevel.ShowPoints(theEnemy.PointValue, theEnemy.Position, theEnemy.SimpleScoreVisualFX); //show points
                        theEnemy.MakeUnScoreable();                                                                            //prevents scoring off same object twice
                    }
                    theEnemy.BreakEnemy();
                }
                else
                {
                    theEnemy.DamageEnemy();
                }
            }


            ////////////////////////////////////////
            ////////////////////////////////////////
            //StackObject WITH Enemy

            if (bodyNodeA is StackObject && bodyNodeB is Enemy)
            {
                StackObject theStackObject = (StackObject)bodyNodeA;
                Enemy       theEnemy       = (Enemy)bodyNodeB;

                if (theStackObject.IsCanDamageEnemy && theEnemy.DamagesFromDamageEnabledStackObjects)
                {
                    if (theEnemy.BreaksOnNextDamage)
                    {
                        if (theEnemy.PointValue != 0)                           // if it has a score value for impact with Ninja

                        {
                            TheLevel.SharedLevel.ShowPoints(theEnemy.PointValue, theEnemy.Position, theEnemy.SimpleScoreVisualFX); //show points

                            theEnemy.MakeUnScoreable();                                                                            //prevents scoring off same object twice
                        }
                        theEnemy.BreakEnemy();
                    }
                    else
                    {
                        theEnemy.DamageEnemy();
                    }
                }
            }
            else if (bodyNodeA is Enemy && bodyNodeB is StackObject)
            {
                StackObject theStackObject = (StackObject)bodyNodeB;
                Enemy       theEnemy       = (Enemy)bodyNodeA;

                if (theStackObject.IsCanDamageEnemy && theEnemy.DamagesFromDamageEnabledStackObjects)
                {
                    if (theEnemy.BreaksOnNextDamage)
                    {
                        if (theEnemy.PointValue != 0)                           // if it has a score value for impact with Ninja

                        {
                            TheLevel.SharedLevel.ShowPoints(theEnemy.PointValue, theEnemy.Position, theEnemy.SimpleScoreVisualFX); //show points

                            theEnemy.MakeUnScoreable();                                                                            //prevents scoring off same object twice
                        }
                        theEnemy.BreakEnemy();
                    }
                    else
                    {
                        theEnemy.DamageEnemy();
                    }
                }
            }

            ////////////////////////////////////////
            ////////////////////////////////////////
            //Ground WITH Enemy

            if (bodyNodeA is GroundPlane && bodyNodeB is Enemy)
            {
                Enemy theEnemy = (Enemy)bodyNodeB;

                if (theEnemy.DamagesFromGroundContact)
                {
                    if (theEnemy.BreaksOnNextDamage)
                    {
                        if (theEnemy.PointValue != 0)                           // if it has a score value for impact with Ninja

                        {
                            TheLevel.SharedLevel.ShowPoints(theEnemy.PointValue, theEnemy.Position, theEnemy.SimpleScoreVisualFX); //show points

                            theEnemy.MakeUnScoreable();                                                                            //prevents scoring off same object twice
                        }
                        theEnemy.BreakEnemy();
                    }
                    else
                    {
                        theEnemy.DamageEnemy();
                    }
                }
            }
            else if (bodyNodeA is Enemy && bodyNodeB is GroundPlane)
            {
                Enemy theEnemy = (Enemy)bodyNodeA;

                if (theEnemy.DamagesFromGroundContact)
                {
                    if (theEnemy.BreaksOnNextDamage)
                    {
                        if (theEnemy.PointValue != 0)                           // if it has a score value for impact with Ninja

                        {
                            TheLevel.SharedLevel.ShowPoints(theEnemy.PointValue, theEnemy.Position, theEnemy.SimpleScoreVisualFX); //show points

                            theEnemy.MakeUnScoreable();                                                                            //prevents scoring off same object twice
                        }
                        theEnemy.BreakEnemy();
                    }
                    else
                    {
                        theEnemy.DamageEnemy();
                    }
                }
            }



            ////////////////////////////////////////
            ////////////////////////////////////////
            //Ground WITH StackObject

            if (bodyNodeA is GroundPlane && bodyNodeB is StackObject)
            {
                StackObject theStackObject = (StackObject)bodyNodeB;

                theStackObject.PlayBreakAnimationFromGroundContact();

                if (theStackObject.PointValue != 0 && theStackObject.IsBreaksOnGroundContact)
                {                                                                                                                            // if it has a score value for impact with Ninja
                    TheLevel.SharedLevel.ShowPoints(theStackObject.PointValue, theStackObject.Position, theStackObject.SimpleScoreVisualFX); //show points


                    theStackObject.MakeUnScoreable();                     //prevents scoring off same object twice
                }
            }
            else if (bodyNodeA is StackObject && bodyNodeB is GroundPlane)
            {
                StackObject theStackObject = (StackObject)bodyNodeA;

                theStackObject.PlayBreakAnimationFromGroundContact();

                if (theStackObject.PointValue != 0 && theStackObject.IsBreaksOnGroundContact)                   // if it has a score value for impact with Ninja

                {
                    TheLevel.SharedLevel.ShowPoints(theStackObject.PointValue, theStackObject.Position, theStackObject.SimpleScoreVisualFX); //show points
                    theStackObject.MakeUnScoreable();                                                                                        //prevents scoring off same object twice
                }
            }
        }