1
1

Pond.ts 833 B

1234567891011121314151617181920
  1. /// <reference path="../Forest.ts" />
  2. module Forest{
  3. export let Pond = new RoomRandom("Pond", false, true);
  4. export let PondCoordinates = Forest.rnc.generate(-1,1, 1, 4);
  5. Pond.backgroundImage = "roomPond";
  6. }
  7. Forest.region.place(Forest.Pond);
  8. Forest.Pond.trickyCode = (options : TrickyOptions) => {
  9. let blocked = !options.map.isFree(Forest.PondCoordinates[0], Forest.PondCoordinates[1]);
  10. while (blocked) {
  11. Forest.PondCoordinates[1] += 1;
  12. blocked = !options.map.isFree(Forest.PondCoordinates[0], Forest.PondCoordinates[1]);
  13. if (blocked) {
  14. Forest.PondCoordinates[0] += 1;
  15. blocked = !options.map.isFree(Forest.PondCoordinates[0], Forest.PondCoordinates[1]);
  16. }
  17. }
  18. return options.x == Forest.PondCoordinates[0] && options.y == Forest.PondCoordinates[1];
  19. };