You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

structures.js 433B

1234567891011121314151617
  1. import Structure from "./Structure.js";
  2. export default {
  3. floor: (width) => {
  4. let attrs = [ "collides" ];
  5. if (width <= 1) {
  6. return new Structure(attrs, [ { x: 0, y: 0, tile: "grass-lr" }]);
  7. } else {
  8. return new Structure(attrs, [
  9. { x: 0, y: 0, tile: "grass-l", },
  10. Array.from({ length: width - 2 }, (_, i) =>
  11. ({ x: i + 1, y: 0, tile: "grass" })),
  12. { x: width - 1, y: 0, tile: "grass-r" },
  13. ]);
  14. }
  15. },
  16. }