Example #1
0
    public CSalamandra(int aType)
    {
        setType(aType);
        setFrames(Resources.LoadAll <Sprite>("Sprites/enemies/fire-salamander"));
        setName("Salamandra");
        setSortingLayerName("Enemies");
        setScale(0.5f);
        setRegistration(CSprite.REG_TOP_LEFT);
        setWidth((int)(WIDTH * 0.5f));
        setHeight((int)(HEIGHT * 0.5f));
        velocityBeforeFalling = 400f;
        setMovable(true);
        setSortingOrder(1);

        horizontalDetectRange = 2;
        verticalDetectRange   = 2;

        setBottomOffsetBoundingBox(34);
        setTopOffsetBoundingBox(23);

        tongue = new CAnimatedSprite();
        tongue.setFrames(Resources.LoadAll <Sprite>("Sprites/enemies/fire-salamander/tongue"));
        tongue.setName("Lengua");
        tongue.setSortingLayerName("Enemies");
        tongue.setRegistration(CSprite.REG_TOP_LEFT);
        tongue.setParent(this.getGameObject());
        tongue.setWidth(0);
        tongue.setHeight(0);
        tongue.setVisible(false);
        tongue.gotoAndStop(1);
        CEnemyManager.inst().add(tongue);


        setState(STATE_STAND);
    }
Example #2
0
    public void update()
    {
        button01.update();
        button02.update();
        barFill.update();
        emptyBar.update();
        if (scaleCounter != 0 & scale <= 100)
        {
            float aux = scaleCounter / 10;
            scale        += aux;
            scaleCounter -= aux;
            barFill.setScaleY(scale);
            if (scale >= 100)
            {
                scale        = 100;
                scaleCounter = 0;
                button01.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill1-Active"));
                button02.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill2-Active0" + button2Type.ToString()));
                currentState = STATE_FULL;
            }
        }

        if (currentState == STATE_FULL)
        {
            if (skill1Click() && CurrentStageData.currentBoard.current_state != 0)
            {
                CurrentStageData.currentKaiju.firstPower();
                scaleCounter = -100;
                button01.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill1-Unable"));
                button02.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill2-Unable0" + button2Type.ToString()));
                currentState = STATE_NORMAL;
            }
            else if (skill2Click() && CurrentStageData.currentBoard.current_state != 0)
            {
                CAnimatedSprite skillAnim = new CAnimatedSprite();
                Skill2Animation auxSkill  = new Skill2Animation(button2Type);
                CSpriteManager.inst().add(auxSkill);

                scaleCounter = -100;
                button01.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill1-Unable"));
                button02.setImage(Resources.Load <Sprite>("Sprites/SkillBar/Button-Skill2-Unable0" + button2Type.ToString()));
                currentState = STATE_NORMAL;
            }
        }
    }
Example #3
0
    public Enemy(int aType)
    {
        building = new CAnimatedSprite();
        building.setName("Building");
        type = aType;
        switch (type)
        {
        case BUILDING:
            building.setFrames(Resources.LoadAll <Sprite>("Sprites/Building"));
            break;

        case HOUSE:
            building.setFrames(Resources.LoadAll <Sprite>("Sprites/House"));
            break;
        }
        setState(STATE_NORMAL);
        building.setY(535);
        building.setX((CGameConstants.SCREEN_WIDTH / 4) * 3 + 30);
        building.setSortingLayer("Icons");
    }
Example #4
0
    public Dinosaur(int aStage, int aFirstBreak, int aSecondBreak)
    {
        scale            = 30;
        stage            = aStage;
        firstBreakpoint  = aFirstBreak;
        secondBreakpoint = aSecondBreak;
        beast            = new CAnimatedSprite();
        beast.setName("Dinosaur");
        beast.setFrames(Resources.LoadAll <Sprite>("Sprites/Kaijus/Dino/00" + stage));
        stage2Imgs = Resources.LoadAll <Sprite>("Sprites/Kaijus/Dino/002");
        stage3Imgs = Resources.LoadAll <Sprite>("Sprites/Kaijus/Dino/003");

        setState(STATE_NORMAL);
        beast.setScale(scale);
        beast.setY(535);
        beast.setX(CGameConstants.SCREEN_WIDTH / 4);
        beast.setSortingLayer("Icons");
        beast.render();
        prefferedFood = 1;
    }
