在这里看到了很多有意思的代码。本着分享的精神把自己写的2048的代码也贴出来。当然本人是一个超级菜鸟,有些地方没有完善。欢迎各位大神解决。(界面很丑,不要介意)
支持触屏及电脑键盘操作(wasd四个按键)
index.html
2048table { table-layout: fixed }
table tr td{
background-color: #D7CE80;
border:#666666;
font-size:48px;
}
var startX = 0, startY = 0,d=-1;
//touchstart事件
function touchSatrtFunc(evt) {
try