Beispiel #1
0
        public Enemy(b2World world,
		              CCPoint location,
		              string spriteFileName,
		              bool isTheRotationFixed,
		              bool getsDamageFromGround,
		              bool doesGetDamageFromDamageEnabledStackObjects,
		              int breaksFromHowMuchContact,
		              bool hasDifferentSpritesForDamage,
		              int numberOfFramesToAnimateOnBreak,
		              float density,
		              CreationMethod createHow,
		              int points,
		              BreakEffect simpleScoreVisualFXType )
        {
            InitWithWorld( world,
                           location,
                           spriteFileName,
                           isTheRotationFixed,
                           getsDamageFromGround,
                           doesGetDamageFromDamageEnabledStackObjects,
                           breaksFromHowMuchContact,
                           hasDifferentSpritesForDamage,
                           numberOfFramesToAnimateOnBreak,
                           density,
                           createHow,
                           points,
                           simpleScoreVisualFXType );
        }
Beispiel #2
0
        bool enemyCantBeDamagedForShortInterval; // after damage occurs the enemy gets a moment of un-damage-abilty, which should play better ( I think)


        public Enemy(b2World world,
                     CCPoint location,
                     string spriteFileName,
                     bool isTheRotationFixed,
                     bool getsDamageFromGround,
                     bool doesGetDamageFromDamageEnabledStackObjects,
                     int breaksFromHowMuchContact,
                     bool hasDifferentSpritesForDamage,
                     int numberOfFramesToAnimateOnBreak,
                     float density,
                     CreationMethod createHow,
                     int points,
                     BreakEffect simpleScoreVisualFXType)
        {
            InitWithWorld(world,
                          location,
                          spriteFileName,
                          isTheRotationFixed,
                          getsDamageFromGround,
                          doesGetDamageFromDamageEnabledStackObjects,
                          breaksFromHowMuchContact,
                          hasDifferentSpritesForDamage,
                          numberOfFramesToAnimateOnBreak,
                          density,
                          createHow,
                          points,
                          simpleScoreVisualFXType);
        }
		public BreakEffect  SimpleScoreVisualFX { get; set; } //defined in Constants.cs

		public StackObject (b2World world, 
		                    CCPoint location,
		                    string spriteFileName,
		                    bool breaksOnGround,
		                    bool breaksFromNinja,
		                    bool hasAnimatedBreakFrames,
		                    bool damagesEnemy,
		                    float density,
		                    CreationMethod createHow,
		                    int angleChange,
		                    bool makeImmovable,
		                    int points,
		                    BreakEffect simpleScoreVisualFXType)
		{
			InitWithWorld(world, 
			              location, 
			              spriteFileName, 
			              breaksOnGround,
			              breaksFromNinja,
			              hasAnimatedBreakFrames,
			              damagesEnemy,
			              density,
			              createHow,
			              angleChange,
			              makeImmovable,
			              points,
			              simpleScoreVisualFXType);
		}
Beispiel #4
0
        }                                                             //defined in Constants.cs

        public StackObject(b2World world,
                           CCPoint location,
                           string spriteFileName,
                           bool breaksOnGround,
                           bool breaksFromNinja,
                           bool hasAnimatedBreakFrames,
                           bool damagesEnemy,
                           float density,
                           CreationMethod createHow,
                           int angleChange,
                           bool makeImmovable,
                           int points,
                           BreakEffect simpleScoreVisualFXType)
        {
            InitWithWorld(world,
                          location,
                          spriteFileName,
                          breaksOnGround,
                          breaksFromNinja,
                          hasAnimatedBreakFrames,
                          damagesEnemy,
                          density,
                          createHow,
                          angleChange,
                          makeImmovable,
                          points,
                          simpleScoreVisualFXType);
        }
