同志们你们拉干货的司机——默默来了,这次给大家带来的是风靡一时的2048小游戏的源码哦,获取方式见文末
个性化设置你的展现皮肤,默认内容是数字
var myText = [];
//[“菜鸟”, “入门”, “码畜”, “码奴”, “码农”, “IT民工”, “IT工程师”, “IT人才”, “IT精英”, “IT大哥”, “IT领袖”];
//[“工兵”, “班长”, “排长”, “连长”, “营长”, “团长”, “旅长”, “师长”, “军长”, “司令”, “军旗”]
方向左键:
function move_left() {
if (!can_move_left(board)) {
return false;
}
//move left
for (var i = 0; i < 4; i++) {
for (var j = 1; j < 4; j++) {
if (board[i][j] != 0) {
for (var k = 0; k < j; k++) {
if (board[i][k] == 0 && no_block_horizontal(i, k, j, board)) {
show_move_animation(i, j, i, k);
board[i][k] = board[i][j];
board[i][j] = 0;
break;
} else if (board[i][k] == board[i][j] && no_block_horizontal(i, k, j, board) && !has_conflicted[i][k]) {
show_move_animation(i, j, i, k);
board[i][k] += board[i][j]
board[i][j] = 0;
//add score
score += board[i][k];
update_score(score);
has_conflicted[i][k] = true;
break;
}}}}}
setTimeout(update_board_view(), 200);
return true;}
私信回复:2048源码 就可以下载到完整源码了!各位加油