Example #1
0
        public SpiderEggSac(Vector2 POSITION, Vector2 FRAMES, int OWNER_ID, XElement DATA)
            : base("2d/SpawnPoints/EggSac", POSITION, new Vector2(25, 25), FRAMES, OWNER_ID, DATA)
        {
            totalSpawns = 0;
            maxSpawns   = 3;

            health    = 3;
            healthMax = health;

            spawnTimer = new McTimer(3000);
        }
Example #2
0
        public Spider(Vector2 POSITION, Vector2 FRAMES, int OWNER_ID)
            : base("2d/Units/Mobs/Spider", POSITION, new Vector2(45, 45), FRAMES, OWNER_ID)
        {
            speed = 1.5f;

            health    = 3;
            healthMax = health;

            spawnTimer = new McTimer(8000);
            // 4 seconds to spawn the first egg and 8 seconds to spawn the next
            spawnTimer.AddToTimer(4000);
        }
Example #3
0
        public Projectile2d(string PATH, Vector2 POSITION, Vector2 DIMENSIONS, AttackableObject OWNER, Vector2 TARGET) : base(PATH, POSITION, DIMENSIONS)
        {
            done = false;

            speed = 5.0f;

            owner = OWNER;

            direction = TARGET - owner.position;
            direction.Normalize();

            rotation = Globals.RotateTowards(position, new Vector2(TARGET.X, TARGET.Y));

            timer = new McTimer(1500);
        }
        public FrameAnimation(Vector2 SpriteDims, Vector2 sheetDims, Vector2 start, int totalframes, int timePerFrame, int MAXPASSES, int FIREFRAME, PassObject FIREACTION, string NAME = "")
        {
            spriteDims   = SpriteDims;
            sheet        = sheetDims;
            startFrame   = start;
            sheetFrame   = new Vector2(start.X, start.Y);
            frames       = totalframes;
            currentFrame = 0;
            frameTimer   = new McTimer(timePerFrame);
            maxPasses    = MAXPASSES;
            currentPass  = 0;
            name         = NAME;
            FireAction   = FIREACTION;
            hasFired     = false;

            fireFrame = FIREFRAME;
        }
Example #5
0
        public Projectile2d(string PATH, Vector2 POS, Vector2 DIMS, Unit OWNER, Vector2 TARGET) : base(PATH, POS, DIMS)
        {
            done  = false;
            speed = 5.0f;
            owner = OWNER;

            direction = TARGET - owner.pos; // When subtracting a vector from a vector, a directional vector is returned
            // Normally the pythagoreum theorum returns a number that is not one
            // Calling Normalize will make the length of the vector 1, which is then multiplied by the speed of the projectile
            // If Normalize was not called, the further the target is, the faster the projectile would be.
            direction.Normalize();

            rotation = Globals.RotateTowards(pos, new Vector2(TARGET.X, TARGET.Y));


            // 60fps at a rate of 5 units is roughly 300
            timer = new McTimer(1200);
        }
Example #6
0
        public Arrow(Vector2 POSITION, AttackableObject OWNER, Vector2 TARGET) : base("2d/Projectiles/Arrow", POSITION, new Vector2(8, 20), OWNER, TARGET)
        {
            speed = 10.0f;

            timer = new McTimer(800);
        }