Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example 'creating a simple map with jsiso' does not render #17

Open
Rob-pw opened this issue Jul 12, 2016 · 1 comment
Open

Example 'creating a simple map with jsiso' does not render #17

Rob-pw opened this issue Jul 12, 2016 · 1 comment

Comments

@Rob-pw
Copy link

Rob-pw commented Jul 12, 2016

http://jsiso.com/tutorials/2015/03/01/creating-a-simple-map-with-jsiso.html?source=true

Having the same issue locally, unsure as to what the problem might be, there are no errors in the console.

@Telokis
Copy link

Telokis commented May 12, 2017

The code should be this one:

    require([
      'jsiso/canvas/Control',
      'jsiso/tile/Field',
      'requirejs/domReady!'
    ],
    function(CanvasControl, TileField) {

      // RGBA of color to use
      var tileColor = "(158, 154, 255, 1)";

      // Our Tile Map
      var tileMap = [
        [tileColor, 0, tileColor, 0, tileColor],
        [tileColor, tileColor, tileColor, 0, tileColor],
        [tileColor, 0, tileColor, 0, tileColor]
      ]

      // X & Y drawing position, and tile span to draw 
      var xrange = 8;
      var yrange = 8;

      // use CanvasControl to create a simple canvas element
      var context = CanvasControl.create("canvas", 600, 640, {}, "main"); // Changed here

      var tileLayer = new TileField(context, CanvasControl().height, CanvasControl().width);

      tileLayer.setup({
        layout: tileMap,
        isometric: true, // Changed here
        tileHeight: 50, // Changed here
        tileWidth: 100 // Changed here
      });

      // Rotate our entire Map 
      tileLayer.rotate("left");
        tileLayer.setOffset(200, 100); // <======= Added this
      
      // Loop through our tiles and draw the map  
      for (i = 0; i < xrange; i++) {
        for (j = 0; j < yrange; j++) {
          tileLayer.draw(i,j);
        }
      }
        
    });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants