public BackdropObject(World world, float maxParalaxDistance, Texture2D texture)
 {
     this.texture = texture;
     this.paralax = maxParalaxDistance;
     this.w = world;
     center = Config.screenW / 2;
 }
 public Coin(int x, int y, World w)
     : base(w)
 {
     rect = new Rectangle(
         x, y, size, size);
     startingHeight = rect.Y;
 }
        public LevelElement(string text, Texture2D texture, Vector2 pos, bool selectable, Menu m, MenuAction a, string levelname)
            : base(text, texture, pos, selectable,m, a)
        {
            if (levelname == "alley")
            { unlocked = true; }
            topLeft = pos;
            bottomRight = new Vector2(pos.X + smallWidth, pos.Y + smallHeight);

            topLeftDest = topLeft;
            bottomRightDest = bottomRight;

            world = new World();
            world.Init(levelname);

            vp = new Viewport();
            this.levelname = levelname;
            smallfont = new GFont(TextureManager.smallFont, 5, 10);

            levelThatUnlocks.Add("airport", "alley");
            levelThatUnlocks.Add("jungle", "airport");
            levelThatUnlocks.Add("city", "jungle");
            levelThatUnlocks.Add("powerplant", "city");

            if (levelThatUnlocks.ContainsKey(levelname))
            {
                if (Config.highScore[levelThatUnlocks[levelname]] >= neededScore)
                {
                    unlocked = true;
                }
            }
        }
 public PowerupManager(World w)
 {
     world = w;
     font = new GFont(TextureManager.smallFont, 5, 10);
     width = (int)(TextureManager.pupBackdrop.Width * Config.screenR);
     height = (int)(TextureManager.pupBackdrop.Height * Config.screenR);
 }
 public SpeedShoes(int x, int y, World w)
     : base(x, y, w)
 {
     texture = TextureManager.pupIconSpeedshoes;
     icon = TextureManager.pupIconSpeedshoes;
     description = "speed up";
     color = Color.Red;
 }
 public SpringShoes(int x, int y, World w)
     : base(x, y, w)
 {
     texture = TextureManager.pupIconSpringshoes;
     icon = TextureManager.pupIconSpringshoes;
     description = "air gordans";
     color = Color.Purple;
 }
 public PiercingShot(int x, int y, World w)
     : base(x, y, w)
 {
     texture = TextureManager.pupIconArrow;
     icon = TextureManager.pupIconArrowWhite;
     description = "piercing";
     color = Color.Yellow;
 }
 public Pacifier(int x, int y, World w)
     : base(x, y, w)
 {
     texture = TextureManager.pupIconPacifier;
     icon = TextureManager.pupIconPacifier;
     description = "shake break";
     color = Color.LightBlue;
 }
 public Tile(Point pos, World w)
     : base(w)
 {
     rect = new Rectangle(
         (int)(pos.X * Config.screenR),
         (int)(pos.Y * Config.screenR),
         (int)(size * Config.screenR),
         (int)(size * Config.screenR));
 }
 public Hatch(Point p, World w, int move)
     : base(p,w)
 {
     this.move = move;
     rect = new Rectangle((int)(Tile.Size * p.X * Config.screenR),
         (int)(Tile.Size * p.Y * Config.screenR),
     (int)(Tile.Size * Config.screenR * 2),
     (int)(Tile.Size * Config.screenR));
 }
 public SpeedEnemy(Point pos, World w)
     : base(pos, w)
 {
     maxVeloc = 220;
     velocity.X = (int)(-maxVeloc * Config.screenR);
     idealVelocity.X = (int)(-maxVeloc * Config.screenR);
     testAnim = new Animator(TextureManager.zombieSpeedy, 2, 6);
     testAnim.AddAnimation("default", 0, 11, 25, true);
     testAnim.Play("default");
 }
 public FatEnemy(Point pos, World w)
     : base(pos, w)
 {
     health = 3;
     maxVeloc = 40;
     velocity.X = (int)(-maxVeloc * Config.screenR);
     idealVelocity.X = (int)(-maxVeloc * Config.screenR);
     testAnim = new Animator(TextureManager.zombieFat, 2, 6);
     testAnim.AddAnimation("default", 0, 11, 7, true);
     testAnim.Play("default");
 }
        public Cloud(int num, World w)
            : base(w)
        {
            int x = Config.rand.Next(Config.screenW - 2) + 1;
            int y = Config.rand.Next(300) - 100;
            speed = (float)(Config.rand.NextDouble() * 5);

            texture = TextureManager.clouds[num];
            rect = new Rectangle(x, y, texture.Width / 2, texture.Height / 2);
            pos.X = x;
            pos.Y = y;
        }
        public Rain(World w)
            : base(w)
        {
            int x = Config.rand.Next(Config.screenW * 2);
            int y = Config.rand.Next(Config.screenH);
            speed = (float)(Config.rand.NextDouble() * 400) + 200;

            texture = TextureManager.rain;
            rect = new Rectangle(x, y, texture.Width, texture.Height);
            pos.X = x;
            pos.Y = y;
            float blue = (float)(Config.rand.NextDouble() / 4) + .25f;
            c = new Color(0, 0, blue);
        }
        public Enemy(Point pos, World w)
            : base(w)
        {
            this.pos = new Vector2(pos.X, pos.Y);
            rect = new Rectangle(pos.X, pos.Y, width, height);
            hitRect = new Rectangle(rect.X, rect.Y, rect.Width / 2, rect.Height);
            hitOffset = new Point(rect.Width / 4, 0);

            testAnim = new Animator(TextureManager.zombieSheet, 2, 6);
            testAnim.AddAnimation("default", 0, 11, 15, true);
            testAnim.Play("default");
            velocity.X = (int)(-maxVeloc * Config.screenR);
            idealVelocity.X = (int)(-maxVeloc * Config.screenR);
        }
 public Baby(Vector2 pos, float xVel, int index, World w)
     : base(w)
 {
     gravity = (int)( 350 * Config.screenR);
     this.pos = pos;
     rect = new Rectangle((int)(pos.X ),
         (int)(pos.Y ),
         (int)(width * Config.screenR),
         (int)(height * Config.screenR));
     velocity.Y = (int)(-350 * Config.screenR);
     velocity.X = (int)(xVel);
     rotSpeed = (float)((Math.PI) -(Config.rand.NextDouble() * Math.PI * 2));
     babyLife = maxBabyLife;
     this.index = index;
 }
        public DarkCloud(int num, World w)
            : base(w)
        {
            int x = num * ((Config.screenW / 4) + Config.rand.Next(50)) + Config.screenW / 10;
            int y = Config.rand.Next(75);
            speed = (float)(Config.rand.NextDouble() * 5);
            offset = (float)Config.rand.NextDouble();

            texture = TextureManager.darkClouds[num];
            rect = new Rectangle(x, y,
                (int)(texture.Width * Config.screenR),
                (int)(texture.Height * Config.screenR));
            pos.X = x;
            height = y;
            pos.Y = y;
        }
        public Plane(World w)
            : base(w)
        {
            texture = TextureManager.airplane;
            smallTexture = TextureManager.smallPlane;
            height = (int)(texture.Height * Config.screenR);
            width = (int)(texture.Width * Config.screenR);
            pos.X = -width - 10;
            pos.Y = Config.screenH-height + (Config.screenH / 5);
            speed = 0;
            timer = 5 + Config.rand.Next(30);

            smallPos.X = Config.screenW;
            smallPos.Y = 25;

            rect = new Rectangle((int)pos.X, (int)pos.Y, width, height);
        }
        public BossEnemy(Point pos, World w)
            : base(pos, w)
        {
            health = 6;
            maxVeloc = 75;
            width = (int)(35 * 4 * Config.screenR);
            height = (int)(37 * 4 * Config.screenR);

            velocity.X = (int)(-maxVeloc * Config.screenR);
            idealVelocity.X = (int)(-maxVeloc * Config.screenR);
            testAnim = new Animator(TextureManager.zombieLarge, 2, 6);
            testAnim.AddAnimation("default", 0, 11, 15, true);
            testAnim.Play("default");

            rect = new Rectangle(pos.X, pos.Y, width, height);
            hitRect = new Rectangle(rect.X, rect.Y, rect.Width / 2, rect.Height);
            hitOffset = new Point(rect.Width / 4, 0);
        }
 public void Init(World w)
 {
     world = w;
     font = new GFont(TextureManager.font, 4, 10);
 }
 public Ladder(Point pos, World w)
     : base(pos, w)
 {
 }
 public static void Init(World w)
 {
     newScore = false;
     startTimer = 1.0f;
     initialized = true;
     font = new GFont(TextureManager.font, 4, 10);
     smallfont = new GFont(TextureManager.smallFont, 5, 10);
     position = -Config.screenH;
     rect = new Rectangle(0, -Config.screenH, Config.screenW, Config.screenH);
     world = w;
     world.Automate = false;
     CheckHighScore();
     EvaluateWinner();
 }
 public Powerup(int x, int y, World w)
     : base(w)
 {
     rect = new Rectangle(x, y - (int)(size * 2f), (int)size, (int)size);
     startingHeight = rect.Y;
 }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (TextureManager.loaded)
            {
                Input.Update();

                if (Config.tutorial)
                {
                    tutorial.Update(gameTime.ElapsedGameTime.Milliseconds);
                }
                else
                {
                    if (!inMenu)
                    {
                        world.Update(gameTime.ElapsedGameTime.Milliseconds);
                    }
                    else
                    {
                        world = MenuSystem.GetCurrentLevel();
                        MenuSystem.Update(gameTime.ElapsedGameTime.Milliseconds);
                    }
                }

                Input.LateUpdate();
                // TODO: Add your update logic here
            }
            base.Update(gameTime);
        }
        public Player(Point pos, World w, int i)
            : base(w)
        {
            alive = false;
            respawnTimer = respawnTime;
            spawnPoint = new Vector2(pos.X, pos.Y);
            this.pos = new Vector2(pos.X, Config.screenH);
            rect = new Rectangle((int)(pos.X * Config.screenR),
                (int)(Config.screenH),
                width,
                height);
            hitRect = new Rectangle(rect.X, rect.Y, rect.Width / 2, rect.Height);
            hitOffset = new Point(rect.Width / 4, 0);
            babyLife = maxBabyLife;

            switch(index){
                case 0:
                    testAnim = new Animator(TextureManager.testRun, 13, 6);
                    break;
                case 1:
                    testAnim = new Animator(TextureManager.santa, 13, 6);
                    break;
                case 2:
                    testAnim = new Animator(TextureManager.bum, 13, 6);
                    break;
                case 3:
                    testAnim = new Animator(TextureManager.pedo, 13, 6);
                    break;
                default:
                    testAnim = new Animator(TextureManager.testRun, 13, 6);
                    break;
            }

            testAnim.AddAnimation("run", 0, 17, 16.5f, true);
            testAnim.AddAnimation("idle", 18, 0, 0, true);
            testAnim.AddAnimation("throw", 19, 0, 0, true);
            testAnim.AddAnimation("jump", 24, 3, 15, true, 26);
            testAnim.AddAnimation("fall", 42, 3, 24, true, 44);
            testAnim.AddAnimation("shoot", 30, 10, 24, true);
            testAnim.AddAnimation("climb", 48, 8, 30, true);
            testAnim.AddAnimation("shake", 60, 17, 200, true);

            testAnim.Play("idle");

            runSound = SoundManager.run.CreateInstance();
            shakeSound = SoundManager.shake.CreateInstance();
            ladderSound = SoundManager.ladder.CreateInstance();

            //test
            if (currentPowerup != null)
            {
                currentPowerup.Activate(this);
            }
            index = i;

            if (MenuSystem.gameType == GameType.vsSurvival ||
                MenuSystem.gameType == GameType.survival ||
                MenuSystem.gameType == GameType.hotPotato)
            {
                lives = 1;
            }

            if (MenuSystem.gameType == GameType.hotPotato ||
                MenuSystem.gameType == GameType.thief)
            {
                if (index != 0) // change to a randomly generated number in menusystem
                {
                    holdingBaby = false;
                    Baby = null;
                    spawnBaby = false;
                }
            }

            if (MenuSystem.gameType == GameType.thief)
            {
                babyLife = maxBabyLife / 2;
            }

            respawnTimer -= 1.4f;
        }
 public Entity(World w)
     : base(w)
 {
 }
 public CoinManager(World w)
 {
     world = w;
 }
        public static void Init(World w)
        {
            world = w;
            for (int i = 0; i < 4; i++)
            {
                gamepad.Add(new GamePadState());
                prevgamepad.Add(new GamePadState());
            }

            bool connected = false;
            for (int i = 0; i < 4; i++)
            {
                if (gamepad[i].IsConnected)
                {
                    keys = false;
                    defaultIndex = i;
                    connected = true;
                    break;
                }
            }

            if (!connected)
            { keys = true; }
        }
 public static void Init(World world)
 {
     w = world;
 }
 public EnemyManager(World w)
 {
     world = w;
     AddLevels();
 }