示例#1
0
        public override void kill()
        {
            DefaultFX tempFX = new FXImpact(position.X - 40, position.Y - 5);

            GameScreen.getFXLayer().add(tempFX);
            tempFX.init(content);
            dead = true;
        }
示例#2
0
        /**
         * callback acionada quando a entidade colide com outra
         */
        override public void collide(LinkedList <DefaultEntity> inCollideList)
        {
            if (!airDying)
            {
                foreach (DefaultEntity entity in inCollideList)
                {
                    if (!entity.dead)
                    {
                        if (entity.deadly && GameModel.deltaTime == 1f)
                        {
                            Game1.playSound("pshh");

                            if (!isInvencible)
                            {
                                airDying = true;
                                spriteSheet.play(AnimationStruct.AIRDYING);
                                this.velocity.X = -this.velocity.X * 1.2f;
                                this.velocity.Y = -this.velocity.Y * 1.2f;

                                if (combo > maxCombo)
                                {
                                    maxCombo = combo;
                                }
                                if (fallings > maxJumps)
                                {
                                    maxJumps = fallings;
                                }

                                if (fallings > 0)
                                {
                                    levelPoints += fallings * 2;

                                    DefaultFX comboFX = new FXLabel(40, 40, "+" + (string)(fallings * 2).ToString(), Color.White, new Color(63, 53, 127));
                                    GameScreen.getFXLayer().add(comboFX);
                                    comboFX.init(content);
                                    collideCallback();
                                }
                                fallings = -1;
                            }
                            entity.kill();

                            DefaultFX tempFX = new FXImpact(entity.position.X, entity.position.Y);
                            GameScreen.getFXLayer().add(tempFX);
                            tempFX.init(content);
                        }
                        else
                        {
                            if (entity.getDieEffect() != null)
                            {
                                Game1.playSound("bup");

                                DefaultFX tempFX = entity.getDieEffect();
                                GameScreen.getFXLayer().add(tempFX);
                                tempFX.init(content);
                                // if (mushComboCounter >= maxMushComboCounter)
                                //   mushComboCounter = 0;
                                //  else

                                mushComboCounter++;
                                combo++;
                                if (entity.behaviour.type == AbstractBehaviour.MUSHROOM)
                                {
                                    mushrooms++;
                                    Statistics.maxMushrooms++;
                                }
                                else if (entity.behaviour.type == AbstractBehaviour.BOLINHA)
                                {
                                    bloobs++;
                                    Statistics.maxBloobs++;
                                }
                                else if (entity.behaviour.type == AbstractBehaviour.STAR)
                                {
                                    specials++;
                                    Statistics.maxSpecials++;
                                }

                                if (entity.effect == RufusEffects.MAGNETIC)
                                {
                                    screenFX.redraw(3);
                                    if (imgEff != null)
                                    {
                                        imgEff.kill();
                                    }
                                    imgEff = new EffectImage(2);
                                    imgEff.init(content);
                                    GameScreen.getFXLayer().add(imgEff);

                                    GameModel.deltaTime = 1f;
                                    pointAcress         = 1;
                                    isMagnetic          = true;
                                    special             = maxSpecial;

                                    Game1.playSound("uhul");
                                }
                                else if (entity.effect == RufusEffects.INVENCIBLE)
                                {
                                    screenFX.redraw(1);
                                    if (imgEff != null)
                                    {
                                        imgEff.kill();
                                    }
                                    imgEff = new EffectImage(1);
                                    imgEff.init(content);
                                    GameScreen.getFXLayer().add(imgEff);

                                    GameModel.deltaTime = 1f;
                                    pointAcress         = 1;
                                    isInvencible        = true;
                                    special             = maxSpecial;

                                    Game1.playSound("uhul");
                                }
                                else if (entity.effect == RufusEffects.PLUS)
                                {
                                    screenFX.redraw(2);
                                    if (imgEff != null)
                                    {
                                        imgEff.kill();
                                    }
                                    imgEff = new EffectImage(4);
                                    imgEff.init(content);
                                    GameScreen.getFXLayer().add(imgEff);

                                    //GameModel.deltaTime = 0f;
                                    pointAcress = 2;
                                    special     = maxSpecial;

                                    Game1.playSound("uhul");
                                }
                                if (combo > 1)
                                {
                                    //DefaultFX comboFX = new FXLabel(entity.position.X, entity.position.Y, "X" + combo.ToString(), new Color(162, 142, 250));
                                    DefaultFX comboFX = new FXLabel(entity.position.X, entity.position.Y, "X" + combo.ToString(), Color.White, new Color(63, 53, 127));
                                    GameScreen.getFXLayer().add(comboFX);
                                    comboFX.init(content);
                                    if (combo == 5)
                                    {
                                        GameLoop.mushRain(1);
                                        GameLoop.mushRain(2);
                                        // EffectImage imgEff = new EffectImage(3);
                                        // imgEff.init(content);
                                        //GameScreen.getFXLayer().add(imgEff);
                                    }
                                }

                                int       pointss  = ((int)(entity.behaviour.points * combo) + (int)levelBehaviour.points) * pointAcress;
                                DefaultFX comboFXP = new FXLabel(240, 420, "+" + (string)(pointss).ToString(), new Color(63, 53, 127), Color.White);
                                GameScreen.getFXLayer().add(comboFXP);
                                comboFXP.init(content);

                                levelPoints += pointss;
                            }
                            entity.dead = true;
                            collideCallback();
                        }
                    }
                }
            }
        }