Main.hx 787 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package common;
  2. import common.Constants.*;
  3. import common.cell.Player;
  4. import common.cell.Empty;
  5. class Main {
  6. public var grid: GridImpl;
  7. public var player: Player;
  8. public function new(grid: GridImpl) {
  9. this.grid = grid;
  10. grid.setCell(10, 10, LAYER_ENTITIES, player = new Player(grid, 10, 10, LAYER_ENTITIES));
  11. #if cli
  12. Draw.text(grid, 0, 48, 2, "Health = 3", 0);
  13. #else
  14. Draw.text(grid, 0, 48, 2, "♥♥♥", 0);
  15. #end
  16. Draw.text(grid, 0, 49, 2, "Hey its me ur grid");
  17. }
  18. public function update(key: Int) {
  19. grid.batch();
  20. for (layer in grid.tilearr) {
  21. for (cell in layer) {
  22. cell.update(key);
  23. }
  24. }
  25. grid.execBatch();
  26. }
  27. }