Copy Copied! Back
--簡略化 local ASET = vci.assets local STAT = vci.state --Unity板の名称 local BOX_STR = { "1", "1 (1)", "1 (2)", "1 (3)", "1 (4)", "1 (5)", "1 (6)", "1 (7)", "1 (8)", "1 (9)", "1 (10)", "1 (11)", "1 (12)", "1 (13)", "1 (14)", "1 (15)", "1 (16)", "1 (17)", "1 (18)", "1 (19)", "1 (20)", "1 (21)", "1 (22)", "1 (23)", "1 (24)", "1 (25)", "1 (26)", "1 (27)", "1 (28)", "1 (29)", "1 (30)", "1 (31)", "1 (32)", "1 (33)", "1 (34)", "1 (35)", "1 (36)", "1 (37)", "1 (38)", "1 (39)", "1 (40)", "1 (41)", "1 (42)", "1 (43)", "1 (44)", "1 (45)", "1 (46)", "1 (47)", "1 (48)", "1 (49)", "1 (50)", "1 (51)", "1 (52)", "1 (53)", "1 (54)", "1 (55)", "1 (56)", "1 (57)", "1 (58)", "1 (59)", "1 (60)", "1 (61)", "1 (62)", "1 (63)", "1 (64)", "1 (65)", "1 (66)", "1 (67)", "1 (68)", "1 (69)", "1 (70)", "1 (71)", "1 (72)", "1 (73)", "1 (74)", "1 (75)", "1 (76)", "1 (77)", "1 (78)", "1 (79)", "1 (80)", "1 (81)", "1 (82)", "1 (83)", "1 (84)", "1 (85)", "1 (86)", "1 (87)", "1 (88)", "1 (89)", "1 (90)", "1 (91)", "1 (92)", "1 (93)", "1 (94)", "1 (95)", "1 (96)", "1 (97)", "1 (98)", "1 (99)", "1 (100)", "1 (101)", "1 (102)", "1 (103)", "1 (104)", "1 (105)", "1 (106)", "1 (107)", "1 (108)", "1 (109)", "1 (110)", "1 (111)", "1 (112)", "1 (113)", "1 (114)", "1 (115)", "1 (116)", "1 (117)", "1 (118)", "1 (119)", "1 (120)", "1 (121)", "1 (122)", "1 (123)", "1 (124)", "1 (125)", "1 (126)", "1 (127)", "1 (128)", "1 (129)", "1 (130)", "1 (131)", "1 (132)", "1 (133)", "1 (134)", "1 (135)", "1 (136)", "1 (137)", "1 (138)", "1 (139)", "1 (140)", "1 (141)", "1 (142)", "1 (143)", "1 (144)", "1 (145)", "1 (146)", "1 (147)", "1 (148)", "1 (149)", "1 (150)", "1 (151)", "1 (152)", "1 (153)", "1 (154)", "1 (155)", "1 (156)", "1 (157)", "1 (158)", "1 (159)", "1 (160)", "1 (161)", "1 (162)", "1 (163)", "1 (164)", "1 (165)", "1 (166)", "1 (167)", "1 (168)", "1 (169)", "1 (170)", "1 (171)", "1 (172)", "1 (173)", "1 (174)", "1 (175)", "1 (176)", "1 (177)", "1 (178)", "1 (179)", "1 (180)", "1 (181)", "1 (182)", "1 (183)", "1 (184)", "1 (185)", "1 (186)", "1 (187)", "1 (188)", "1 (189)", "1 (190)", "1 (191)", "1 (192)", "1 (193)", "1 (194)", "1 (195)", "1 (196)", "1 (197)", "1 (198)", "1 (199)" } --Unity板の名称 local BOX_STR_SUBITEM = { "1", "1 (1)", "1 (2)", "1 (3)", "1 (4)", "1 (5)", "1 (6)", "1 (7)", "1 (8)", "1 (9)", "1 (10)", "1 (11)", "1 (12)", "1 (13)", "1 (14)", "1 (15)", "1 (16)", "1 (17)", "1 (18)", "1 (19)", "1 (20)", "1 (21)", "1 (22)", "1 (23)", "1 (24)", "1 (25)", "1 (26)", "1 (27)", "1 (28)", "1 (29)", "1 (30)", "1 (31)", "1 (32)", "1 (33)", "1 (34)", "1 (35)", "1 (36)", "1 (37)", "1 (38)", "1 (39)", "1 (40)", "1 (41)", "1 (42)", "1 (43)", "1 (44)", "1 (45)", "1 (46)", "1 (47)", "1 (48)", "1 (49)", "1 (50)", "1 (51)", "1 (52)", "1 (53)", "1 (54)", "1 (55)", "1 (56)", "1 (57)", "1 (58)", "1 (59)", "1 (60)", "1 (61)", "1 (62)", "1 (63)", "1 (64)", "1 (65)", "1 (66)", "1 (67)", "1 (68)", "1 (69)", "1 (70)", "1 (71)", "1 (72)", "1 (73)", "1 (74)", "1 (75)", "1 (76)", "1 (77)", "1 (78)", "1 (79)", "1 (80)", "1 (81)", "1 (82)", "1 (83)", "1 (84)", "1 (85)", "1 (86)", "1 (87)", "1 (88)", "1 (89)", "1 (90)", "1 (91)", "1 (92)", "1 (93)", "1 (94)", "1 (95)", "1 (96)", "1 (97)", "1 (98)", "1 (99)", "1 (100)", "1 (101)", "1 (102)", "1 (103)", "1 (104)", "1 (105)", "1 (106)", "1 (107)", "1 (108)", "1 (109)", "1 (110)", "1 (111)", "1 (112)", "1 (113)", "1 (114)", "1 (115)", "1 (116)", "1 (117)", "1 (118)", "1 (119)", "1 (120)", "1 (121)", "1 (122)", "1 (123)", "1 (124)", "1 (125)", "1 (126)", "1 (127)", "1 (128)", "1 (129)", "1 (130)", "1 (131)", "1 (132)", "1 (133)", "1 (134)", "1 (135)", "1 (136)", "1 (137)", "1 (138)", "1 (139)", "1 (140)", "1 (141)", "1 (142)", "1 (143)", "1 (144)", "1 (145)", "1 (146)", "1 (147)", "1 (148)", "1 (149)", "1 (150)", "1 (151)", "1 (152)", "1 (153)", "1 (154)", "1 (155)", "1 (156)", "1 (157)", "1 (158)", "1 (159)", "1 (160)", "1 (161)", "1 (162)", "1 (163)", "1 (164)", "1 (165)", "1 (166)", "1 (167)", "1 (168)", "1 (169)", "1 (170)", "1 (171)", "1 (172)", "1 (173)", "1 (174)", "1 (175)", "1 (176)", "1 (177)", "1 (178)", "1 (179)", "1 (180)", "1 (181)", "1 (182)", "1 (183)", "1 (184)", "1 (185)", "1 (186)", "1 (187)", "1 (188)", "1 (189)", "1 (190)", "1 (191)", "1 (192)", "1 (193)", "1 (194)", "1 (195)", "1 (196)", "1 (197)", "1 (198)", "1 (199)" } for i = 1, #BOX_STR do BOX_STR_SUBITEM[i] = ASET.GetSubItem(BOX_STR[i]) end local BOARD_SUBITEM = ASET.GetSubItem("Board") local SIZE = 0.03 --板サイズ --落ちてくるやつ表示用 local TET_COL = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } local TET_X = 4.5 --最下点x基準 local TET_Y = 18.5 --最下点y基準 local TET_COL_OLIGIN = 1 --落ちてくる色保持 local TEX_ANG = 1 --4方向 local GAME_TIME = os.clock() --時間保持 local ANG = 0 --物理的角度 --固定されたやつ表示用 local TET_COL_NOW = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } --固定されたやつ表示用 local HOZI_COL = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } local SPEED = 0.9 --これ秒で落ちる local FLG = false --落ちてる途中:false、引っかかった:true local GAMEOVER_FLG = false --ゲームオーバー --移動・回転関連 local RIGHT_FLG = false local LEFT_FLG = false local RIGHT_FLG_FLG = false local LEFT_FLG_FLG = false local RIGHT_TURN_FLG = false local LEFT_TURN_FLG = false local hosei = 0 local new_block_flg = true local POS = 0 local Posible = true local Mine = false local ERASER_FLG = false ---アイテムを生成したユーザーで毎フレーム呼ばれる function update() Mine = true if ERASER_FLG == false then ERASER_FLG = STAT.Get("ERASER_FLG") end if RIGHT_FLG == false then RIGHT_FLG = STAT.Get("RIGHT_FLG") end if LEFT_FLG == false then LEFT_FLG = STAT.Get("LEFT_FLG") end if RIGHT_TURN_FLG == false then RIGHT_TURN_FLG = STAT.Get("RIGHT_TURN_FLG") end if RIGHT_TURN_FLG == false then RIGHT_TURN_FLG = STAT.Get("RIGHT_TURN_FLG") end if ERASER_FLG then for i = 1, #TET_COL do TET_COL[i] = 0 TET_COL_NOW[i] = 0 STAT.Set("ERASER_FLG", ERASER_FLG) end end local OBJ = BOARD_SUBITEM POS = OBJ.GetPosition() ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end --時間当たり2マス移動可 if os.clock() - GAME_TIME > SPEED / 2 then if LEFT_FLG then TET_X = TET_X + 1 LEFT_FLG = false LEFT_FLG_FLG = true end if RIGHT_FLG then TET_X = TET_X - 1 RIGHT_FLG = false RIGHT_FLG_FLG = true end Posible = true end --時間当たり一マス落ちる if os.clock() - GAME_TIME > SPEED then TET_Y = TET_Y - 1 if LEFT_FLG then TET_X = TET_X + 1 LEFT_FLG = false LEFT_FLG_FLG = true STAT.Set("LEFT_FLG", LEFT_FLG) end if RIGHT_FLG then TET_X = TET_X - 1 RIGHT_FLG = false RIGHT_FLG_FLG = true STAT.Set("RIGHT_FLG", RIGHT_FLG) end GAME_TIME = os.clock() Posible = true end --回転等 if RIGHT_TURN_FLG then TEX_ANG = TEX_ANG - 1 if TEX_ANG < 1 then TEX_ANG = 4 end RIGHT_TURN_FLG = false Posible = true STAT.Set("RIGHT_TURN_FLG", RIGHT_TURN_FLG) end if LEFT_TURN_FLG then TEX_ANG = TEX_ANG + 1 if TEX_ANG > 4 then TEX_ANG = 1 end LEFT_TURN_FLG = false Posible = true STAT.Set("LEFT_TURN_FLG", LEFT_TURN_FLG) end --引っかかった if FLG then Posible = true --上部限界 if TET_Y + hosei > 16.5 then GAMEOVER_FLG = true else --落ちてるやつを固定に移動 for i = 1, #TET_COL do if TET_COL[i] > 0 then TET_COL_NOW[i] = TET_COL[i] TET_COL[i] = 0 end end --縦20回分 for i = 1, 20 do local f_flg = true --横に何個ブロックがあるか --横そろっているものがある間 while (f_flg) do f_flg = true local block_flg = true --そろっているならばtrue --ブロックないなら増やす for i2 = 1, 10 do if TET_COL_NOW[math.floor((i - 1) / 10) * 10 + i2] == 0 then block_flg = false f_flg = false break end end --そろっているならば、それより上の段を一つずつ下げる if block_flg then for i3 = i, 19 do for i4 = 1, 10 do TET_COL_NOW[(i3 - 1) * 10 + i4] = TET_COL_NOW[i3 * 10 + i4] end end i = 1 end end end end end --ゲームオーバーで初期化 if GAMEOVER_FLG then for i = 1, #TET_COL do TET_COL_NOW[i] = 0 TET_COL[i] = 0 end GAMEOVER_FLG = false Posible = true end --if Posible then Tet_Fall_Show() --end --落ちてくるやつ表示 --新ブロック生成 if new_block_flg then math.randomseed(os.clock()) TET_X = 4.5 TET_Y = 16.5 TET_COL_OLIGIN = math.ceil(math.random() * 6.99) TEX_ANG = 1 new_block_flg = false Posible = true end if Posible then Tet_Fall_Create() --落ちてくるやつ処理 Tet_Now_Show() Posible = false --固定のを表示 end RIGHT_FLG_FLG = false LEFT_FLG_FLG = false end local timer = 0 local timere_count = 0.4 ---全ユーザーで毎フレーム呼ばれる function updateAll() if (os.time() - timer) > timere_count then end --Tet_Now_Show() -- Tet_Fall_Show() -- ASET._ALL_SetMaterialColorFromIndex(4, Color.__new(1, 0, 0)) end function onTriggerEnter(item, hit) if item == "RightButton" then RIGHT_FLG = true STAT.Set("RIGHT_FLG", RIGHT_FLG) end if item == "LeftButton" then LEFT_FLG = true STAT.Set("LEFT_FLG", LEFT_FLG) end if item == "Right" then RIGHT_TURN_FLG = true STAT.Set("RIGHT_TURN_FLG", RIGHT_TURN_FLG) end if item == "Left" then LEFT_TURN_FLG = true STAT.Set("RIGHT_TURN_FLG", RIGHT_TURN_FLG) end end function onUse(use) --初期化用 if use == "Eraser" then ERASER_FLG = true STAT.Set("ERASER_FLG", ERASER_FLG) end end function onUngrab(target) Velo_Ang_Zero(target) end function onCollisionEnter(item, hit) if item == "RightButton" then RIGHT_FLG = true end if item == "LeftButton" then LEFT_FLG = true end if item == "Right" then RIGHT_TURN_FLG = true end if item == "Left" then LEFT_TURN_FLG = true end end function onCollisionExit(item, hit) Velo_Ang_Zero(item) end --角度と力0 function Velo_Ang_Zero(item) local OBJ = ASET.GetSubItem(item) if OBJ ~= nil then OBJ.SetVelocity(Vector3.__new(0, 0, 0)) OBJ.SetAngularVelocity(Vector3.__new(0, 0, 0)) ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end if item == "Board" then OBJ.SetRotation(Quaternion.Euler(0, ANG, 0)) end end end --固定のを表示 function Tet_Now_Show() --現在あるマス表示 for i = 1, 200 do --重なっていなければ if TET_COL[i] == 0 then local col_num = TET_COL_NOW[i] local offset = Vector2.zero local col = 0 if col_num == 1 then col = Color.__new(1, 0, 0, 1) offset.y = -(1 / 4) * 0 offset.x = (1 / 4) * 1 elseif col_num == 2 then col = Color.__new(0, 1, 0, 1) offset.y = -(1 / 4) * 0 offset.x = (1 / 4) * 2 elseif col_num == 3 then col = Color.__new(0, 0, 1, 1) offset.y = -(1 / 4) * 0 offset.x = (1 / 4) * 3 elseif col_num == 4 then col = Color.__new(1, 1, 0, 1) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 0 elseif col_num == 5 then col = Color.__new(1, 0, 1, 1) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 1 elseif col_num == 6 then col = Color.__new(0, 1, 1, 1) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 2 elseif col_num == 7 then col = Color.__new(0, 0, 0, 1) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 3 else col = Color.__new(1, 1, 1, 1) offset.y = -(1 / 4) * 3 offset.x = (1 / 4) * 3 end local OBJS = BOX_STR_SUBITEM[i] OBJS.SetPosition( Vector3.__new( POS.x - 0.000 * math.sin(2 * math.pi * ANG / 360) - ((-4.5 + (i - 1) % 10) * SIZE) * math.cos(2 * math.pi * ANG / 360), POS.y + (-9.1 + math.floor((i - 1) / 10)) * SIZE, POS.z - 0.000 * math.cos(2 * math.pi * ANG / 360) + ((-4.5 + (i - 1) % 10) * SIZE) * math.sin(2 * math.pi * ANG / 360) ) ) ASET._ALL_SetMaterialTextureOffsetFromIndex(i + 5, offset) --ASET.SetMaterialColorFromName(tostring(i), col) --ASET.SetMaterialColorFromIndex(4, col) OBJS.SetRotation(Quaternion.Euler(0, ANG + 180, 0)) HOZI_COL[i] = col_num end end end --落ちてくるやつ表示 function Tet_Fall_Show() new_block_flg = true --新しいブロック作成するか --落ちてくるマス表示 for i = 1, 200 do --落ちてるブロックがあれば、新しいブロック追加せず色変える local col_num = TET_COL[i] local offset = Vector2.zero local col = 0 if col_num == 1 then col = Color.__new(1, 0, 0) offset.y = -(1 / 4) * 0 offset.x = (1 / 4) * 1 new_block_flg = false elseif col_num == 2 then col = Color.__new(0, 1, 0) offset.y = -(1 / 4) * 0 offset.x = (1 / 4) * 2 new_block_flg = false elseif col_num == 3 then col = Color.__new(0, 0, 1) offset.y = -(1 / 4) * 0 offset.x = (1 / 4) * 3 new_block_flg = false elseif col_num == 4 then col = Color.__new(1, 1, 0) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 0 new_block_flg = false elseif col_num == 5 then col = Color.__new(1, 0, 1) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 1 new_block_flg = false elseif col_num == 6 then col = Color.__new(0, 1, 1) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 2 new_block_flg = false elseif col_num == 7 then col = Color.__new(0, 0, 0) offset.y = -(1 / 4) * 1 offset.x = (1 / 4) * 3 new_block_flg = false else col = Color.__new(1, 1, 1) offset.y = -(1 / 4) * 3 offset.x = (1 / 4) * 3 end --落ちてるのがあれば if col_num > 0 then local OBJS = BOX_STR_SUBITEM[i] OBJS.SetPosition( Vector3.__new( POS.x - 0.000 * math.sin(2 * math.pi * ANG / 360) - ((-4.5 + (i - 1) % 10) * SIZE) * math.cos(2 * math.pi * ANG / 360), POS.y + (-9.1 + math.floor((i - 1) / 10)) * SIZE, POS.z - 0.000 * math.cos(2 * math.pi * ANG / 360) + ((-4.5 + (i - 1) % 10) * SIZE) * math.sin(2 * math.pi * ANG / 360) ) ) ASET._ALL_SetMaterialTextureOffsetFromIndex(i + 5, offset) --ASET.SetMaterialColorFromName(tostring(i), col) --ASET.SetMaterialColorFromIndex(4, col) --ASET._ALL_SetMaterialColorFromIndex(i, col) OBJS.SetRotation(Quaternion.Euler(0, ANG + 180, 0)) HOZI_COL[i] = col_num end end end --落ちてくるやつ処理 function Tet_Fall_Create() --落ちる色初期化 for i = 1, #TET_COL do TET_COL[i] = 0 end FLG = false --引っかかっていない hosei = 0 --引っかかったときとかの補正 --最下点に達した if TET_Y < -0.5 then TET_Y = TET_Y + 1 hosei = 0 FLG = true end --色による形など条件別 if TET_COL_OLIGIN == 1 then if (TEX_ANG == 1) or (TEX_ANG == 3) then --左右ぶつかる if TET_X - 1 < 0.5 then TET_X = TET_X + 1 end if TET_X + 2 > 9.5 then TET_X = TET_X - 1 end --固定のとぶつかったか見る if TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X - 1)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X + 1)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X + 2)] > 0 then hosei = 1 FLG = true if LEFT_FLG_FLG then TET_X = TET_X - 1 FLG = false end if RIGHT_FLG_FLG then TET_X = TET_X + 1 FLG = false end end --色配置 TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X - 1)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X + 1)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X + 2)] = TET_COL_OLIGIN else if TET_X < 0.5 then TET_X = TET_X + 1 end if TET_X > 9.5 then TET_X = TET_X - 1 end if TET_COL_NOW[math.ceil(TET_Y + 3) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y + 2) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X)] > 0 then hosei = 1 FLG = true if LEFT_FLG_FLG then TET_X = TET_X - 1 FLG = false end if RIGHT_FLG_FLG then TET_X = TET_X + 1 FLG = false end end TET_COL[math.ceil(TET_Y + 3 + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + 2 + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + 1 + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN end elseif TET_COL_OLIGIN == 2 then if TET_X < 0.5 then TET_X = TET_X + 1 end if TET_X + 1 > 9.5 then TET_X = TET_X - 1 end if TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X + 1)] > 0 or TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X + 1)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X)] > 0 then hosei = 1 FLG = true if LEFT_FLG_FLG then TET_X = TET_X - 1 FLG = false end if RIGHT_FLG_FLG then TET_X = TET_X + 1 FLG = false end end TET_COL[math.ceil(TET_Y + 1 + hosei) * 10 + math.ceil(TET_X + 1)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + 1 + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X + 1)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN elseif TET_COL_OLIGIN == 3 then if (TEX_ANG == 1) or (TEX_ANG == 3) then if TET_X - 1 < 0.5 then TET_X = TET_X + 1 end if TET_X + 1 > 9.5 then TET_X = TET_X - 1 end if TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X - 1)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X + 1)] > 0 then hosei = 1 FLG = true if LEFT_FLG_FLG then TET_X = TET_X - 1 FLG = false end if RIGHT_FLG_FLG then TET_X = TET_X + 1 FLG = false end end TET_COL[math.ceil(TET_Y + 1 + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + 1 + hosei) * 10 + math.ceil(TET_X - 1)] = TET_COL_OLIGIN TET_COL[math.ceil(TET_Y + hosei) * 10 + math.ceil(TET_X + 1)] = TET_COL_OLIGIN else if TET_X - 1 < 0.5 then TET_X = TET_X + 1 end if TET_X > 9.5 then TET_X = TET_X - 1 end if TET_COL_NOW[math.ceil(TET_Y + 2) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X)] > 0 or TET_COL_NOW[math.ceil(TET_Y + 1) * 10 + math.ceil(TET_X - 1)] > 0 or TET_COL_NOW[math.ceil(TET_Y) * 10 + math.ceil(TET_X - 1)] > 0 then hosei = 1 FLG = true if LEFT_FLG_FLG then TET_X = TET_X - 1 FLG = false end if RIGHT_FLG_FLG then TET_X = TET_X + 1 FLG = false end end