public Waypoint(int x, int y, Game.Directions direction) { Random rnd = new Random(); picture = new PictureBox(); picture.BackColor = Color.Red; picture.Size = new Size(40, 40); picture.Location = new Point(40 * x, 40 * y); this.direction = direction; }
public Waypoint() { Random rnd = new Random(); picture = new PictureBox(); picture.BackColor = Color.Red; picture.Size = new Size(40, 40); picture.Location = new Point(40 * rnd.Next(0, 20), 40 * rnd.Next(0, 20)); direction = (Game.Directions)rnd.Next(0, 4); }
public Enemy() { Health = 100; picture = new PictureBox(); picture.BackgroundImage = Image.FromFile(@"C:\Users\headchezze\Desktop\MixedPresentAkitainu-size_restricted.gif"); picture.Location = new Point(400, 40); picture.Size = new Size(40, 40); picture.BackgroundImageLayout = ImageLayout.Stretch; this.Direction = Game.Directions.down; }
public void Move(Game.Directions heading) { int[] targetLoc; switch (heading) { case Game.Directions.N: if (GridLoc[1] <= 0) { targetLoc = new int[] { GridLoc[0], Game.Map.GetLength(1) - 1 }; } else { targetLoc = new int[] { GridLoc[0], GridLoc[1] - 1 }; } GridLoc[0] = targetLoc[0]; GridLoc[1] = targetLoc[1]; Location = Game.Map[GridLoc[0], GridLoc[1]]; if (Location == null) { Game.Map[GridLoc[0], GridLoc[1]] = Game.RNGHandler.GenBiome(); Location = Game.Map[GridLoc[0], GridLoc[1]]; } break; case Game.Directions.S: if (GridLoc[1] >= Game.Map.GetLength(1) - 1) { targetLoc = new int[] { GridLoc[0], 0 }; } else { targetLoc = new int[] { GridLoc[0], GridLoc[1] + 1 }; } GridLoc[0] = targetLoc[0]; GridLoc[1] = targetLoc[1]; Location = Game.Map[GridLoc[0], GridLoc[1]]; if (Location == null) { Game.Map[GridLoc[0], GridLoc[1]] = Game.RNGHandler.GenBiome(); Location = Game.Map[GridLoc[0], GridLoc[1]]; } break; case Game.Directions.E: if (GridLoc[0] >= Game.Map.GetLength(0) - 1) { targetLoc = new int[] { 0, GridLoc[1] }; } else { targetLoc = new int[] { GridLoc[0] + 1, GridLoc[1] }; } GridLoc[0] = targetLoc[0]; GridLoc[1] = targetLoc[1]; Location = Game.Map[GridLoc[0], GridLoc[1]]; if (Location == null) { Game.Map[GridLoc[0], GridLoc[1]] = Game.RNGHandler.GenBiome(); Location = Game.Map[GridLoc[0], GridLoc[1]]; } break; case Game.Directions.W: if (GridLoc[0] <= 0) { targetLoc = new int[] { Game.Map.GetLength(0) - 1, GridLoc[1] }; } else { targetLoc = new int[] { GridLoc[0] - 1, GridLoc[1] }; } GridLoc[0] = targetLoc[0]; GridLoc[1] = targetLoc[1]; Location = Game.Map[GridLoc[0], GridLoc[1]]; if (Location == null) { Game.Map[GridLoc[0], GridLoc[1]] = Game.RNGHandler.GenBiome(); Location = Game.Map[GridLoc[0], GridLoc[1]]; } break; } }