js实现挡板游戏

代码语言:html

所属分类:游戏

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

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
@import url(https://fonts.googleapis.com/css?family=Poiret+One);

body{
  overflow:hidden;
  width:100%; 
  margin:0;
  cursor:pointer;
}
</style>

</head>
<body translate="no">
<canvas id="canv"></canvas>

<script >
window.requestAnimFrame = function () {
  return window.requestAnimationFrame ||
  window.webkitRequestAnimationFrame ||
  window.mozRequestAnimationFrame ||
  window.oRequestAnimationFrame ||
  window.msRequestAnimationFrame ||
  function (callback) {
    window.setTimeout(callback, 1000 / 60);
  };
}();
var c, $;
var balls, planks;
var fps = 30;

function go(start) {
  c = document.getElementById("canv");
  $ = c.getContext("2d");
  c.width = window.innerWidth;
  c.height = window.innerHeight;
  $.lineWidth = 10;
  balls = new Balls();
  planks = new Plank();
  if (start) {
    draw();
  }
}

function draw() {
  $.fillStyle = 'hsla(252, 95%, 85%, 1)';
  $.fillRect(0, 0, c.width, c.height);
  var t = "Detour".split("").join(String.fromCharCode(0x2004));
  $.font = "5em Poiret One";
  $.fillStyle = &.........完整代码请登录后点击上方下载按钮下载查看

网友评论0