public Car(Graphics model, Graphics gc, Map map, CurrentPosition pos, Bitmap bmp) { this.model = model; this.gc = gc; this.map = map; carImg = Image.FromFile("menti.gif"); currentX = initialX - 1; currentY = initialY - 1; this.pos = pos; this.pos.X = 1; this.pos.Y = 1; this.pos.VelocityX = 100; this.pos.VelocityY = 0; this.bmp = bmp; way = Way.LEFT; move(); }
private void initWorldMap() { map = new Map(GRID_WIDTH, GRID_HEIGHT); Bitmap bmp = new Bitmap(GRID_WIDTH * map.SquareSize + 1, GRID_HEIGHT * map.SquareSize + 1); /*for (int i = 0; i < worldMap.Size.Width; i++) { for (int j = 0; j < worldMap.Size.Height; j++) { if (i % 50 == 0 || j % 50 == 0) { bmp.SetPixel(i, j, Color.Black); } } }*/ worldMap.Image = bmp; carThread = new Thread(new ThreadStart(moveCar)); carThread.IsBackground = true; pictureBox1.Image = null; mapBmp = new Bitmap(GRID_WIDTH + 2, GRID_HEIGHT + 2); }