Ejemplo n.º 1
0
 public Boss(int x, int y, int width, int height, AnimationSet animSet, int hp, int dmg, Texture2D shadow, PhysManager phys, Texture2D bulletTexture)
     : base(x, y, width, height, hp, dmg, animSet, FighterState.Idle, shadow)
 {
     state              = BossState.Idle;
     this.phys          = phys;
     this.bulletTexture = bulletTexture;
     rando              = new Random();
     alive              = true;
 }
Ejemplo n.º 2
0
        // enemy specific fields

        public Enemy(int x, int y, int width, int height, int hp, int dmg, AnimationSet animSet, PhysManager phys, Texture2D shadow, FighterState fighterState = FighterState.Idle, bool facingRight = true)
            : base(x, y, width, height, hp, dmg, animSet, fighterState, shadow)
        {
            this.facingRight = facingRight;
            active           = true;
            kbState          = Keyboard.GetState();
            this.phys        = phys;
            Speed            = 3;
            closest          = false;
        }
Ejemplo n.º 3
0
 public Fighter(Rectangle box, int hp, int damage, AnimationSet animationSet, FighterState fighterState, Texture2D shadow)
 {
     this.box          = box;
     this.animationSet = animationSet;
     this.animation    = animationSet.Idle;
     initialY          = 0;
     velocityY         = 0;
     stunned           = false;
     stunTime          = 0;
     this.fighterState = fighterState;
     this.hp           = hp;
     this.maxHp        = hp;
     dmg           = damage;
     this.shadow   = shadow;
     currentColor  = Color.White;
     jumpSuspended = false;
 }
Ejemplo n.º 4
0
        //player specific fields


        public Player(int x, int y, int width, int height, int hp, int dmg, AnimationSet animSet, PhysManager phys, Texture2D shadow, SoundEffect hit, SoundEffect jump, Weapon weapon = null, FighterState fighterState = FighterState.Idle, bool facingRight = true)
            : base(new Rectangle(x, y, width, height), hp, dmg, animSet, fighterState, shadow)
        {
            wep = weapon;
            //100 is just a placeholder value, subject to change
            alive            = true;
            this.facingRight = facingRight;
            this.phys        = phys;
            Stunned          = false;
            Speed            = 7;

            //Initialize keyboard and mouse, and gamepad states
            kbState = Keyboard.GetState();
            mState  = Mouse.GetState();
            gpState = GamePad.GetState(PlayerIndex.One);

            // Initialize sound effects
            this.hit  = hit;
            this.jump = jump;
        }
Ejemplo n.º 5
0
 // Class constructor
 public Student(int x, int y, int width, int height, AnimationSet animSet, int hp, int dmg, PhysManager phys, Texture2D shadow)
     : base(x, y, width, height, hp, dmg, animSet, phys, shadow)
 {
     Speed = 3;
 }
