flappy bird test
Flappy !!!!!
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>HTML5 Snake</title>
<link href='http://fonts.googleapis.com/css?family=Cabin+Sketch:bold' rel='stylesheet' type='text/css'>
<style type="text/css">
body {
background:#9c9;
text-align:center;
}
canvas {
background:#9c9;
-webkit-box-shadow:0 0 20px #000;
-moz-box-shadow: 0 0 20px #000;
box-shadow:0 0 20px #000;
}
h1 { font-family: 'Cabin Sketch', arial, serif; font-size:50px;
text-indent: -100px;margin-bottom:20;margin-top:30px}
</style>
<script type="text/javascript">
/**
* @license HTML5 experiment Snake
* http://www.xarg.org/project/html5-snake/
*
* Copyright (c) 2011, Robert Eisele ([email protected])
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
function init() {
var ctx;
var turn = [];
var xV = [-1, 0, 1, 0];
var yV = [0, -1, 0, 1];
var queue = [];
var elements = 1;
var map = [];
var X = 5 + (Math.random() * (45 - 10))|0;
var Y = 5 + (Math.random() * (30 - 10))|0;
var direction = Math.random() * 3 | 0;
var interval = 0;
var score = 0;
var inc_score = 50;
var sum = 0, easy = 0;
var i, dir;
var canvas = document.createElement('canvas');
for (i = 0; i < 45; i++) {
map[i] = [];
}
canvas.setAttribute('width', 45 * 10);
canvas.setAttribute('height', 30 * 10);
ctx = canvas.getContext('2d');
document.body.appendChild(canvas);
function placeFood() {
var x, y;
do {
x = Math.random() * 45|0;
y = Math.random() * 30|0;
} while (map[x][y]);
map[x][y] = 1;
ctx.strokeRect(x * 10 + 1, y * 10 + 1, 10 - 2, 10 - 2);
}
placeFood();
function clock() {
if (easy) {
X = (X+45)%45;
Y = (Y+30)%30;
}
--inc_score;
if (turn.length) {
dir = turn.pop();
if ((dir % 2) !== (direction % 2)) {
direction =...