Beispiel #5
0
        void InitWithWorld(b2World world,
                           CCPoint location,
                           string spriteFileName,
                           bool isTheRotationFixed,
                           bool getsDamageFromGround,
                           bool doesGetDamageFromDamageEnabledStackObjects,
                           int breaksFromHowMuchContact,
                           bool hasDifferentSpritesForDamage,
                           int numberOfFramesToAnimateOnBreak,
                           float density,
                           CreationMethod createHow,
                           int points,
                           BreakEffect simpleScoreVisualFXType)
        {
            this.theWorld        = world;
            this.initialLocation = location;
            this.baseImageName   = spriteFileName;
            this.spriteImageName = String.Format("{0}.png", baseImageName);

            this.DamagesFromGroundContact = getsDamageFromGround;          // does the ground break / damage the enemy

            this.damageLevel = 0;                                          //starts at 0, if breaksAfterHowMuchContact also equals 0 then the enemy will break on first/next contact
            this.breaksAfterHowMuchContact = breaksFromHowMuchContact;     //contact must be made this many times before breaking, or if set to 0, the enemy will break on first/next contact
            this.differentSpritesForDamage = hasDifferentSpritesForDamage; //will progress through damage frames if this is YES, for example,  enemy_damage1.png, enemy_damage2.png

            this.currentFrame           = 0;
            this.framesToAnimateOnBreak = numberOfFramesToAnimateOnBreak;              //will animate through breaks frames if this is more than 0, for example,  enemy_break0001.png, enemy_break0002.png


            this.theDensity          = density;
            this.shapeCreationMethod = createHow;

            this.isRotationFixed = isTheRotationFixed;

            this.PointValue          = points;
            this.SimpleScoreVisualFX = simpleScoreVisualFXType;

            this.DamagesFromDamageEnabledStackObjects = doesGetDamageFromDamageEnabledStackObjects;


            if (damageLevel == breaksAfterHowMuchContact)
            {
                BreaksOnNextDamage = true;
            }
            else
            {
                BreaksOnNextDamage = false;                 //duh
            }


            CreateEnemy();
        }
		void InitWithWorld(b2World world, 
		                   CCPoint location,
		                   string spriteFileName,
		                   bool breaksOnGround,
		                   bool breaksFromNinja,
		                   bool hasAnimatedBreakFrames,
		                   bool damagesEnemy,
		                   float density,
		                   CreationMethod createHow,
		                   int angleChange,
		                   bool makeImmovable,
		                   int points,
		                   BreakEffect simpleScoreVisualFXType)
		{
			this.theWorld = world;
			this.initialLocation = location;
			this.baseImageName = spriteFileName;
			this.spriteImageName =  String.Format("{0}", baseImageName);
			
			this.IsBreaksOnGroundContact = breaksOnGround; 
			this.IsBreaksOnNinjaContact = breaksFromNinja; 
			this.addedAnimatedBreakFrames = hasAnimatedBreakFrames;
			this.IsCanDamageEnemy = damagesEnemy;
			this.theDensity = density;
			this.shapeCreationMethod = createHow;
			this.angle = angleChange;
			this.IsStatic = makeImmovable;
			
			this.currentFrame = 0;
			this.framesToAnimate = 10;
			
			this.PointValue = points ;
			this.SimpleScoreVisualFX = simpleScoreVisualFXType;
			
			CreateObject();
				
		}
Beispiel #7
0
        void InitWithWorld(b2World world,
                            CCPoint location,
                            string spriteFileName,
                            bool isTheRotationFixed,
                            bool getsDamageFromGround,
                            bool doesGetDamageFromDamageEnabledStackObjects,
                            int breaksFromHowMuchContact,
                            bool hasDifferentSpritesForDamage,
                            int numberOfFramesToAnimateOnBreak,
                            float density,
                            CreationMethod createHow,
                            int points,
                            BreakEffect simpleScoreVisualFXType)
        {
            this.theWorld = world;
            this.initialLocation = location;
            this.baseImageName = spriteFileName;
            this.spriteImageName = String.Format("{0}", baseImageName);

            this.DamagesFromGroundContact = getsDamageFromGround; // does the ground break / damage the enemy

            this.damageLevel = 0; //starts at 0, if breaksAfterHowMuchContact also equals 0 then the enemy will break on first/next contact
            this.breaksAfterHowMuchContact = breaksFromHowMuchContact; //contact must be made this many times before breaking, or if set to 0, the enemy will break on first/next contact 
            this.differentSpritesForDamage = hasDifferentSpritesForDamage; //will progress through damage frames if this is YES, for example,  enemy_damage1.png, enemy_damage2.png

            this.currentFrame = 0;
            this.framesToAnimateOnBreak = numberOfFramesToAnimateOnBreak;  //will animate through breaks frames if this is more than 0, for example,  enemy_break0001.png, enemy_break0002.png

            this.theDensity = density;
            this.shapeCreationMethod = createHow;
            this.isRotationFixed = isTheRotationFixed;
            this.PointValue = points;
            this.SimpleScoreVisualFX = simpleScoreVisualFXType;
            this.DamagesFromDamageEnabledStackObjects = doesGetDamageFromDamageEnabledStackObjects;
            BreaksOnNextDamage = damageLevel == breaksAfterHowMuchContact;
            CreateEnemy();
        }
