建行生活-打地鼠

建行生活-打地鼠

image-20240101160956234

startX, startY是触摸点击的坐标,将这两个参数修改为地鼠obj的坐标,就可以精确的打到地鼠。

image-20240101161108151

创建地鼠的时候,自动发送一个touchstart事件,实现自动打地鼠

image-20240101161412489

完成前面两步后,分数只能到280-300左右。想要突破这个分数,需要修改游戏中地鼠出现的速度、时间。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
hg.time.on("acce",function(index){
game.speed = game.clientWidth / (3000 - 500 * index);
//产生地鼠时间间隔
game.showTime = 1000 - 180 * index;
game.stayTime = game.stayTime - 50 * index;
}).on("end",function(){
_gameOver = true;
setTimeout(function(){
gameOver(hg.grade.val);
},300);
})

// 修改后

hg.time.on("acce", function(index) {
index = 4;
game.speed = game.clientWidth / (3000 - 700 * index);
//产生地鼠时间间隔
game.showTime = 1000 - 249 * index;
game.stayTime = game.stayTime - 50 * index;
}).on("end", function() {
_gameOver = true;
setTimeout(function() {
gameOver(hg.grade.val);
}, 300);
})

image-20240103130503301

image-20240103130642030