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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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="game">
  <div class="modal" :class="{'is-active': menu}">
    <div class="modal-background"></div>
    <div class="modal-content">
      <!-- Any other Bulma elements you want -->
    </div>
    <button class="modal-close is-large" aria-label="close" @click="menu = !menu"></button>
  </div>
  
  <div class="hero is-fullheight is-fullwidth" >
    <div class="hero-head message box is-radiusless">
      <div class="level is-mobile is-marginless">
        <div class="level-left"><h1 class="has-text-weight-bold is-marginless is-size-4">{{ header }}</h1></div>
        <div class="level-right"><div class="is-size-5" @click="menu = !menu"><i class="fas fa-cog"></i></div></div>
      </div>
      <div class="columns is-mobile">
        <div class="column is-marginless"><p v-for="resource in basicRec">{{resource.name}}: {{resource.qty}}</p></div>
        <div class="column is-marginless"><p v-for="found in foundRec">{{found.name}}: {{found.qty}}</p></div>
        <div class="column is-marginless"><p v-for="building in buildings">{{building.name}}: {{building.qty}}</p></div>
      </div>
    </div>
    <div class="hero-body is-paddingless pages">
      <div v-for="page in pages" class="is-paddingless animated fadeIn hide page" :class="{show: page.state}">
        <div class="box is-radiusless" style="height:100%;">
          <h1>{{page.name}}</h1>
          <div v-if="page.name === 'gather'">
            <div v-for="rec in basicRec">
              <button class="button is-fullheight" v-on:click="rec.qty++">{{rec.name}}</button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="hero-foot box nav columns is-mobile is-radiusless is-marginless">
      <div v-for="page in pages" @click="disableShow(), page.state = !page.state" class="column is-paddingless button is-radiusless is-size-7 has-text-weight-bold"><p>{{page.name.toLocaleUpperCase()}}</p></div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                /* uses bulma for base styles */
* {
  box-sizing:border-box;
}
html, body, hero, hero-body{
    height: 100%;
    margin: 0;
    padding: 0;
}
.hero-foot .column {
  display: flex;
}
.is-paddingless-left{
  padding-left:0px;
}
.is-paddingless-right{
  padding-right:0px;
}
.align-items-initial {
  align-items: initial;
  flex-grow: 1;
  flex-basis: 0;
}
.pages {
  position: relative;
}
.page {
  position: absolute;
  width: 100%;
  height: 100%;
}
.hide {
  display: none;
  height: 100%;
}
.show {
  display: block;
}
              
            
!

JS

              
                var game = new Vue({
  el: '#game',
  data: {
    // stored data
    header: 'Idle Kingdoms',
    menu: false,
    pages: {
      gather: {
        name: 'gather',
        state: true,
      },
      people: {
        name: 'people',
        state: false,
      },
      build: {
        name: 'build',
        state: false,
      },
      upgrade: {
        name: 'upgrade',
        state: false,
      }
    },
    time: {
      day: 0,
      hour: 0,
      min: 0,
    },
    people: [
      {
        name: 'people',
        qty: 0,
      },
      {
        name: 'farmers',
        qty: 0,
      },
      {
        name: 'loggers',
        qty: 0,
      },
      {
        name: 'miners',
        qty: 0,
      }
    ],
    basicRec: [
      {
        name: 'apple',
        qty: 0,
        
      },
      {
        name: 'wood',
        qty: 0,
      },
      {
        name: 'stone',
        qty: 0,
      }
    ],
    foundRec: [
      {
        name: 'skin',
        qty: 0,
      },
      {
        name: 'herb',
        qty: 0,
      },
      {
        name: 'ore',
        qty: 0,
      }
    ],
    buildings: [
      {
        name: 'hut',
        qty: 0,
      },
      {
        name: 'farm',
        qty: 0,
      },
      {
        name: 'quarry',
        qty: 0,
      }
    ]
    
  },
  computed: {
    // realtime computations
    activePage() {
      
    }
  },
  methods: {
    // Storing Vue Methods (functions)
    disableShow: function() {
      this.pages.gather.state = false;
      this.pages.people.state = false;
      this.pages.build.state = false;
      this.pages.upgrade.state = false;
    },
    increaseRec: function(material){
      material.qty++;
    }
  }
});
game;
              
            
!
999px

Console