Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="demo">
  Created for my blog article: <a href="https://renerehme.de/blog/how-i-created-a-action-role-playing-game" target="_blank">How I created a action role-playing game</a>.
</div>
<div class="tilemaps-controls">
    <button data-id="all">All</button>
    <button data-id="layer4">Ground</button>
    <button data-id="layer3">Objects</button>
    <button data-id="layer1">Overlays</button>
</div>
<div class="tilemaps-container">
    <button class="tilemaps">
        <div class="tilemap layer1">
            <div>
                <div>Overlays</div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div class="id17"></div>
                <div class="id18"></div>
                <div class="id19"></div>
                <div></div>
                <div></div>
                <div class="id9"></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
            </div>
        </div>
        <div class="tilemap layer2">
            <div>
                <span></span>
            </div>
        </div>
        <div class="tilemap layer3">
            <div>
                <div>Objects</div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div class="id20"></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div class="id11"></div>
                <div class="id12"></div>
                <div class="id13"></div>
                <div></div>
                <div></div>
                <div class="id10"></div>
                <div></div>
                <div></div>
                <div class="id14"></div>
                <div class="id15"></div>
                <div class="id16"></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div></div>
                <div class="id20"></div>
            </div>
        </div>
        <div class="tilemap layer4">
            <div>
                <div class="id1">Ground</div>
                <div class="id1"></div>
                <div class="id3"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id3"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id2"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id4"></div>
                <div class="id6"></div>
                <div class="id7"></div>
                <div class="id6"></div>
                <div class="id6"></div>
                <div class="id8"></div>
                <div class="id7"></div>
                <div class="id6"></div>
                <div class="id7"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id5"></div>
                <div class="id3"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id3"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id2"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id2"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id3"></div>
                <div class="id1"></div>
                <div class="id1"></div>
                <div class="id1"></div>
            </div>
        </div>
    </button>
</div>
              
            
!

CSS

              
                @keyframes layer1 {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-30%);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes layer2 {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(15%);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes layer3 {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes layer4 {
  0% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(30%);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes character {
  0% {
    left: -32px;
  }
  100% {
    left: 262px;
  }
}

@keyframes border {
  0% {
    -webkit-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0);
    -moz-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0);
    box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0);
    color: transparent;
  }
  50% {
    -webkit-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.4);
    -moz-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.4);
    box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0.4);
    color: black;
  }
  100% {
    -webkit-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0);
    -moz-box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0);
    box-shadow: inset 0px 0px 0px 1px rgba(0, 0, 0, 0);
    color: transparent;
  }
}

html {
  body {
    #demo {
      text-align: center;
      margin: 15px 0;
      font-family:arial;
      font-size:16px;
      
      a {
        color: #252554;
        text-decoration: none;
        border-bottom: 2px solid #252554;
        
        &:hover {
          color: #54549a;
          border-bottom: 2px solid #54549a;
        }
      }
    }
    
    .tilemaps-controls {
      display: flex;
      justify-content: center;
      align-items: center;
      color: #252554;

      button {
        margin:10px 5px;
        color: white;
        background: #252554;
        border: 0;
        padding: 10px 20px;
      }
    }

    .tilemaps-container {
      position: relative;
      width: 100%;
      height: 330px;
      margin-left: -30px;

      .tilemaps {
        display: block;
        width: 176px;
        margin: 60px auto 30%;
        padding: 0;
        position: relative;
        outline: none;
        border: none;

        .tilemap {
          position: absolute;
          top: 0;
          left: 0;

          > div {
            transform: skewY(18deg);
            display: flex;
            flex-wrap: wrap;
            width: 256px;

            > div {
              background-image: url(https://renerehme.de/_Resources/Persistent/d7ccbc6f2ff5ee7b1f186677bd46b8a110470888/tilemap_pattern.png);
              background-repeat: repeat-y;
              background-position: 32px 0;
              float: left;
              height: 32px;
              width: 32px;
              display: flex;
              justify-content: flex-end;
              line-height: 540px;
              font-weight: 600;
              animation: border 10s infinite;

              &.id1 {
                background-position: 0 0;
              }

              &.id2 {
                background-position: -32px 0;
              }

              &.id3 {
                background-position: -64px 0;
              }

              &.id4 {
                background-position: -96px 0;
              }

              &.id5 {
                background-position: -128px 0;
              }

              &.id6 {
                background-position: -160px 0;
              }

              &.id7 {
                background-position: -192px 0;
              }

              &.id8 {
                background-position: -224px 0;
              }

              &.id9 {
                background-position: -256px 0;
              }

              &.id10 {
                background-position: -288px 0;
              }

              &.id11 {
                background-position: 0 32px;
              }

              &.id12 {
                background-position: -32px 32px;
              }

              &.id13 {
                background-position: -64px 32px;
              }

              &.id14 {
                background-position: -96px 32px;
              }

              &.id15 {
                background-position: -128px 32px;
              }

              &.id16 {
                background-position: -160px 32px;
              }

              &.id17 {
                background-position: -192px 32px;
              }

              &.id18 {
                background-position: -224px 32px;
              }

              &.id19 {
                background-position: -256px 32px;
              }

              &.id20 {
                background-position: -288px 32px;
              }
            }
          }

          &.markTile {
            > div {
              > div {
                -webkit-box-shadow: inset 0px 0px 0px 32px rgba(0, 0, 0, 0.4);
                -moz-box-shadow: inset 0px 0px 0px 32px rgba(0, 0, 0, 0.4);
                box-shadow: inset 0px 0px 0px 32px rgba(0, 0, 0, 0.4) !important;
                opacity: 0.3;
              }
            }
          }

          &.layer1 {
            z-index: 4;
            animation: layer1 10s infinite;
          }

          &.layer2 {
            z-index: 3;
            animation: layer2 10s infinite;

            span {
              position: absolute;
              left: -100px;
              top: 85px;
              height: 64px;
              width: 30px;
              background: url(https://renerehme.de/_Resources/Persistent/f83d694bc2e2e4c0284a5058cd914cf59e528e7e/hero_walks_right03.png);
              animation: character 2s infinite;
            }
          }

          &.layer3 {
            z-index: 2;
            animation: layer3 10s infinite;
          }

          &.layer4 {
            z-index: 1;
            animation: layer4 10s infinite;
          }
        }
      }
    }
  }
}
              
            
!

JS

              
                $(function () {
    $('.tilemaps-controls > button').click(function () {
        var layerID = $(this).data('id');
        if (layerID === 'all') {
            $('.tilemap').removeClass('markTile');
        } else {
            $('.tilemaps-controls > button').each(function () {
                $('.tilemap').addClass('markTile');
            });
            $('.' + layerID).removeClass('markTile');
        }
    });
});
              
            
!
999px

Console