/// <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); TheCursor.Create(Content.Load <Texture2D>("ASCursor"), Content.Load <Texture2D>("CursorAim"), Content.Load <Texture2D>("CharacAim"), Color.White); // TODO: use this.Content to load your game content here List <String> TextureNames = FileServices.ReadFileLines(@"Files\TextureNames.txt"); foreach (string TexName in TextureNames) { TextureHolder temp = new TextureHolder(); temp.Texture = Content.Load <Texture2D>(TexName); temp.Filename = TexName; TheContentHolder.Textures.Add(temp); } Areas.Create(TheContentHolder, graphics, TheCamera); List <string> WeaponLines = FileServices.ReadFileLines(@"Files\Weapons.txt"); TheWeapons.Create(WeaponLines, TheContentHolder); //must make sure character spawns within normal camera boundaries TheMainCharacter.Create(150, 150, 0f, TheContentHolder.GetTexture("Man2"), TheContentHolder.GetTexture("Man_Aim2"), TheWeapons.WeaponList[0], TheCamera); }
public void Create(string[] param, ContentHolder TCH, List <string> TilePlanRows) { // param of 0 is used for sorting earlier Width = Convert.ToInt32(param[1]); Height = Convert.ToInt32(param[2]); TilesWide = Convert.ToInt32(param[3]); TilesHigh = Convert.ToInt32(param[4]); TilePlan = new int[TilesWide, TilesHigh]; TileMap = TCH.GetTexture(param[5]); int h = 0; foreach (string Row in TilePlanRows) { string[] temp = FileServices.LineCommaSplit(Row); int k = 0; foreach (string Tile in temp) { TilePlan[k, h] = Convert.ToInt32(Tile); k += 1; } h += 1; } Objects = new List <Object>(); SourceRect = new Rectangle(); SourceRect.Width = Width / TilesWide; SourceRect.Height = Height / TilesHigh; if (Width % 100 == 0) { XZones = Width / 100; } else { XZones = (Width / 100) + 1; } if (Height % 100 == 0) { YZones = Height / 100; } else { YZones = (Height / 100) + 1; } Zones = new List <Enemy> [XZones, YZones]; ObjectZones = new List <Object> [XZones, YZones]; for (int i = 0; i < XZones; i++) { for (int j = 0; j < YZones; j++) { Zones[i, j] = new List <Enemy>(); ObjectZones[i, j] = new List <Object>(); } } }
public void Create(string[] param, ContentHolder TCH) { Picture = TCH.GetTexture(param[1]); Position.X = Convert.ToInt32(param[2]); Position.Y = Convert.ToInt32(param[3]); int FW = Convert.ToInt32(param[4]); int FH = Convert.ToInt32(param[5]); Texture2D AniSource = TCH.GetTexture(param[6]); float fps = (float)Convert.ToInt32(param[7]); int Fs = Convert.ToInt32(param[8]); int BBoxW = Convert.ToInt32(param[9]); int BBoxH = Convert.ToInt32(param[10]); int BBoxX = Convert.ToInt32(param[11]); int BBoxY = Convert.ToInt32(param[12]); BoundingBoxes = new List <Rectangle>(); Animation = new AnimatedSprite(); Animation.Create(FW, FH, AniSource, fps, Fs); AddBoundingBox(BBoxW, BBoxH, BBoxX, BBoxY); }
public virtual void Create(string[] param, ContentHolder TCH) { int rof = Convert.ToInt32(param[0]); string PTName = param[1]; Texture2D PTPic = TCH.GetTexture(param[2]); int LaunchSpeed = Convert.ToInt32(param[3]); int Damage = Convert.ToInt32(param[4]); int GunEndX = Convert.ToInt32(param[5]); int GunEndY = Convert.ToInt32(param[6]); int AimGunEndX = Convert.ToInt32(param[7]); int AimGunEndY = Convert.ToInt32(param[8]); ProjectileTypes = new List <ProjectileType>(); ProjectileType PT = new ProjectileType(); PT.Create(PTName, PTPic, null, LaunchSpeed, Damage); ProjectileTypes.Add(PT); ROF = (float)rof; ShotTime = 1 / ROF; GunEnd = new Vector2((float)GunEndX, (float)GunEndY); AimGunEnd = new Vector2((float)AimGunEndX, (float)AimGunEndY); }
public void Create(GraphicsDeviceManager GDM, string[] param, Camera ACamera, ContentHolder TCH) { int x = Convert.ToInt32(param[1]); int y = Convert.ToInt32(param[2]); Texture2D Tex = TCH.GetTexture(param[3]); InitialHealth = Convert.ToInt32(param[4]); CurrentHealth = InitialHealth; MovementSpeed = Convert.ToInt32(param[5]); MapPosition.X = x; MapPosition.Y = y; ScreenPosition.X = MapPosition.X - ACamera.MapPosition.X + (ACamera.ScreenView.Width / 2); ScreenPosition.Y = MapPosition.Y - ACamera.MapPosition.Y + (ACamera.ScreenView.Height / 2); origin.X = (float)Math.Round((double)(Tex.Width / 2), 0, MidpointRounding.AwayFromZero); origin.Y = (float)Math.Round((double)(Tex.Height / 2), 0, MidpointRounding.AwayFromZero); HealthRectangle = new Texture2D(GDM.GraphicsDevice, InitialHealth + 2, 5); HROrigin = new Vector2((float)Math.Round((double)((InitialHealth + 2) / 2), 0, MidpointRounding.AwayFromZero), 3f); HRColour = new Color[5 * (InitialHealth + 2)]; for (int i = 0; i < 5 * (InitialHealth + 2); i++) { HRColour[i] = Color.Black; } for (int i = 1; i <= InitialHealth; i++) { HRColour[i + (InitialHealth + 2)] = Color.Lime; HRColour[i + 2 * (InitialHealth + 2)] = Color.Lime; HRColour[i + 3 * (InitialHealth + 2)] = Color.Lime; } HealthRectangle.SetData <Color>(HRColour); Pic = Tex; Box = Tex.Bounds; HROffset.Y = Box.Height / 2 + 10; CurrentPic = Pic; Box.X = x - (int)(origin.X); Box.Y = y - (int)(origin.Y); }