Web前端--HTML+CSS+JS新型冠状病毒射击小游戏_js射击小游戏源码

var stage = {
w: 1280,
h: 720
}

var _pexcanvas = document.getElementById(“canvas”);
_pexcanvas.width = stage.w;
_pexcanvas.height = stage.h;
var ctx = _pexcanvas.getContext(“2d”);

var pointer = {
x: stage.w / 2,
y: stage.h / 4
}

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;

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);
this.ty = Math.floor(Math.random() * stage.h);
this.des = false;
this.eyeX = 0.4;
this.eyeY = 0.25;
this.eyeR = 0.25;
this.sp = 50;
this.spl = 1.4;
this.op = 1;
this.danger = false;
this.nuked = false;

总结
  • 对于框架原理只能说个大概,真的深入某一部分具体的代码和实现方式就只能写出一个框架,许多细节注意不到。

开源分享:【大厂前端面试题解析+核心总结学习笔记+真实项目实战+最新讲解视频】

  • 算法方面还是很薄弱,好在面试官都很和蔼可亲,擅长发现人的美哈哈哈…(最好多刷一刷,不然影响你的工资和成功率???)

  • 在投递简历之前,最好通过各种渠道找到公司内部的人,先提前了解业务,也可以帮助后期优秀 offer 的决策。

  • 要勇于说不,对于某些 offer 待遇不满意、业务不喜欢,应该相信自己,不要因为当下没有更好的 offer 而投降,一份工作短则一年长则 N 年,为了幸福生活要慎重选择!!!

第一次跳槽十分忐忑不安,和没毕业的时候开始找工作是一样的感受,真的要相信自己,有条不紊的进行。如果有我能帮忙的地方欢迎随时找我,比如简历修改、内推、最起码,可以把烦心事说一说,人嘛都会有苦恼的~

祝大家都有美好的未来,拿下满意的 offer。

  • 27
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值