Exemple #1
0
        public ParticleManager()
        {
            Instance = this;

            _smoke00 = new AnimationSprite("data/Smoke Particle 00.png", 4, 2, 7, true, false);
            _smoke00.SetOrigin(_smoke00.width / 2f, _smoke00.height / 2f);

            _smallBlackSmoke00 = new AnimationSprite("data/Small Black Smokes00.png", 5, 5, 10, true, false);
            _smallBlackSmoke00.SetOrigin(_smallBlackSmoke00.width / 2f, _smallBlackSmoke00.height / 2f);

            _cartoonCoinsExplosion = new AnimationSprite("data/cartoon coin explosion_image.png", 8, 4, -1, false, false);
            _cartoonCoinsExplosion.SetOrigin(_cartoonCoinsExplosion.width / 2f, _cartoonCoinsExplosion.height / 2f);
            _cartoonCoinsExplosion.SetActive(false);

            _smallSnowFlakes = new SmallSnowFlakeParticle[20];
            for (int i = 0; i < _smallSnowFlakes.Length; i++)
            {
                var snow = new SmallSnowFlakeParticle();
                _smallSnowFlakes[i] = snow;
            }

            _smallSnowFlakes2 = new SmallSnowFlakeParticle[20];
            for (int i = 0; i < _smallSnowFlakes2.Length; i++)
            {
                var snow = new SmallSnowFlakeParticle();
                _smallSnowFlakes2[i] = snow;
            }

            LocalEvents.Instance.AddListener <StorkLocalEvent>(StorkLocalEventHandler);
            LocalEvents.Instance.AddListener <LevelLocalEvent>(LevelLocalEventHandler);
        }
Exemple #2
0
        public ParticleManager()
        {
            Instance = this;

            _smoke00 = new AnimationSprite("data/Smoke Particle 00.png", 4, 2, 7, true, false);
            _smoke00.SetOriginToCenter();

            _smallBlackSmoke00 = new AnimationSprite("data/Small Black Smokes00.png", 5, 5, 10, true, false);
            _smallBlackSmoke00.SetOriginToCenter();

            _cartoonCoinsExplosion =
                new AnimationSprite("data/cartoon coin explosion_image.png", 8, 4, -1, false, false);
            _cartoonCoinsExplosion.SetOriginToCenter();
            _cartoonCoinsExplosion.SetActive(false);

            _smallSnowFlakes = new SmallSnowFlakeParticle[20];
            for (int i = 0; i < _smallSnowFlakes.Length; i++)
            {
                var snow = new SmallSnowFlakeParticle();
                _smallSnowFlakes[i] = snow;
            }

            _smallSnowFlakes2 = new SmallSnowFlakeParticle[20];
            for (int i = 0; i < _smallSnowFlakes2.Length; i++)
            {
                var snow = new SmallSnowFlakeParticle();
                _smallSnowFlakes2[i] = snow;
            }
        }
Exemple #3
0
        public NPC(float x, float y, Vec2[] polyPoints, string spriteName = null, float speed = 1f) : base(50, 185)
        {
            _position.x = Mathf.Round(x) - (width / 2);
            _position.y = Mathf.Round(y) - (height / 2);
            this.speed  = speed;

            if (spriteName == null)
            {
                spriteName = "npc_0.png";                     //Sets a default sprite if none was put in -Jesse
            }
            SetOrigin(0, height / 2);

            //ShapeAlign(CenterMode.Min, CenterMode.Min);
            //Rect(0, 0, width, height);

            animSprite = new AnimationSprite("textures/spriteSheets/" + spriteName, 4, 4, -1, true, false); //starts frame is frame 0 -Jesse
            float scaleFactor = (height * 1f) / (animSprite.height * 1f);

            animSprite.scale = scaleFactor;
            animSprite.y    -= animSprite.height / 2;
            animSprite.x    -= width / 2;
            AddChild(animSprite);

            InitializePattern(polyPoints);
        }
Exemple #4
0
 UICanvas()
 {
     healthBarSpriteSheet = new AnimationSprite("HealthSpriteSheet.png", 1, 3);
     healthBarSpriteSheet.SetXY(game.width - 250, 50);
     AddChild(healthBarSpriteSheet);
     uiEasyDraw = new EasyDraw(150, 60);
     AddChild(uiEasyDraw);
 }
Exemple #5
0
        public Ground()
        {
            _visuals = new AnimationSprite("Tiles.png", 5, 1);
            _visuals.SetFrame(0);

            _hitBox = new HitBox();
            AddChild(_visuals);
            AddChild(_hitBox);
        }
Exemple #6
0
        private void drawNormal()
        {
            AddChild(menuBG);

            _text = new AnimationSprite("text.png", 1, 4);
            AddChild(_text);
            _text.SetOrigin(_text.width / 2, _text.height / 2);
            _text.SetXY(game.width / 2 + 230, game.height - 150);
            _text.SetFrame(2);
        }
