var scale = 1;
var portrait = true;
var loffset = 0;
var toffset = 0;
var mxpos = 0;
var mypos = 0;
// ------------------------------------------------------------------------------- Gamy
var againprog = 0;
var healthprog = 0;
function newGame() {
score = 0;
health = 100;
enemies = [];
enemies.push(new Enemy());
enemies.push(new Enemy());
enemies.push(new Enemy());
againprog = 0;
}
function drawHeart(x, y, w) {
ctx.beginPath();
ctx.arc(x - w / 4, y, w / 4, 0.75 * Math.PI, 0);
ctx.arc(x + w / 4, y, w / 4, 1 * Math.PI, 2.25 * Math.PI);
ctx.lineTo(x, y + w / 1.5);
ctx.closePath();
ctx.fill();
}
var Cannon = function(x, y, tx, ty) {
this.x = x;
this.y = y;
this.tx = tx;
this.ty = ty;
this.r = 10;
}
var cannons = [];
var gameover = false;
cannons.push(new Cannon(stage.w, stage.h, stage.w / 2, stage.h / 2));
var firetm = 0;
var fireact = true;
《大厂前端面试题解析+Web核心总结学习笔记+企业项目实战源码+最新高清讲解视频》无偿开源 徽信搜索公众号【编程进阶路】 var health = 100;
var score = 0;
var arm = {
x: stage.w,
y: stage.h
};
var arm2 = {
x: 0,
y: stage.h
};
var danger = false;
var dangera = 0;
var Enemy = function() {
this.x = stage.w / 2;
this.y = stage.h / 2;
this.r = 10;
this.tx = Math.floor(Math.random() * stage.w);