void InitializeTiles() { tileRepository.Clear(); for (int x = 0; x < TableSize; x++) { for (int y = 0; y < TableSize; y++) { Tile tile = new Tile(); tile.X = x; tile.Y = y; tileRepository.Add(tile); } } }
public Form1() { InitializeComponent(); p = new Player(res.Player, gw); p2 = new Enemy(res.Player, gw) { Location = new DecimalPoint(3050, 3150) }; gw.Player = p; p.Location.X = 3000; p.Location.Y = 3000; p2.TargetSpeed = 6; p2.Angle = 180; p2.MotionBehavior = new CircleMotionBehavior(p2, gw, p.Location); Tile grass = new Tile(res.Grass, 0); grass.IsSolid = false; Tile rock = new Tile(res.Rock, 1); rock.IsSolid = true; Tile Brick = new Tile(res.BrickWall, 2); rock.IsSolid = true; Tile grassstone = new Tile(res.FloorsMedieval, 3); rock.IsSolid = false; TileRepository.Add(grass); TileRepository.Add(rock); TileRepository.Add(Brick); TileRepository.Add(grassstone); game = new Game(this.CreateGraphics(), gw, this.Size); this.Size = Game.Size; gw.GameObjects.Add(p); gw.GameObjects.Add(p2); t = new Thread(Run); t.Start(); }
void InitializeTable() { int k = 1; for (int y = 0; y < GameInfo.TableSize; y++) { for (int x = 0; x < GameInfo.TableSize; x++) { Tile tile = new Tile { X = x, Y = y, Number = k }; k += 1; repository.Add(tile); } } }