Exemple #7
0
        public Tutorial01Screen() : base("data/Tutorial 01 screen.png")
        {
            _controllerFlapAnim = new AnimationSprite("data/pressdown wings spritesheet.png", 2, 1, -1, false, false);
            AddChild(_controllerFlapAnim);
            _controllerFlapAnim.SetXY(112, 238);

            _controllerOneAnim = new AnimationSprite("data/pressonedown.png", 2, 1, -1, false, false);
            AddChild(_controllerOneAnim);
            _controllerOneAnim.SetXY(931, 570);

            _storkFlapAnim = new AnimationSprite("data/spritesheet flapdown.png", 2, 1, -1, false, false);
            AddChild(_storkFlapAnim);
            _storkFlapAnim.SetXY(539, 48);
            _storkFlapAnim.Turn(10);

            _storkOneAnim = new AnimationSprite("data/spritesheet flaponedown.png", 2, 1, -1, false, false);
            AddChild(_storkOneAnim);
            _storkOneAnim.SetXY(1361, 462);
            _storkOneAnim.Turn(8);

            CoroutineManager.StartCoroutine(AnimateWings(), this);
        }
Exemple #8
0
        private void drawScreen()
        {
            //Background
            AnimationSprite background = new AnimationSprite("endscreenbg.png", 1, 2);
            AddChild(background);

            //Draw credits
            _credits = new Sprite("credits.png");
            AddChild(_credits);
            _credits.y = game.height;

            //Draw borders
            Sprite borders = new Sprite("endscreenborders.png");
            AddChild(borders);

            //Draw YOUWON or YOULOST
            AnimationSprite wonlost = new AnimationSprite("wonlost.png", 1, 2);
            wonlost.SetOrigin(wonlost.width / 2, wonlost.height / 2);
            wonlost.SetXY(_game.width / 2, 100);
            AddChild(wonlost);

            //Check if player has won or lost
            if (CurrentWonTest == LevelTest.Won)
            {
                background.SetFrame((int)CurrentWonTest);
                wonlost.SetFrame((int)CurrentWonTest);
            }
            else if (CurrentWonTest == LevelTest.Lost)
            {
                background.SetFrame((int)CurrentWonTest);
                wonlost.SetFrame((int)CurrentWonTest);
            }

            //Draw "Throw in a coin to play again"
            _insertcoin = new Sprite("insertcoin.png");
            AddChild(_insertcoin);
            _insertcoin.SetOrigin(_insertcoin.width / 2, _insertcoin.height / 2);
            _insertcoin.SetXY(game.width / 2, game.height - _insertcoin.height);
        }
Exemple #9
0
        private void drawSecond()
        {
            if (_coinInserted && !_secondDrewn)
            {
                menuBG.Destroy();
                _text.Destroy();

                Sprite background = new Sprite("buttonmenu.png");
                AddChild(background);

                _text = new AnimationSprite("text.png", 1, 4);
                AddChild(_text);
                _text.SetFrame(1);
                _text.SetXY(game.width / 2 - 390 , game.height - 60);
                _secondDrewn = true;
            }
        }
Exemple #10
0
        public DroneGameObject(float pX, float pY, float pWidth, float pHeight, float pSpeed = 200,
                               float pRotation = 0) : base(
                "data/Drone spritesheet small.png", 2, 2, 4, false, true)
        {
            _id  = ++IdCounter;
            name = $"{this}_{_id}";

            _customColliderBounds = new Rectangle(-27, -24, 53, 50);

            _maxSpeed = pSpeed;

            float originalWidth  = width;
            float originalHeight = height;

            SetOrigin(0, height);

            float lScaleX = pWidth / width;
            float lScaleY = pHeight / height;

            SetScaleXY(lScaleX, lScaleY);

            x = pX; // + width / 2;
            y = pY; // - height + height / 2f;

            SetOrigin(originalWidth / 2f, originalHeight / 2f);

            Turn(pRotation);

            x = pX + Mathf.Cos(rotation.DegToRad()) * width * 0.5f;
            y = pY + Mathf.Sin(rotation.DegToRad()) * width * 0.5f;

            var pos  = new Vector2(x - pX, y - pY);
            var perp = new Vector2(pos.y, -pos.x).Normalized;

            pos = perp * height * 0.5f;

            SetScaleXY(1, 1);

            x += pos.x;
            y += pos.y;

            _startPosition = new Vector2(x, y);

            _ledSprite = new AnimationSprite("data/Drone White Led.png", 1, 1, -1, false, false);
            _ledSprite.SetOrigin(width * 0.5f, height * 0.5f);

            _ledOffSprite = new AnimationSprite("data/Drone Gray Led.png", 1, 1, -1, false, false);
            _ledOffSprite.SetOrigin(width * 0.5f, height * 0.5f);

            _ledSprite.SetColor(0, 1f, 0);

            AddChild(_ledOffSprite);
            AddChild(_ledSprite);

            _droneFollowRangeCone = new DroneFollowRangeCone(this);
            _droneFollowRangeCone.SetColor(0.9f, 0.9f, 0);
            _droneFollowRangeCone.alpha = 0;
            AddChild(_droneFollowRangeCone);

            _easyDrawDebug = new EasyDraw(200, 80, false);
            _easyDrawDebug.SetOrigin(0, _easyDrawDebug.height * 0.5f);
            _easyDrawDebug.Clear(Color.Black);
            AddChild(_easyDrawDebug);
            _easyDrawDebug.TextFont("data/Gaiatype.ttf", 8);
            _easyDrawDebug.x = 0;
            _easyDrawDebug.y = -40;

            CoroutineManager.StartCoroutine(WaitForEnemyLoad(), this);
        }