浏览代码

add jump action and update instructions (#8654)

Hu Jiulong 9 年之前
父节点
当前提交
508e4d6314
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      examples/misc_fps.html

+ 5 - 1
examples/misc_fps.html

@@ -30,7 +30,7 @@
 	<body>
 
 		<div id="container"></div>
-		<div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - platformer demo. cubemap by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a>.<br />Use arrow keys to look around and WASD to move.</div>
+		<div id="info"><a href="http://threejs.org" target="_blank">three.js</a> - platformer demo. cubemap by <a href="http://www.zfight.com/" target="_blank">Jochum Skoglund</a>.<br />Use arrow keys to look around, WASD to move and SPACE to jump.</div>
 
 		<script src="../build/three.js"></script>
 
@@ -101,6 +101,10 @@
 						if( Math.abs( combined.x ) >= Math.abs( motion.velocity.x ) ) motion.velocity.x = combined.x;
 						if( Math.abs( combined.y ) >= Math.abs( motion.velocity.y ) ) motion.velocity.y = combined.y;
 						if( Math.abs( combined.z ) >= Math.abs( motion.velocity.z ) ) motion.velocity.z = combined.z;
+
+						//jump
+ 						var vy = keysPressed[keys.SP] ? 0.7 : 0;
+ 						motion.velocity.y += vy;
 					}
 				};
 			})();