Level.js 706 B

1234567891011121314151617181920212223242526272829
  1. var node = self.node;
  2. var tmxFile = cache.getResource("TmxFile2D", "Levels/Level1.tmx");
  3. var tileMapNode = scene.createChild("TileMap");
  4. tileMapNode.setPosition([0.0, 0.0, 0.0]);
  5. var tileMap = tileMapNode.createComponent("TileMap2D");
  6. tileMap.setTmxFile(tmxFile);
  7. print(tileMap.numLayers);
  8. cameraNode.setPosition([8, 12, 0]);
  9. camera.setZoom(1.0);
  10. /*
  11. TileMap2D* tileMap = tileMapNode->CreateComponent<TileMap2D>();
  12. // Set animation
  13. tileMap->SetTmxFile(tmxFile);
  14. // Set camera's position
  15. const TileMapInfo2D& info = tileMap->GetInfo();
  16. float x = info.GetMapWidth() * 0.5f;
  17. float y = info.GetMapHeight() * 0.5f;
  18. cameraNode_->SetPosition(Vector3(x, y, -10.0f));
  19. */