Vanilla JS Tutorials

JsIso Tutorials

RSS feed

01 - Creating a simple Map with JsIso

A very simple example of creating a flat 2D map. By change two values, a Boolean (isometric: true), and a Number (tileWidth: 40) as seen in the instructions, you can easily change this 2D map into an Isometric 2D.5 map.

A basic JsIso Tile Field feature shown is .rotate(); this takes the argument either "left" or "right". This is similar to .flip(); which accepts "vertical" or "horizontal".

The map is built from RGBA colors.

    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, 300, {}, "main");

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

      tileLayer.setup({
        layout: tileMap,
        isometric: false, // Flag used to layout grid in non isometric format
        tileHeight: 80,
        tileWidth: 80 // Try setting isometric to true and half tileWidth to 40, for an isometric map
      });

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

Check out the View Source to see tutorial.

Tutorial Outcome (View & Run Source)

25 comments

  1. Woah!Thanks for this, man! I owe you a lot. Been struggling with this thing for weeks now/=.

    concrete driveway cincinnati Fri, 17 May 2019

  2. very informative. I wonder why the other experts of this sector don’t understand this. mobile legends pc

    — samuelddarden Wed, 29 May 2019

  3. I will make this as an example for my report this coming Friday. Thank you for making it convenient for me. :) Very understandable!

    roof repair cost estimator Tue, 4 Jun 2019

  4. I simply stumbled upon your blog and desired to say that I possess really enjoyed browsing your current posts. keep doing your great job and always gain my support. cheers for sharing this beautiful article. click here

    — Joshua A. Price Mon, 10 Jun 2019

  5. These codes are very important for our website! Superb!

    Washington SEO Tue, 11 Jun 2019

  6. Thank you so much! for sharing this because I've been thinking about this topic weeks already.
    r410a

    — Daniel Perez Tue, 18 Jun 2019

  7. I appreciate sharing your knowledge regarding about this topic. Thank you!
    | urgent care elite

    — Meggy Mon, 8 Jul 2019

  8. Excellent work, many thanks for sharing

    Rubbish clearance | CCTV Systems

    SEO Agency Durham Thu, 18 Jul 2019

  9. Pretty insightful post. Never thought that it was this simple after all. I had spent a good deal of my time looking for someone to explain this subject clearly and you’re the only one that ever did that. Keep it up. kitchen remodel

    — fredluis Thu, 25 Jul 2019

  10. Thanks a lot for sharing. Keep posting codings and tutorials. begamer

    — Patricia J. Clark Thu, 25 Jul 2019

  11. Thanks so much for sharing the routine in making a map using JsIso. Just what I need.
    www.moneymatcher.co.za/

    — Elvin Holt Fri, 26 Jul 2019

  12. Much better if we can see a video tutorial for this.

    columbia heating and cooling Tue, 30 Jul 2019

  13. Thanks for this tutorial!

    -theuselessweb.com

    — Connor Shaw Tue, 6 Aug 2019

  14. I've been looking for this kind of article, and here I found this one. Awesome!

    check us out

    — Anna Thu, 8 Aug 2019

  15. That was awesome from jsiso. The multi layered map is just excellent!
    tile and grout cleaning perth

    — Jessin1508 Tue, 13 Aug 2019

  16. Thank God I found this tutorial! Such a huge relief for me this is so helpful. Thanks so much for sharing this!

    random website

    — Matt Tue, 13 Aug 2019

  17. Hmm! seems like we share the same point of view. Gainesville Tree Pro Haile Plantation

    — Cassandra Thu, 15 Aug 2019

  18. Thank you for writing the code, I've been looking for it for a long long time! official site

    — Lori R. Novak Thu, 22 Aug 2019

  19. Thanks for sharing this post, I'll keep updated to your post because it's very informative and useful for future reference. | customxmlittlerock.com

    — AnnaSmith Fri, 23 Aug 2019

  20. Thanks for this! We can do so much in applying this to our social security administration website.

    — Earl Bennet Sun, 25 Aug 2019

  21. Thank goodness I found this tutorial! This is really helpful for me. Thank you for publicly sharing this! | https://www.a1septicservicejax.com

    — Mary Kay Tue, 3 Sep 2019

  22. Hello! I just want to say this is very helpful. esports talent agency

    — Horea Kaii Tue, 3 Sep 2019

  23. Sapling climbing surges are reported to become the most crucial instrument whenever climbing trees and shrubs, electricity poles as well as telephone rods. These surges are combined with the climbing shoes to enable them to enable the actual climber to purchase a ideal grip as well as secure all of them from falling the moment climbing the tree or possibly a post. http://landscapingaustin.net

    Larry Taylor Thu, 12 Sep 2019

  24. Woods climbing surges are reported to get the key instrument while climbing bushes, electricity poles or maybe telephone poles. These surges are with the climbing shoes to be able to enable your climber to acquire a excellent grip along with secure these people from falling after climbing a new tree or perhaps a person of polish lineage. http://bastroplandscaping.com

    Larry Green Thu, 12 Sep 2019

  25. This routine/procedure gives me an idea on how to create our own map. This is really very helpful.

    www.assistedonlinefilings.com/ Sun, 15 Sep 2019

Please insert the result of the arithmetical operation from the following image:

Please insert the result of the arithmetical operation from this image. =