Ejemplo n.º 6
0
        private void LevelStart()
        {
            //Initialize entity list
            entities       = new List <Entity>();
            addEntities    = new List <Entity>();
            removeEntities = new List <Entity>();

            //Spawn boss
            AnimationSet bossAnimSet = new AnimationSet(
                Animation.LoadAnimation(Animation.ERIN_IDLE, Content),
                Animation.LoadAnimation(Animation.ERIN_WALKING, Content),
                Animation.LoadAnimation(Animation.ERIN_FALLING, Content),
                Animation.LoadAnimation(Animation.ERIN_JUMPING, Content),
                Animation.LoadAnimation(Animation.ERIN_ATTACK_SANDWICH, Content),
                Animation.LoadAnimation(Animation.ERIN_HIT, Content)
                );

            boss = new Boss(PhysManager.Unicorns * 128, PhysManager.Unicorns * 9 - PhysManager.Unicorns * 4, PhysManager.Unicorns * 2, PhysManager.Unicorns * 4, bossAnimSet, 200, 0, shadowTexture, phys, bulletTexture);
            entities.Add(boss);
            phys.Boss = boss;
            //Set floor top value
            floorTop = graphics.PreferredBackBufferHeight / 3 * 2;

            //resetting level after death
            player.Hp    = 100;
            player.Alive = true;

            for (int c = 0; c < levelData.Count; c++)
            {
                for (int d = 0; d < levelData[c].Count; d++)
                {
                    int x = 10 * d;
                    int y;
                    if (c == 0)
                    {
                        y = 10;
                    }
                    else
                    {
                        y = GraphicsDevice.Viewport.Height / 6 * c;
                    }
                    if (levelData[c][d] == 'X')
                    {
                        player.Box = new Rectangle(x, y, player.Box.Width, player.Box.Height);
                        entities.Add(player);
                    }
                    else if (levelData[c][d] == 'E')
                    {
                        AnimationSet animSet = new AnimationSet(
                            Animation.LoadAnimation(Animation.ENEMY_IDLE, Content),
                            Animation.LoadAnimation(Animation.ENEMY_WALKING, Content),
                            Animation.LoadAnimation(Animation.ENEMY_FALLING, Content),
                            Animation.LoadAnimation(Animation.ENEMY_JUMPING, Content),
                            Animation.LoadAnimation(Animation.ENEMY_ATTACK_SANDWICH, Content),
                            Animation.LoadAnimation(Animation.ENEMY_HIT, Content)
                            );
                        Enemy enemy = new Enemy(x, y, PhysManager.Unicorns * 2, PhysManager.Unicorns * 4, 50, 10, animSet, phys, shadowTexture);
                        enemyList.Add(enemy);
                        entities.Add(enemy);
                    }
                    else if (levelData[c][d] == 'O')
                    {
                        Obstacle obstacle = new Obstacle(x, y + 6 * PhysManager.Unicorns, PhysManager.Unicorns, PhysManager.Unicorns, obstacleTexture);
                        obstacles.Add(obstacle);
                        entities.Add(obstacle);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            drawables.Add(player);
            phys = new PhysManager(player, enemyList, obstacles, GraphicsDevice.Viewport.Height, boss);

            // TODO: use this.Content to load your game content here
            startTexture       = Content.Load <Texture2D>("start");
            optionsTexture     = Content.Load <Texture2D>("options");           //loads button textures
            exitTexture        = Content.Load <Texture2D>("exit");
            controls           = Content.Load <Texture2D>("textures/Controls");
            obstacleTexture    = Content.Load <Texture2D>("obstacle");
            shadowTexture      = Content.Load <Texture2D>("textures/sprites/Shadow");
            bulletTexture      = Content.Load <Texture2D>("Bullet");
            titleScreenTexture = Content.Load <Texture2D>("textures/TitleScreen");
            menu = new Menu(startTexture, optionsTexture, exitTexture, startButton, optionsButton, exitButton);
            font = Content.Load <SpriteFont>("placeholderText");

            // Load sound effects
            hit  = Content.Load <SoundEffect>("woosh");
            jump = Content.Load <SoundEffect>("jump");

            //Test player
            AnimationSet playerAnimSet = new AnimationSet(
                Animation.LoadAnimation(Animation.CANNOLI_IDLE, Content),
                Animation.LoadAnimation(Animation.CANNOLI_WALKING, Content),
                Animation.LoadAnimation(Animation.CANNOLI_FALLING, Content),
                Animation.LoadAnimation(Animation.CANNOLI_JUMPING, Content),
                Animation.LoadAnimation(Animation.CANNOLI_ATTACK_SANDWICH, Content),
                Animation.LoadAnimation(Animation.CANNOLI_HIT, Content)
                );

            phys   = new PhysManager(player, enemyList, obstacles, GraphicsDevice.Viewport.Height, boss);
            player = new Player(0, 0, PhysManager.Unicorns * 2, PhysManager.Unicorns * 4, 100, 0, playerAnimSet, phys, shadowTexture, hit, jump,
                                new Weapon(
                                    new Rectangle(PhysManager.Unicorns * 2, PhysManager.Unicorns * 4 - PhysManager.Unicorns / 4 * 3, PhysManager.Unicorns, PhysManager.Unicorns),
                                    Animation.LoadAnimation(Animation.CANNOLI_ATTACK_SANDWICH, Content), 10, 0.5));
            phys.Player = player;

            //Background
            background = new Background(Content.Load <Texture2D>("textures/backgrounds/Classroom"));

            //Health bar
            healthBackground = new Texture2D(graphics.GraphicsDevice, PhysManager.Unicorns * 4, PhysManager.Unicorns / 2);
            Color[] data = new Color[healthBackground.Width * healthBackground.Height];
            for (int i = 0; i < data.Length; i++)
            {
                data[i] = Color.DarkGray;
            }
            healthBackground.SetData(data);

            healthBar = new Texture2D(graphics.GraphicsDevice, healthBackground.Width, healthBackground.Height);
            data      = new Color[healthBar.Width * healthBar.Height];
            for (int i = 0; i < data.Length; i++)
            {
                data[i] = Color.IndianRed;
            }
            healthBar.SetData(data);

            healthBarBoss = new Texture2D(graphics.GraphicsDevice, healthBackground.Width, healthBackground.Height);
            data          = new Color[healthBar.Width * healthBar.Height];
            for (int i = 0; i < data.Length; i++)
            {
                data[i] = Color.CornflowerBlue;
            }
            healthBarBoss.SetData(data);

            //Start level
            LevelStart();
        }
Ejemplo n.º 8
0
 public Fighter(int x, int y, int width, int height, int hp, int dmg, AnimationSet animationSet, FighterState fighterState, Texture2D shadow)
     : this(new Rectangle(x, y, width, height), hp, dmg, animationSet, fighterState, shadow)
 {
 }