Пример #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player = new PlayerClass();
            map1 = new Map();

            base.Initialize();
        }
Пример #2
0
 //Constructor for new spear
 //Takes inputs (Player, ScreenSize, Map)
 public SpearClass(PlayerClass spearOwner, Texture2D spearText,Texture2D indicatorText, Vector2 ScreenSize, /*necesary?*/ Map m, PlayerClass[] players)
 {
     this.spearText = spearText;
     this.indicatorText = indicatorText; 
     this.players = players;
     spear.Width = spearText.Width-20;
     spear.Height = spearText.Height;
     Width = spearText.Width;
     Height = spearText.Height;
     velocity.X = 0;
     velocity.Y = 0;
     this.spearOwner = spearOwner;
     spearOrientation = 0;
     this.SCREENSIZE = ScreenSize;
     this.m = m;
     spearOwner.setSpear(this);
 }
Пример #3
0
 public void reset(PlayerClass p, Map newMap)
 {
     if (p == null)
         return;
     gravityEffect = 0;
     setOwner(p);
     //Width = spear.Width;
     //Height = spear.Height;
     velocity.X = 0;
     velocity.Y = 0;
     spearOrientation = 0;
     isInUse = false;
     throwing = false;
     attachedToPlayer = true;
     atRest = true;
     spear.X = spearOwner.getPlayerRect().X;
     spear.Y = spearOwner.getPlayerRect().Y;
     spearOwner.setSpear(this);
     this.m = newMap;
 }
Пример #4
0
 public void Initialize(Texture2D text, Vector2 playerPos, Vector2 ScreenSize, Map m)
 {
     playerText = text;
     pos = playerPos;
     Width = playerText.Width;
     Height = playerText.Height;
     velocity.X = 0;
     velocity.Y = 0;
     SCREENSIZE = ScreenSize;
     arena = m;
 }
Пример #5
0
        public void LoadContent(ContentManager Content)
        {
            Vector2 negPos = new Vector2(-100, -100);
            activePlayers = 0;
            if (playersInGame[0]) {
                players[0] = player1;
                activePlayers++;
            }
            else
                player1.active = false;
            if (playersInGame[1]) {
                players[1] = player2;
                activePlayers++;
            }
            else
                player2.active = false;
            if (playersInGame[2]) {
                players[2] = player3;
                activePlayers++;
            }
            else
                player3.active = false;
            if (playersInGame[3]) {
                players[3] = player4;
                activePlayers++;
            }
            else
                player4.active = false;

            Vector2 offset = new Vector2(-4, -4);
            Texture2D bar = Content.Load<Texture2D>("bar");
            Texture2D dust = Content.Load<Texture2D>("Dust_Trail");
            Texture2D dustPoof = Content.Load<Texture2D>("Dust_Poof");
            control_diagram = Content.Load<Texture2D>("controller");
            scores_bg = Content.Load<Texture2D>("scores");
            Texture2D powerup = Content.Load<Texture2D>("powerups");

            for(int i = 0; i < 4; i++)
            {
                if (players[i] != null && players[i].active)
                {
                    players[i].Initialize(Content.Load<Texture2D>(playerTexts[i]), negPos, screenSize, null, players, playerOffsets[playerCharNums[i]], bar, charWidths[playerCharNums[i]]);
                    players[i].moveFrames = charFrameData[playerCharNums[i],0];
                    players[i].idles = idleAnim[playerCharNums[i]];
                    players[i].frameLength = charFrameData[playerCharNums[i], 1];
                    players[i].armOffset = new Vector2(charFrameData[playerCharNums[i], 2], charFrameData[playerCharNums[i], 3]);
                    players[i].shoulder = new Vector2(charFrameData[playerCharNums[i], 4], charFrameData[playerCharNums[i], 5]);
                    players[i].throwWidth = charFrameData[playerCharNums[i], 6];
                    players[i].throwHeight = charFrameData[playerCharNums[i], 7];
                    players[i].flipOff = charFrameData[playerCharNums[i], 8];
                    players[i].flipOrigin = charFrameData[playerCharNums[i], 9];
                }
            }

            //Setup for common player resources
            foreach (PlayerClass p in players)
            {
                if (p != null)
                {
                    p.deadText = Content.Load<Texture2D>("spriteDead");

                    p.Death_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Death").CreateInstance();

                    p.Jump_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Jump").CreateInstance();

                    p.Blink_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Blink").CreateInstance();

                    p.Unblink_Sound = Content.Load<SoundEffect>("audio/sfx/Player_Blink").CreateInstance();

                    p.dustEffect = dust;

                    p.dustPoof = dustPoof;

                    p.aniList = animations;

                }
            }

            Texture2D spearTex = Content.Load<Texture2D>("spearsprite");
            Texture2D indicator = Content.Load<Texture2D>("spearIndicator");

            spear1 = new SpearClass(player1, spearTex, indicator, screenSize, null, players);
            spear2 = new SpearClass(player2, spearTex, indicator, screenSize, null, players);
            spear3 = new SpearClass(player3, spearTex, indicator, screenSize, null, players);
            spear4 = new SpearClass(player4, spearTex, indicator, screenSize, null, players);

            //Setup for common spear resources
            Throw_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Throw");
            Hit_Player_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Player_Hit");
            Hit_Wall_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Wall_Hit");
            Stab_Sound = Content.Load<SoundEffect>("audio/sfx/Spear_Attack");
            foreach (SpearClass s in spears)
            {
                s.Throw_Sound = Throw_Sound.CreateInstance();
                s.Hit_Player_Sound = Hit_Player_Sound.CreateInstance();
                s.Hit_Wall_Sound = Hit_Wall_Sound.CreateInstance();
                s.Stab_Sound = Stab_Sound.CreateInstance();
            }

            StreamReader[] mapData = new StreamReader[5];
            for(int i = 0; i < 5; i++) {
                mapData[i] = File.OpenText("Content/MapData/"+maps.Maps()[i]+".map");
                mapObs[i] = new Map();
                mapObs[i].Initialize(Content.Load<Texture2D>("MapData/"+maps.Maps()[i]+"Color"), mapData[i].ReadToEnd(), 32, 50, 30, players, powerup);
            }
            font = Content.Load<SpriteFont>("miramo30");

            resetMap();
        }
Пример #6
0
 public void Initialize()
 {
     player1 = players[0];
     player2 = players[1];
     player3 = players[2];
     player4 = players[3];
     dummy = new PlayerClass();
     dummy.score = -100;
     rank = new PlayerClass[4];
     rankp = new List<PlayerClass>();
     ranking = new List<PlayerClass>();
     pos = new Vector2[4];
     nextState = null;
     map1 = new Map();
 }