小黑猫js小游戏

代码语言:html

所属分类:游戏

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>小黑猫</title>
<script type='text/javascript' src='http://repo.bfw.wiki/bfwrepo/js/three.js'></script>
<script type='text/javascript' src='http://repo.bfw.wiki/bfwrepo/js/TweenMax.min.js'></script>
<script type='text/javascript' src='http://repo.bfw.wiki/bfwrepo/js/OrbitControls.js'></script>
<style type="text/css">
      *{
        margin: 0px;
        padding: 0px;
      }
      #world{
          position: absolute;
          width:100%;
          height: 100%;
          background-color: #6ecccc;
      overflow:hidden;
      }
      #credits{
      position:absolute;
      width:100%;
      margin: auto;
      bottom:0;
      margin-bottom:20px;
      font-family:'Open Sans', sans-serif;
      color:#328685;
      font-size:0.7em;
      text-transform: uppercase;
      text-align : center;
      }
      #credits a {
      color:#328685;
      }
      #credits a:hover {
      color:#630d15;
      }
    </style>
</head>
<body>
<div id="world"></div>
</body>
<script>
Cat=function(){this.threeGroup=new THREE.Group();var yellowMat=new THREE.MeshLambertMaterial({color:0xfdd276,shading:THREE.FlatShading});var pinkMat=new THREE.MeshLambertMaterial({color:0xe0877e,shading:THREE.FlatShading});var redMat=new THREE.MeshLambertMaterial({color:0x630d15,shading:THREE.FlatShading});var whiteMat=new THREE.MeshLambertMaterial({color:0xffffff,shading:THREE.FlatShading});var blackMat=new THREE.MeshLambertMaterial({color:0x111111,shading:THREE.FlatShading});var brownMat=new THREE.MeshLambertMaterial({color:0x2e2019,shading:THREE.FlatShading});var lightBrownMat=new THREE.MeshLambertMaterial({color:0x664f4a,shading:THREE.FlatShading});this.handHeight=10;this.bodyHeight=80;this.armHeight=((this.bodyHeight*3/5)-this.handHeight)/2;this.faceHeight=30;this.shouldersPosition=new THREE.Vector3(0,this.armHeight*2+this.handHeight,0);this.isAttacking=false;this.isFootReplacing=false;this.isBlinking=false;this.footUsed="left";this.transferPower={x:0,y:0};this.body=new THREE.Group();var torsoGeom=new THREE.CylinderGeometry(0,26,this.bodyHeight,3,1);this.torso=new THREE.Mesh(torsoGeom,brownMat);this.torso.geometry.applyMatrix(new THREE.Matrix4().makeRotationY(Math.PI/3));this.torso.geometry.applyMatrix(new THREE.Matrix4().makeTranslation(0,-this.bodyHeight/2,0));var chestGeom=new THREE.CylinderGeometry(6,0,17,3);chestGeom.applyMatrix(new THREE.Matrix4().makeRotationY(Math.PI/3));chestGeom.applyMatrix(new THREE.Matrix4().makeScale(1,1,.3));this.chest=new THREE.Mesh(chestGeom,whiteMat);this.chest.position.set(0,-30,1);this.head=new THREE.Group();var faceGeom=new THREE.BoxGeometry(30,this.faceHeight,30);this.face=new THREE.Mesh(faceGeom,brownMat);this.face.geometry.applyMatrix(new THREE.Matrix4().makeTranslation(0,this.faceHeight/2,0));this.face.geometry.applyMatrix(new THREE.Matrix4().makeRotationY(Math.PI/4));var scarfGeom=new THREE.CylinderGeometry(10,9,9,10,1);this.scarf1=new THREE.Mesh(scarfGeom,redMat);this.scarf1.material.side=THREE.DoubleSide;this.scarf1.position.y=-2;this.scarf1.position.z=0;this.scarf1.rotation.z=.4;this.scarf1.rotation.y=Math.PI/3;this.scarf2=this.scarf1.clone();this.scarf2.scale.set(.9,.7,.9);this.scarf2.position.y=-17;this.scarf2.rotation.z=-.2;var scarfGeom2=new THREE.BoxGeometry(50,2,10);this.scarf3=new THREE.Mesh(scarfGeom2,redMat);this.scarf3.geometry.applyMatrix(new THREE.Matrix4().makeTranslation(25,0,0));this.scarf3.position.set(3,-15,2);this.scarf3.rotation.y=1.2;this.scarf3.rotation.z=-1;this.head.add(this.scarf1);this.torso.add(this.scarf2);this.torso.add(this.scarf3);this.torso.add(this.chest);var skewMatrixBody=new THREE.Matrix4();skewMatrixBody.set(1,0,0,0,0,1,0,0,0,0.20,1,0,0,0,0,1);this.torso.geometry.applyMatrix(skewMatrixBody);this.chest.geometry.applyMatrix(skewMatrixBody);this.body.add(this.torso);this.body.position.y=this.bodyHeight;var whiskerGeom=new THREE.BoxGeometry(16,.2,.2);this.whisker1=new THREE.Mesh(whiskerGeom,lightBrownMat);this.whisker1.geometry.applyMatrix(new THREE.Matrix4().makeTranslation(-7,0,0));this.whisker1.position.set(-6,8,18);this.whisker1.rotation.z=Math.PI/12;this.whisker2=this.whisker1.clone();this.whisker2.position.y=6;this.whisker3=this.whisker1.clone();this.whisker3.position.y=4;this.whisker4=this.whisker1.clone();this.whisker4.rotation.z=Math.PI-Math.PI/12;this.whisker4.position.x=-this.whisker1.position.x;this.whisker5=this.whisker4.clone();this.whisker5.position.y=this.whisker2.position.y;this..........完整代码请登录后点击上方下载按钮下载查看

网友评论0