Vanilla JS Tutorials

JsIso Tutorials

RSS feed

05 - Adding an Isometric player that can be moved

Adding Ralph from the vanilla player movement tutorial is easy in JsIso, we also get the ability to take advantage of the height map with no extra work.
In this sample we have added a second layer which could hold NPCs, Pickups, Players, Trees, Pylons, Water Towers, Walls of Winterfell... endless possibilities.

With the new layer "objectLayer" we apply the same properties as the "tileLayer", but we set - heightMapOnTop: true// We want to draw only on top of the heightmap.
This makes all graphics in this layer drawn on top, however for this tutorial we only want to draw Ralph, so we use the tileImageOverwrite property of layer.draw():

 if (i === ralphX && j === ralphY) {
       objectLayer.draw(i, j, ralphGraphic);

As always, check out the live code viewer to fiddle, linked at the bottom:

    function(CanvasControl, TileField, imgLoad, CanvasInput) {

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

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

      // Our Height Map 
      var tileHeightMap = [

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

      // X & Y Coordinates of Ralph
      var ralphX = 1;
      var ralphY = 1;

      var ralphGraphic = null; // Will contain the image of Raplh once it has been loaded

      var context = CanvasControl.create("canavas", 640, 640, {});

      // Two layers - one for the ground, second layer for objects, player objects, NPCS, pickups, etc etc
      var tileLayer = new TileField(context, CanvasControl().height, CanvasControl().width);
      var objectLayer = new TileField(context, CanvasControl().height, CanvasControl().width);

      // Create our Input controls and pass through the CanvasControl to it
      var input = new CanvasInput(document, CanvasControl());
      // Pressed is the keycode of user input, and keydown means the button is down rather than press ended
      input.keyboard(function(pressed, keydown) {
        if (!keydown) {
          switch(pressed) {
            // Move player
            case 37:
              ralphY ++;
            case 39:
              ralphY --;
            case 40:
              ralphX ++;
            case 38: 
              ralphX --;
          // Call draw Tile Map function

      var images = [
          graphics: [
            "/img/game/ground/blank-block.png" // The images we want to load using imgLoader
          graphics: [

      function drawTileMap() {
        // Clear drawn map before clearing
        context.clearRect(0, 0, CanvasControl().width, CanvasControl().height);
        // Loop through our tiles and draw the map  
        for (i = 0; i < 0 + xrange; i++) {
          for (j = 0; j < 0 + yrange; j++) {
            tileLayer.draw(i, j);
            if (i === ralphX && j === ralphY) {
              objectLayer.draw(i, j, ralphGraphic);

      // imgLoad uses Promises, once the images have loaded we continue and use the returned imgResponse
      imgLoad(images).then(function(imgResponse) {

        // set Raplphs image, imgResponse[1] because it was the second list of graphics to be loaded
        ralphGraphic = imgResponse[1].files["ralph.png"] 

          title: "Ground Layer",
          layout: tileMap,
          isometric: true, // Flag used to layout grid in isometric format
          tileHeight: 50,
          tileWidth: 100,
          heightMap: {
          map: tileHeightMap,
          // imgResponse[0] contains the first set of grpahic files[] we placed in the graphics array
          heightTile: imgResponse[0].files["blank-block.png"],
          offset: 0
          shadow: {
            offset: 50, // Offset is the same height as the stack tile
            verticalColor: '(5, 5, 30, 0.4)',
            horizontalColor: '(6, 5, 50, 0.5)'
        // Object Layer
          title: "Object Layer",
          isometric: true, // Flag used to layout grid in isometric format
          zeroIsBlank: true,
          layout: tileMap,
          tileHeight: 50,
          tileWidth: 100,
          heightMap: {
            map: tileHeightMap,
            offset: 50,
            heightMapOnTop: true// We want to draw only on top of the heightmap

        // Rotate our entire Map 

        // Set an offset so our map is on screen
        tileLayer.setOffset(200, 100);
        objectLayer.setOffset(200, 100);
        // Call draw Tile Map function

Check out the View Source to see tutorial.
Up Down Left Right to move Ralph

Tutorial Outcome (View & Run Source)


  1. This is great, awesome to continue learning how to maneuver this stuff, thank you. carpet cleaners medicine hat

    painters brandon mb Sun, 28 Apr 2019

  2. What an information-rich article! I'm glad I found you guys

    — Alex P Wed, 15 May 2019

  3. It’s very informative and you are obviously very knowledgeable in this area. garena free fire playerunknown's battlegrounds

    — samuelddarden Wed, 29 May 2019

  4. Wow! Amazing tutorials on adding isometric player. Very detailed information you have here! Thanks a lot! accident towing in ashburn va

    — Aryan Tue, 4 Jun 2019

  5. You have a great detailed information, I'm impressed on how you presented the important things. Keep it up! lawn care services

    — Daniel Perez Fri, 7 Jun 2019

  6. It's my pleasure to find this amazing website who provides mostly unseen information about every single topic which is i really like it. click here

    — Joshua A. Price Mon, 10 Jun 2019

  7. Nice job, I really like how your site looks. tree trimming

    — fred luis Wed, 12 Jun 2019

  8. Waow this is quite pleasant article, my sister love to read such type of post, I am going to tell her and bookmarking this webpage. Thanks

    voyante sérieuse par téléphone Thu, 11 Jul 2019

  9. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value of providing a quality resource for free.

    voyance très fiable Sat, 13 Jul 2019

  10. Wow! Thanks for this tutorial. I hope I can do this in my end.

    lawn care company columbia Thu, 1 Aug 2019

  11. Codes are complex, Thanks for sharing this tutorial with us.

    Hvac Tech Support Thu, 1 Aug 2019

  12. Plenty of helpful info here. Kindly also discuss with my site =). wayhaven chronicles book 2

    — SAMS Thu, 1 Aug 2019

  13. Wow, I love your post today! This in just the perfect time. Thanks a bunch! Hudson's Concrete Contractor Pittsburgh

    Hudson's Concrete Contractor Pittsburgh Mon, 5 Aug 2019

  14. Amazing tutorial using JSiso which is Tile-Based engine which uses the HTML5 Canvas element.
    social security card application

    — Darius Oliver Tue, 6 Aug 2019

  15. You must be very astute at research and writing. This shows up in your original and unique content. our site

    — Cassandra D. Everhart Tue, 6 Aug 2019

  16. You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. domino88

    sam Wed, 7 Aug 2019

  17. I have added and shared your site to my social media accounts to send people back to your site because I am sure they will find it extremely helpful too. pengeluaran sgp

    sam Fri, 9 Aug 2019

  18. "Haarlem (Geluidsfragment uitspraak is een stad en gemeente in Nederland en
    de hoofdstad van de provincie Noord-Holland. De stad ligt aan de rivier
    het Spaarne en in de regio Zuid-Kennemerland / Haarlemmermeer." Haarlem online services Haarlemmermeer

    — MUNEER Thu, 15 Aug 2019

  19. Persons appreciate shopping for amazing, appealing, fascinating and from time to time attractive aromas for them selves and pertaining to others. This can be executed conveniently along with inexpensively in an on-line perfume shop. 리턴벳 먹튀

    sam Sat, 17 Aug 2019

  20. Great tutorial and thank you for sharing this routine/procedure for a movable isometric player. I'll try this out and at the same time share this to my friends at Seo Cincinnati who are also interested in this.

    — Terrence Foster Mon, 19 Aug 2019

  21. Een dakkapel uitwijkconsole is een steiger contructie voor op daken met een dakkapel. Ideaal voor onderhoud van uw dakkapel bij bijvoorbeeld schilderwerkzaamheden of gewoon het periodiek schoonmaken van uw dakkapel. Dakkapel Uitwijkconsole Steigercentrum heeft diverse lichte modellen op voorraad die eenvoudig zijn te monteren als ook te domonteren.

    — muneer ahmed Tue, 20 Aug 2019

  22. So luck to come across your excellent blog. Your blog brings me a great deal of fun.. Good luck with the site. worldwide trademark search

    sam Tue, 20 Aug 2019

  23. Thank you for the great tips. I both host and am a guest at poker nights every now and again, but never really considered why or how setting the tone of play is important. This makes things very clear, and I agree, it's better to be upfront about the expectations right from the start. Thanks for putting this together, I appreciated it.
    Snow Removal Saskatoon
    Maid Services Saskatoon
    Cement Contractor Saskatoon

    — Hank Gilbertson Tue, 20 Aug 2019

  24. Awesome tutorials! Glad I've reached your site. This is very useful in coding. Thanks a lot! business tax preparation

    — Karlyle Woodbridge Tue, 20 Aug 2019

  25. Awesome tutorials! I always look back here for coding and for updates. Good job! Keep it up! SEO VA

    — Kate Tue, 20 Aug 2019

  26. Appreciating the persistence you put into your blog and detailed information you provide. I’ve bookmarked your site and I’m adding your RSS feeds to my Google account. voyance amour

    sam Fri, 23 Aug 2019

  27. "Een makelaar bemiddelt bij koop en verkoop, huur en verhuur van huizen,
    winkels, horecabedrijven, kantoren, roerende zaken, verzekeringen, op de
    goederentermijnmarkt of ander roerend, onroerend of registergoed, regelt
    contracten en (ver)koopafspraken. Een groot deel van het werk bestaat uit
    het zoeken van (de makelaar van) een geschikte partij om dat bepaalde goed
    eenmalig mee te verhandelen. De makelaar is dus slechts tussenpersoon en
    is werkzaam krachtens een overeenkomst van bemiddeling. Het vak wordt de
    makelaardij genoemd. De makelaar verzorgt traditioneel alle zaken van
    opname tot de overdracht door de notaris. Hiervoor betaalt de klant een
    courtage, dit is een vooraf afgesproken percentage ( meestal tussen 1% en
    2% ) van de uiteindelijk gerealiseerde verkoopprijs. De Nederlandse
    Vereniging van Makelaars (NVM) hanteerde tot eind jaren 90 adviestarieven.
    Dit is door de Nederlandse Mededingingsautoriteit (NMa) verboden.
    Tegenwoordig zijn er ook makelaars, die een vast tarief hanteren ongeacht
    de verkoopwaarde. Zolang de werkzaamheden van de makelaar niet tot
    resultaat leiden, hoeft de verkopende klant meestal alleen de door de
    makelaar gemaakte kosten te vergoeden. Primair is de bemiddeling
    bij verkoop van woningen, appartementen, flat, bedrijfspand en winkels." Makelaarskantoor

    — muneer Sat, 24 Aug 2019

  28. I gave this website to my kid and he told me that he got the same result. I told him if he can edit some of the programming, and he did. Thank you so much, my kid actually learned something.

    harrisburg roof repair Mon, 26 Aug 2019

  29. This is a great idea to build a mini satellite map for usps change of address online upon checking locations out. This looks like a building which we can see from above.

    — Eliya Mon, 26 Aug 2019

  30. I can't beleive how much this has helped our local business to get with the times. Thanks so much!

    Ace Wed, 28 Aug 2019

  31. Great post, please keep on sharing amazing article like this! It makes me happy reading your post.

    Play Free Online Papa's Games Thu, 29 Aug 2019

  32. That's a great idea. Thanks for sharing. Please visit our website Katy Stamped Concrete if you are interested in Interior Designs.

    — Katy Stamped Wed, 4 Sep 2019

  33. This is cool post and I appreciate to peruse this post. your blog is phenomenal and you have great staff in your blog. pleasant sharing keep it up. 104 productivity

    sam Thu, 5 Sep 2019

  34. This is quite interesting. Thank you for sharing. Please visit Charlotte Septic Services.

    — Charlotte Septic Mon, 9 Sep 2019

  35. This is amazing. It is really amazing. Looking forward to trying this. Thank you for sharing this to us. It really helps.
    >> Tyler Sprinkler

    Tyler Sprinkler Tue, 10 Sep 2019

  36. Your current writings abilities are great. You'll have to be able to write alot more.

    — jake Wed, 18 Sep 2019

  37. Your websites appears so excellent!

    — jake Wed, 18 Sep 2019

  38. Amazing content
    SEO services in Delhi

    scorsh Fri, 20 Sep 2019

  39. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Sun, 22 Sep 2019

  40. gucci uk outlet gucci outlet christian louboutin shoes christian louboutin shoes ugg boots outlet ugg boots ugg boots cheap ugg boots valentino shoes valentino rockstud valentino outlet valentino outlet ray ban sunglasses ray-ban sunglasses ray-ban outlet ray ban outlet sac louis vuitton sac louis vuitton coach factory coach outlet online michael kors outlet online michael kors outlet louis vuitton outlet louis vuitton outlet coach outlet online ray-ban outlet ray ban sunglasses ray-ban outlet lunettes de soleil ray ban pas cher ray-ban outlet oakley outlet oakley sunglasses oakley outlet
    Around us, we can focus on you wholeheartedly, so Liao Liao a few, what you said and did, sometimes like a gust of wind, blown away. Therefore, we need not care about other people's comments, as long as we do our own thing well; do not need to look at other people's eyes, just walk our own way; do not need to complain too much, it will make our heart more tired. No matter where we go, we should not lose ourselves.

    oakley sunglasses outlet Mon, 23 Sep 2019

  41. This function of isometric was amazing. Baytown Plumber

    Baytown Plumber Wed, 25 Sep 2019

  42. This is quite good. I rather choose this one. Katy Tshirts

    Katy Tshirts Wed, 25 Sep 2019

  43. I enjoying reading this content. Waco Septic Pumping

    Waco Septic Pumping Wed, 25 Sep 2019

  44. I'm happy I found this tutorial. Conroe Septic Pumping

    Conroe Septic Pumping Wed, 25 Sep 2019

  45. Salutations! Je suis désolé, ce n'est pas le sujet! J'aime vraiment votre forum! Je vous remercie, je suis avec vous) Tue, 1 Oct 2019

  46. A lot of people love the idea of fixing or restoring cars for a living, and for good reason. While extremely satisfying and enjoyable, however, this line of work isn’t without its challenges. Whether you work at a dealership or in a small repair shop, there are certain qualities you need to have or adopt in order to be an efficient and reliable auto mechanic:

    Restoring Old Cars To Their Original Condition

    First of all, you need excellent work ethics. A good car mechanic knows who to trust with a certain job, how to solve problems quickly, and how to be completely honest and transparent when dealing with customers and solving tricky problems.
    Problem solving skills are also a must. Auto mechanics often have to deal with unforeseen problems and work around them to get the job done properly and on time.
    You need very strong technical skills to be able to actually get the job done. This skill can be learned, but a certain level of innate dexterity and proficiency with basic tools should be required even for younger, less experienced aspiring mechanics. They should be versed in hydraulic fittings Denver mechanic shops might require.
    Finally, leadership and communication skills are indispensable. While a good mechanic can work well on his/her own, some jobs require excellent teamwork and coordination, as well as good customer service skills.

    — Mobile Mechanic Roseville Wed, 9 Oct 2019

  47. Very nice article! Worth the read.

    towing service hattiesburg ms Wed, 9 Oct 2019

  48. Great read!!

    tow company fall river ma Fri, 18 Oct 2019

  49. Very good stuff. Portland Mobile Mechanic

    Mike Fri, 18 Oct 2019

  50. Furnace Repair in Lynnwood WA

    Kyle Fri, 18 Oct 2019

  51. Home Theater Company Los Angeles

    Daniel Karen Fri, 18 Oct 2019

  52. Orlando's Best Mobile Mechanic

    Helen Thu, 24 Oct 2019

  53. Great article! -Chicago's Best Mobile Mechanic

    Benjamin Thu, 24 Oct 2019

  54. Nice post -San Jose's Best Mobile Mechanic

    Brandon Thu, 24 Oct 2019

  55. Nice post -Tampa's Best Mobile Mechanic

    Brandon Thu, 24 Oct 2019

  56. Fort Worth's Best Mobile Mechanic

    Reggie Thu, 24 Oct 2019

  57. Charlotte's Best Mobile Mechanic

    Brandon Fri, 25 Oct 2019

  58. Miami's Best Mobile Mechanic

    — Keith Fri, 25 Oct 2019

  59. Project Tech
    Thanks for the awesome write up! I found the article to be informative.

    Project Tech Sat, 26 Oct 2019

  60. Inland Empire's Best Mobile Mechanic

    — William Sun, 27 Oct 2019

  61. Houston's Best Mobile Mechanic

    — Ernie Sun, 27 Oct 2019

  62. Thank you for sharing information. It a wonderful post.

    Tech Info Sun, 27 Oct 2019

  63. This is very interesting information, I am very impressed

    Xeem Tech Tue, 29 Oct 2019

  64. Excellent source of information, love the content that you produce.

    Water mains

    Tree Surgery Wed, 30 Oct 2019

  65. Excellent Post. Thanks for sharing this.

    Tech Down Thu, 31 Oct 2019

  66. Very nice blog post. I absolutely love this site. Keep writing!

    Tech Zone Thu, 31 Oct 2019

  67. Well, this post is quite good!Thanks for updating my information about the subject. It is very useful for me.

    Clik Trik Mon, 4 Nov 2019

  68. This is really an incredible read for me. I have bookmarked it and I am anticipating perusing new articles. Keep doing awesome!.

    Market Share Tue, 5 Nov 2019

  69. Well, this post is quite good!Thanks for updating my information about the subject. It is very useful for me.

    E-Com Profits Thu, 7 Nov 2019

  70. I absolutely appreciate your blog as well as all of your posts.

    Opene Group Mon, 11 Nov 2019

  71. Very good blog.Really looking forward to read more. Really Cool.

    Bookmark Sharer Mon, 11 Nov 2019

  72. I absolutely appreciate your blog as well as all of your posts.

    Ace Greetings Mon, 11 Nov 2019

  73. Well, this post is quite good!Thanks for updating my information about the subject. It is very useful for me.

    Hb Fenn Tue, 12 Nov 2019

  74. This is really an incredible read for me. I have bookmarked it and I am anticipating perusing new articles. Keep doing awesome!.

    Iwdn Wed, 13 Nov 2019

  75. I am definitely enjoying your website. You definitely have some great insight and great stories.

    Entre Prenerd Wed, 13 Nov 2019

  76. This is help me so much in my learning. Thank you for sharing.

    IT Exam ex Thu, 14 Nov 2019

  77. Thank you for the info!

    Preview your Sites Fri, 15 Nov 2019

  78. Fantastic weblog! Is your theme custom made or even do you download this through someplace? A topic like your own with a few basic tweeks would definitely help make my blog leap out. You should tell me in places you received your layout. With thanks

    Portsmouth Moving Sun, 17 Nov 2019

  79. so we use the tileImageOverwrite property of layer.draw():

    dadosmaldonado Tue, 19 Nov 2019

  80. Excellent Post. Thanks for sharing this.

    Geek Check Tue, 19 Nov 2019

  81. Your site has a lot of useful information for myself I visit regularly hope to have more quality items.

    Host Q Tue, 19 Nov 2019

  82. Great reference info here for my programming hobby

    Reggie Tue, 19 Nov 2019

  83. Your site has a lot of useful information for myself I visit regularly hope to have more quality items.

    Cyber Generation Thu, 21 Nov 2019

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

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