Example #5
0
        public override void Load(SpriteBatch batch)
        {
            lineRenderer.Add(new Line(new Vector2(0), new Vector2(16, 16), Color.Red));
            lineRenderer.Add(new Line(new Vector2(0), new Vector2(0, 16)));
            lineRenderer.Add(new Line(new Vector2(16), new Vector2(16, 0)));
            lineRenderer.Add(new Line(new Vector2(16), new Vector2(0, 16)));
            //UI
            SpriteFont font = AssetManager.GetResource <SpriteFont>("mainFont");
            Text       text = new Text(this, "Position: ", new Vector2(0f, 0f), new Vector2(16f, 1f), font);

            text.colour = new Color(0, 255, 0);
            text.tag    = "positionText";
            Button button = new Button(this, "Menu!", "block", () => GameStateManager.RequestChange("menu", CHANGETYPE.LOAD),
                                       font, new Vector2(14, 0), new Vector2(2, 1));

            button.SetupColours(Color.Gray, Color.White, Color.DarkGray, Color.Red);
            //Objects
            GameObject stone0 = new GameObject("stone", this, 2, true);

            stone0.Pos  = new Vector2(0, 8);
            stone0.Size = new Vector2(8, 1);
            stone0.AddComponent(new CRender("block"));
            stone0.AddComponent(new CAABB());
            GameObject stone1 = new GameObject("stone", this, 2, true);

            stone1.Pos  = new Vector2(9, 7);
            stone1.Size = new Vector2(2, 2);
            stone1.AddComponent(new CTileableSprite("tiletest", 2, 2));
            stone1.AddComponent(new CAABB());
            GameObject stone2 = new GameObject("stone", this, 2, true);

            stone2.Pos  = new Vector2(12, 5);
            stone2.Size = new Vector2(3, 0.2f);
            stone2.AddComponent(new CRender("block"));
            stone2.AddComponent(new CAABB());
            GameObject stone3 = new GameObject("stone", this, 2, true);

            stone3.Pos  = new Vector2(8, 3);
            stone3.Size = new Vector2(3, 0.2f);
            stone3.AddComponent(new CRender("block"));
            stone3.AddComponent(new CAABB());
            GameObject killer = new GameObject("killer", this, 2);

            killer.AddComponent(new CRender("suprise"));
            killer.AddComponent(new CAABB());
            killer.Pos  = new Vector2(3, 5);
            killer.Size = new Vector2(1, 1);
            (killer.Renderer as CRender).colour = Color.Red;
            GameObject player = new GameObject("player", this, 1);

            player.AddComponent(new CRender("dude"));
            player.AddComponent(new CPlayerMovement(3.0f));
            player.AddComponent(new CAABB());
            player.AddComponent(new CShoot());
            player.AddComponent(new CHealthBar(5, player));
            player.Pos  = new Vector2(1, 1);
            player.Size = new Vector2(0.5f, 1.0f);
            GameObject anim = new GameObject("rotationtest", this, 5);

            for (int i = 0; i < 100; i++)
            {
                GameObject s = new GameObject("stone", this, 2, true);
                s.Pos  = new Vector2(12 + (float)MathH.random.NextDouble() * 3, (float)MathH.random.NextDouble() * 3);
                s.Size = new Vector2(1, 1);
                s.AddComponent(new CRender("block"));
                s.AddComponent(new CAABB());
            }

            CAnimatedSprite animatie = new CAnimatedSprite();

            animatie.AddAnimation("letters", "animLetters");
            animatie.AddAnimation("nummers", "animNumbers");
            animatie.PlayAnimation("letters", 4);
            anim.AddComponent(animatie);
            anim.Pos  = new Vector2(5, 0);
            anim.Size = new Vector2(1, 1);
            GameObject floor = new GameObject("stone", this, 2, true);

            floor.Pos  = new Vector2(-100, 8);
            floor.Size = new Vector2(100, 1);
            floor.AddComponent(new CRender("block"));
            floor.AddComponent(new CAABB());
            AudioManager.PlayTrack("music");
            AudioManager.LoopTrack(true);
            AudioManager.SetTrackVolume(1f);
            AudioManager.SetEffectVolume(0.3f);
            AudioManager.SetMasterVolume(0f);
            Debug.FullDebugMode();
        }