zoukankan      html  css  js  c++  java
  • VUE+WebPack实现精美前端游戏:CardBattle的游戏场景设置

    C:UsersHONGZHENHUAcardBattlesrcApp.vue

    src/App.vue

    <template>
      <div id="app">
        <!--
        <img src="./assets/logo.png">
        -->
        <game-container></game-container>
        <!--
        <router-view/>
        -->
      </div>
    </template>
    
    <script>
      import GameContainer from './components/gamecontainer'
    export default {
      components: {
        GameContainer
      },
      name: 'App'
    }
    </script>
    
    <style>
      /**
    #app {
      font-family: 'Avenir', Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      text-align: center;
      color: #2c3e50;
      margin-top: 60px;
    }
      **/
    </style>

    C:UsersHONGZHENHUAcardBattlesrccomponentsgamecontainer.vue

    src/components/gamecontainer.vue

    <template>
      <div>
        <header>
          <div class="row">
             <h1>Card Battle!</h1>
             <section id="game" class="row">
              <start-scene></start-scene>
            </section>
          </div>
        </header>
        <section class="how-to-play">
          <h2>玩法介绍</h2>
          <p>选择任意一张牌,然后观看点数的pk结果</p>
        </section>
        <footer>
          <p>给我打个赏把!</p>
          <img id="payme" src="../../static/payme.jpg">
        </footer>
      </div>
    </template>
    
    <script>
      import StartScene from './startscenecomponent'
      export default {
        components: {
          StartScene
        }
      }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
      #game {
        wdith: 480px;
        height:600px;
        border-radius: 8px;
        overflow: hidden;
      }
    
      .scene {
        width: 100%;
        height: 100%;
        position: absolute;
        overflow: hidden;
        border-radius: 8px;
        transition: all.3s ease-out;
    
      }
    
      #payme {
        width:240px;
        height: 256px;
      }
    </style>

    C:UsersHONGZHENHUAcardBattlesrccomponentsHelloWorld.vue

    src/components/HelloWorld.vue

    <template>
      <div class="hello">
        <h1>{{ msg }}</h1>
        <h2>Essential Links</h2>
        <ul>
          <li>
            <a
              href="https://vuejs.org"
              target="_blank"
            >
              Core Docs
            </a>
          </li>
          <li>
            <a
              href="https://forum.vuejs.org"
              target="_blank"
            >
              Forum
            </a>
          </li>
          <li>
            <a
              href="https://chat.vuejs.org"
              target="_blank"
            >
              Community Chat
            </a>
          </li>
          <li>
            <a
              href="https://twitter.com/vuejs"
              target="_blank"
            >
              Twitter
            </a>
          </li>
          <br>
          <li>
            <a
              href="http://vuejs-templates.github.io/webpack/"
              target="_blank"
            >
              Docs for This Template
            </a>
          </li>
        </ul>
        <h2>Ecosystem</h2>
        <ul>
          <li>
            <a
              href="http://router.vuejs.org/"
              target="_blank"
            >
              vue-router
            </a>
          </li>
          <li>
            <a
              href="http://vuex.vuejs.org/"
              target="_blank"
            >
              vuex
            </a>
          </li>
          <li>
            <a
              href="http://vue-loader.vuejs.org/"
              target="_blank"
            >
              vue-loader
            </a>
          </li>
          <li>
            <a
              href="https://github.com/vuejs/awesome-vue"
              target="_blank"
            >
              awesome-vue
            </a>
          </li>
        </ul>
      </div>
    </template>
    
    <script>
    export default {
      name: 'HelloWorld',
      data () {
        return {
          msg: 'Welcome to Your Vue.js App'
        }
      }
    }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
    h1, h2 {
      font-weight: normal;
    }
    ul {
      list-style-type: none;
      padding: 0;
    }
    li {
      display: inline-block;
      margin: 0 10px;
    }
    a {
      color: #42b983;
    }
    </style>

    C:UsersHONGZHENHUAcardBattlesrccomponentsstartscenecomponent.vue

    src/components/startscenecomponent.vue

    <template>
      <div id="start-scene" class="scene">
        <a href="#" id="start-btn" class="button"></a>
      </div>
    
    </template>
    
    <script>
      export default {
      }
    </script>
    
    <!-- Add "scoped" attribute to limit CSS to this component only -->
    <style scoped>
      #start-scene {
        background: url(../../static/images/start-scene-bg.png) no-repeat;}
    
      .button{
        position:absolute;
         100%;
        height: 100%;
        top:0;
        left:0;
      }
    </style>

    C:UsersHONGZHENHUAcardBattleindex.html

    index.html

    <!DOCTYPE html>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0">
        <title>CardBattle</title>
      </head>
      <body>
        <div id="app"></div>
        <!-- built files will be auto injected -->
      </body>
    </html>

  • 相关阅读:
    ie条件注释
    css3之图片一闪而过特效
    css帧动画之图片发亮
    css3动画
    解决ie6不兼容透明图片
    jquery实现拖拽的效果
    原生js实现拖拽弹框的效果
    C++学习笔记十之连接数据库
    C++学习笔记九之异常处理
    C++学习笔记八之STL内置算法
  • 原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/10133238.html
Copyright © 2011-2022 走看看