public void DrawToBuffer(Map level, Bitmap block, Pac pac, Bitmap food, Bitmap specialfood) { // Draws the map on the buffer for (int x = 0; x <= level.map.GetLength(0) - 1; x++) { for (int y = 0; y <= level.map.GetLength(1) - 1; y++) { if (level.map[x, y] == 'x') { GphBuffer.DrawImage(block, x * 10, y * 10, 10, 10); } if (level.map[x, y] == 'f') { if (level.foodIsAvailable[x, y] == true) { GphBuffer.DrawImage(food, x * 10 + 2, y * 10 + 2, 5, 5); } } if (level.map[x, y] == 'o') { if (level.foodIsAvailable[x, y] == true) { GphBuffer.DrawImage(specialfood, x * 10, y * 10, 9, 9); } } } } // Draws the pac on the buffer in the x and y position GphBuffer.DrawImage(pac.bmp, new Point(pac.x, pac.y)); }
private static List <Pac> GetPacs() { int visiblePacCount = int.Parse(Console.ReadLine()); // all your pacs and enemy pacs in sight var pacs = new List <Pac>(); for (int i = 0; i < visiblePacCount; i++) { var inputs = Console.ReadLine().Split(' '); var pac = new Pac { ID = int.Parse(inputs[0]), // pac number (unique within a team) IsMine = inputs[1] != "0", // true if this pac is yours Coordinates = new Coordinates { Abscissa = int.Parse(inputs[2]), // position in the grid Ordinate = int.Parse(inputs[3]) // position in the grid }, TypeID = inputs[4], // unused in wood leagues SpeedTurnsLeft = int.Parse(inputs[5]), // unused in wood leagues AbilityCooldown = int.Parse(inputs[6]) // unused in wood leagues }; pacs.Add(pac); } return(pacs); }
public Game() { screen = new Screen(); map = new Map(); pac = new Pac(); food = new Food(); Timer t = new Timer(); t.Interval = 5; t.Start(); //Events t.Tick += new EventHandler(CheckDirection); screen.FrmScreen.KeyDown += new KeyEventHandler(EventKeyDown); screen.FrmScreen.KeyUp += new KeyEventHandler(EventKeyUp); }