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);
        }
 public Intercept(Scoring score, bool mirrored, int width, int height) : base(width, height)
 {
     this.score = score;
     Rect(0, game.height / 2, width, height);
     _mirrored = mirrored;
     bar.SetOrigin(bar.width / 2, 0);
     if (!mirrored)
     {
         x = (game.width / 2) - distance;
     }
     else
     {
         x            = (game.width / 2) + distance;
         thisKey      = Key.X;
         thisArrowKey = Key.RIGHT;
     }
     bar.Mirror(mirrored, false);
     bar.currentFrame = bar.frameCount;
     bar.width        = 100;
     AddChild(bar);
 }
Exemple #3
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 #4
0
        int frame = 0;         //For some reason when loading via menu player instantly collides with NPC soo hardcoded this weird bs -Jesse

        public Player(float x, float y, Pickup[] itemList, HUDOverlay playerHUD, Stage stage, bool showBounds = false) : base(100, 20)
        {
            this.itemList = itemList;

            _position.x = x;
            _position.y = y;
            x           = _position.x;
            y           = _position.y;

            playerSprite.SetOrigin(0, playerSprite.height);
            scaleFactor        = (width * 1f) / (playerSprite.width * 1f);
            playerSprite.scale = scaleFactor;              //calculating and setting a scaling so that the player width will always be 100 pixels
            playerSprite.y    += height;
            AddChild(playerSprite);
            ShapeAlign(CenterMode.Min, CenterMode.Min);
            NoFill();
            Stroke(245, 66, 66);
            if (showBounds)
            {
                Rect(0, 0, width - 1, height - 1);
            }

            this.playerHUD = playerHUD;
        }
Exemple #5
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 #6
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);
        }