public void Move(int[,] grid) { int move = 0; Random rng = new Random(); int ch = rng.Next(0, 4); switch(ch) { case 0: move = 1; break; case 1: move = -1; break; case 2: move = 2; break; case 3: move = -2; break; } this.RemoveFromGrid(grid); if (move == 1) { this.core = new Coordinates(core.x, core.y - 1); } if (move == -1) { this.core = new Coordinates(core.x, core.y + 1); } if (move == 2) { this.core = new Coordinates(core.x-1, core.y); } if (move == -2) { this.core = new Coordinates(core.x+1, core.y); } this.UpdateBits(); this.PlaceInGrid(grid); }
public void TimeProgress(int[,] grid) { this.RemoveFromGrid(grid); this.core = new Coordinates(core.x + direction, core.y); this.PlaceInGrid(grid); }
public HeroV2(int pos1,int pos2, int l) { this.core = new Coordinates(pos1, pos2); lives = l; bits.Add(this.core); bits.Add(new Coordinates(pos1, pos2 + 1)); bits.Add(new Coordinates(pos1+1, pos2 + 1)); bits.Add(new Coordinates(pos1+1, pos2)); }
public Boss(int pos1,int pos2, int l) { this.core = new Coordinates(pos1, pos2); lives = l; bits.Add(this.core); // plus shape bits.Add(new Coordinates(pos1+1, pos2)); bits.Add(new Coordinates(pos1-1, pos2)); bits.Add(new Coordinates(pos1, pos2-1)); bits.Add(new Coordinates(pos1, pos2 +1)); }
public void Move(int move, int[,] grid) { this.RemoveFromGrid(grid); if (move == 1) { this.core = new Coordinates(core.x, core.y - 1); } if (move == -1) { this.core = new Coordinates(core.x, core.y + 1); } if (move == 2) { this.core = new Coordinates(core.x-1, core.y); } if (move == -2) { this.core = new Coordinates(core.x+1, core.y); } this.UpdateBits(); this.PlaceInGrid(grid); }
public ProjectileV2(int xpos, int ypos, int d, int d2 = 0) { this.core = new Coordinates(xpos, ypos); direction = d; }