protected bool IsBlockedBottom(SolidTile sprite) { return(Rectangle.Top + _velocity.Y < sprite.Rectangle.Bottom && Rectangle.Bottom > sprite.Rectangle.Bottom && Rectangle.Right > sprite.Rectangle.Left && Rectangle.Left < sprite.Rectangle.Right); }
protected bool IsBlockedTop(SolidTile sprite) { return(Rectangle.Bottom + _velocity.Y > sprite.Rectangle.Top && Rectangle.Top < sprite.Rectangle.Top && Rectangle.Right > sprite.Rectangle.Left && Rectangle.Left < sprite.Rectangle.Right); }
protected bool IsBlockedRight(SolidTile sprite) { return(Rectangle.Left + _velocity.X < sprite.Rectangle.Right && Rectangle.Right > sprite.Rectangle.Right && Rectangle.Bottom > sprite.Rectangle.Top && Rectangle.Top < sprite.Rectangle.Bottom); }
protected void createSolidTileRectangle(int x, int y, int width, int height, int level) { for (int i = x; i < x + width; i++) { for (int j = y; j < y + height; j++) { tileMap[level][i, j] = new SolidTile(); } } }
void HandleSolid() { for (int i = 0; i < 15; i++) { for (int j = 0; j < 10; j++) { if (MouseOver(i, j)) { CurrentTemplate.Tiles[i, j].Solid = !CurrentTemplate.Tiles[i, j].Solid; if (CurrentTemplate.Tiles[i, j].Solid) { CurrentTemplate.Tiles[i, j] = SolidTile.Copy(); } else { CurrentTemplate.Tiles[i, j] = EmptyTile.Copy(); } } } } }
void LoadEditorTemplates() { //Foreach .lvl files add it to the list string[] fileNames = Directory.GetFiles(Directory.GetCurrentDirectory() + @"\roomtemplates\"); try { foreach (string file in fileNames) { StreamReader streamreader = new StreamReader(file); string importedlevel = streamreader.ReadToEnd(); streamreader.Close(); string[] contents = importedlevel.Replace("\r\n", "").Replace("\n", "").Replace("\r", "").Split('-'); CurrentTemplateName = Strip(file); TemplateButton result = new TemplateButton(UnselectedSummary, CurrentTemplateName, DoorTiles, 0); string[] solids = contents[0].Split(':')[1].Split(','); foreach (string s in solids) { if (s != "") { string[] pair = s.Split('/'); result.Template.Tiles[Convert.ToInt32(pair[0]), Convert.ToInt32(pair[1])] = SolidTile.Copy(); } } string[] doors = contents[1].Split(':')[1].Split(','); foreach (string d in doors) { if (d != "") { string[] pair = d.Split('/'); result.Template.Tiles[Convert.ToInt32(pair[0]), Convert.ToInt32(pair[1])] = DoorTile.Copy(); } } string[] payout = contents[2].Split(':')[1].Split('/'); result.Template.Payout = new Vector2I(Convert.ToInt32(payout[0]), Convert.ToInt32(payout[1])); string[] creatures = contents[3].Split(':')[1].Split(','); foreach (string c in creatures) { if (c != "") { string[] pair = c.Split('='); int hash = Convert.ToInt32(pair[0]); Enemy enemy = EnemyButtons.Single(x => x.Enemy.Hash == hash).Enemy; Enemy guy = enemy.Copy(new Vector2I(Convert.ToInt32(pair[1].Split('/')[0]), Convert.ToInt32(pair[1].Split('/')[1])), enemy.Hash); result.Template.Entities.Add(guy); } } result.Template.Difficulty = Convert.ToInt32(contents[4].Split(':')[1]); TemplateButtons.Add(result); } } catch (Exception e) { Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } TemplateButtons.Sort(); ReallignTemplates(); }