Skip to content

Commit 7a1f68c

Browse files
committed
Favicon & コード整理
1 parent cbdecfb commit 7a1f68c

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

Script/puzzle.js

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,7 @@ const falling_orb = () => {
7777
for(let j=1;j<DATA.size.Width;j++)refall=fall_obj(i-1,j,i,j-1)||refall;//L-shift
7878
for(let j=0;j<DATA.size.Width-1;j++)refall=fall_obj(i-1,j,i,j+1)||refall;//R-shift
7979
}
80-
for(let i=0;i<DATA.size.Width;i++){
81-
if(DATA.board.obj[0][i][0] === 0){
82-
DATA.board.obj[0][i]=[~~(Math.random()*ORB_COLORS)+1,1];
83-
refall=true;
84-
}
85-
}
80+
DATA.board.obj[0] = DATA.board.obj[0].map(x => (x[0]===0)?(refall = true , [~~(Math.random()*ORB_COLORS)+1,1]):x);
8681
if(!refall){
8782
clearInterval(FALL_TIMER);
8883
chainable=true;
@@ -93,14 +88,12 @@ const falling_orb = () => {
9388
const onmouce_cell = cell => {
9489
const [CELL_Y,CELL_X] = [cell.target.parentNode.rowIndex,cell.target.cellIndex];
9590
const CELL_COLOR = DATA.board.obj[CELL_Y][CELL_X][0];
96-
if(chain_now){
97-
if(Math.abs(chain_yx.at(-1).y-CELL_Y)<=1&&Math.abs(chain_yx.at(-1).x-CELL_X)<=1)/*位置チェック*/{
98-
if(chain_info.color === CELL_COLOR&&!chain_yx.some(e => e.x === CELL_X && e.y === CELL_Y))/*条件チェック*/{
99-
cell.target.querySelector("img").classList.add("chaining");
100-
chain_yx.push({x : CELL_X,y : CELL_Y});
101-
chain_info.count++;
102-
}
103-
}
91+
if(chain_now &&
92+
Math.abs(chain_yx.at(-1).y-CELL_Y)<=1&&Math.abs(chain_yx.at(-1).x-CELL_X)<=1 /*位置チェック*/ &&
93+
chain_info.color === CELL_COLOR&&!chain_yx.some(e => e.x === CELL_X && e.y === CELL_Y))/*条件チェック*/{
94+
cell.target.querySelector("img").classList.add("chaining");
95+
chain_yx.push({x : CELL_X,y : CELL_Y});
96+
chain_info.count++;
10497
}
10598
}
10699
const chain_toggler = cell => {
@@ -173,9 +166,4 @@ const startgame = () => {
173166
import(DATALINK)
174167
.then(x => {DATA = object_copy(x.default) ; board_init()});
175168
};
176-
document.querySelector("#startbutton").onclick=startgame;
177-
//1~:オーブ
178-
//0:無空間
179-
//~-1:妨害ブロック
180-
181-
//ADJ_BREAK
169+
document.querySelector("#startbutton").onclick=startgame;

favicon.ico

318 Bytes
Binary file not shown.

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>chain_puzzle</title>
77
<link rel="stylesheet" type="text/css" href="css.css">
8+
<link rel="icon" href="favicon.ico">
89
</head>
910
<body>
1011
<div id="stage_select">

0 commit comments

Comments
 (0)