Beispiel #8
0
        void InitWithWorld(b2World world,
                           CCPoint location,
                           string spriteFileName,
                           bool breaksOnGround,
                           bool breaksFromNinja,
                           bool hasAnimatedBreakFrames,
                           bool damagesEnemy,
                           float density,
                           CreationMethod createHow,
                           int angleChange,
                           bool makeImmovable,
                           int points,
                           BreakEffect simpleScoreVisualFXType)
        {
            this.theWorld        = world;
            this.initialLocation = location;
            this.baseImageName   = spriteFileName;
            this.spriteImageName = String.Format("{0}.png", baseImageName);

            this.IsBreaksOnGroundContact  = breaksOnGround;
            this.IsBreaksOnNinjaContact   = breaksFromNinja;
            this.addedAnimatedBreakFrames = hasAnimatedBreakFrames;
            this.IsCanDamageEnemy         = damagesEnemy;
            this.theDensity          = density;
            this.shapeCreationMethod = createHow;
            this.angle    = angleChange;
            this.IsStatic = makeImmovable;

            this.currentFrame    = 0;
            this.framesToAnimate = 10;

            this.PointValue          = points;
            this.SimpleScoreVisualFX = simpleScoreVisualFXType;

            CreateObject();
        }
		public void ShowPoints(int pointValue, CCPoint positionToShowScore, BreakEffect theSimpleScoreVisualFX)
		{

			pointTotalThisRound = pointTotalThisRound + pointValue;
			UpdatePointsLabel();

			//CCLog.Log("Point Value %i, total points is now %i", pointValue, pointTotalThisRound);

			showSimpleVisualFX(positionToShowScore, theSimpleScoreVisualFX);

			SomethingJustScoredVar();

			if (useImagesForPointScoreLabels)
			{

				ShowPointsWithImagesForValue(pointValue, positionToShowScore);

			}
			else
			{
				ShowPointsWithFontLabelForValue(pointValue, positionToShowScore);
			}

		}
		void showSimpleVisualFX(CCPoint positionToShowScore, BreakEffect theSimpleScoreVisualFX)
		{

			if (theSimpleScoreVisualFX == BreakEffect.SmokePuffs)
			{

				GameSounds.SharedGameSounds.PlayBreakSound();

				CCLog.Log("Play Smoke Puffs on Score");

				CustomAnimation smokeFX = new CustomAnimation("puffs",
															   1,
															   7,
															   (int)positionToShowScore.X,
															   (int)positionToShowScore.Y,
															   false,
															   false,
															   false,
															   false);
				AddChild(smokeFX, Constants.DepthVisualFx);

			}
			else if (theSimpleScoreVisualFX == BreakEffect.Explosion)
			{

				GameSounds.SharedGameSounds.PlayBreakSound();

				CCLog.Log("Play explosion on Score");

				CustomAnimation smokeFX = new CustomAnimation("explosion",
															   1,
															   11,
															   (int)positionToShowScore.X,
															   (int)positionToShowScore.Y,
															   false,
															   false,
															   false,
															   false);
				AddChild(smokeFX, Constants.DepthVisualFx);

			}

		}