Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
1547 lines (1417 sloc) 63.1 KB
/* Tetris for Algodoo 2.1.0
Created by @tatt61880
Last Modified: 2018/02/11 06:13:41.
*/
Scene.my.DEBUG_MODE := false;
// Game Setting {{{1
Scene.my.INITIAL_UEHARA_MODE := true;
Scene.my.INITIAL_CIRCLE_MODE := false;
Scene.my.INITIAL_SOUNDEFFECT := false;
Scene.my.ueharaMode = Scene.my.INITIAL_UEHARA_MODE;
Scene.my.circleMode = Scene.my.INITIAL_CIRCLE_MODE;
Scene.my.soundEffect = Scene.my.INITIAL_SOUNDEFFECT;
Scene.my.LINE_PER_LEVEL := 3;
Scene.my.ROTATE_CCW_KEY := "q";
Scene.my.ROTATE_STOP_KEY := "toggle w";
Scene.my.ROTATE_CW_KEY := "e";
Scene.my.CCW_KEY := "a";
Scene.my.TURN_KEY := "s";
Scene.my.CW_KEY := "d";
Scene.my.UE_KEY := "up";
//}}}1
// CollideSet {{{1
Scene.my.COLLIDESET_NONE := 0x00; // None
Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK := 0x01;
Scene.my.COLLIDESET_FOR_CONTROLLER := 0x02;
Scene.my.COLLIDESET_FOR_KILLERPLANE := 0x04;
Scene.my.COLLIDESET_FOR_KEYS := 0x08; // for key bind
Scene.my.COLLIDESET_FOR_UE_KILLER := 0x10; // for killer item
Scene.my.COLLIDESET_FOR_SWITCH := 0x20;
Scene.my.COLLIDESET_GAMEOVER := 0x40;
Scene.my.COLLIDESET_FOR_WALL := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK + Scene.my.COLLIDESET_FOR_KILLERPLANE;
Scene.my.COLLIDESET_FOR_DELETELINE := Scene.my.COLLIDESET_FOR_UE_KILLER + Scene.my.COLLIDESET_FOR_KILLERPLANE;
Scene.my.COLLIDESET_FOR_INACTIVE_BLOCK := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK + Scene.my.COLLIDESET_FOR_UE_KILLER;
//}}}1
// Colors {{{1
Scene.my.COLOR_FOR_FIXJOINT := [ 1, 1, 1, 1];
Scene.my.COLOR_FOR_CONTROLLER := [1.0, 1.0, 1.0, 0.0];
Scene.my.COLOR_FOR_CONTRALLHINGE := [0.3, 0.0, 0.7, 1.0];
Scene.my.COLOR_FOR_LASERPEN := [0.1, 0, 0, 0];
Scene.my.COLOR_FOR_SKY := [ 0, 0, 0, 1.0];
Scene.my.COLOR_FOR_WALL := [0.2, 0.2, 0.2, 1.0];
Scene.my.COLOR_FOR_HIDDEN_KILLER1 := [ 0, 0, 0, 0.2];
Scene.my.COLOR_FOR_HIDDEN_KILLER2 := [1.0, 0, 0, 1.0];
Scene.my.COLOR_FOR_STARTBALL := [ 1, 0, 0, 1];
Scene.my.COLOR_FOR_STARTBOARD := [ 1, 0, 0, 1];
Scene.my.COLOR_FOR_DELETELINE := [ 1, 0, 0, 1];
Scene.my.COLOR_FOR_CHECKLINE := [ 0, 0, 0.25, 1];
//}}}1
// math functions related {{{1
Scene.my.abs := (x)=>{x > 0 ? {x} : {- x}};
Scene.my.srand := (rand_seed)=>{Scene.my.rand__ = rand_seed};
Scene.my.rand__ := 61880;
Scene.my.rand := {
Scene.my.rand__ = (Scene.my.rand__ * 1357924681 + 13579) % 100000;
(Scene.my.rand__ / 65536) % 32768
};
//}}}1
// Variables {{{1
Scene.my.TETRIS_TYPE_NUM := 7;
Scene.my.UE_KILLER_INTERVAL_TICK := 100;
Scene.my.TEXT_FOR_STARTBOARD := "START";
Scene.my.MATERIALNAME_FOR_STARTBOARD := "START_BOARD";
Scene.my.MATERIALNAME_FOR_CHECK_BALL := "CHECK_BALL";
Scene.my.MATERIALNAME_FOR_ACTIVE_BLOCK := "ACTIVE_BLOCK";
Scene.my.BLOCK_ONCOLLIDE := (e)=>{
(Scene.my.isGameover) ? {
e.this.collideSet = Scene.my.COLLIDESET_GAMEOVER;
e.this.collideWater = false;
} : {
(Sim.tick < Scene.my.gameoverTick) ? {
(e.other + "" != "circle" || e.other.density > 0.1) ? {
print("Gameover (Collided geometry = " + e.other +
" ; density = " + e.other.density +
" ; color = " + e.other.color +
" ; materialName = \"" + e.other.materialName + "\"" +
" ; texture = \"" + e.other.texture + "\")");
Scene.my.Gameover;
} : {}
} : {}
};
};
Scene.my.count := 1;
Scene.my.i := 0;
Scene.my.posY0 := 100;
Scene.my.posY1 := 100;
Scene.my.posY2 := 100;
Scene.my.posY3 := 100;
Scene.my.posY4 := 100;
Scene.my.getPosY := (i__)=>{
i__ == 0 ? {
Scene.my.posY0;
} : {
i__ == 1 ? {
Scene.my.posY1;
} : {
i__ == 2 ? {
Scene.my.posY2;
} : {
i__ == 3 ? {
Scene.my.posY3;
} : {
Scene.my.posY4;
}}}}
};
Scene.my.setPosY := (i__, posY__)=>{
i__ == 0 ? {
Scene.my.posY0 = posY__;
} : {
i__ == 1 ? {
Scene.my.posY1 = posY__;
} : {
i__ == 2 ? {
Scene.my.posY2 = posY__;
} : {
i__ == 3 ? {
Scene.my.posY3 = posY__;
} : {
Scene.my.posY4 = posY__;
}}}}
};
Scene.my.currentPosY := 10;
Scene.my.checkTick := 0;
Scene.my.gameoverTick := 0;
Scene.my.isGameover := false;
Scene.my.stealth_flag := false;
Scene.my.INITIAL_UE_KILLER_STOCK := 3;
Scene.my.INITIAL_GAME_SCORE := 0;
Scene.my.INITIAL_GAME_LEVEL := 1;
Scene.my.INITIAL_GRAVITY_STRENGTH := 9.8;
Scene.my.INITIAL_DELETED_LINE_NUM := 0;
Scene.my.ueKillerStockText := "";
Scene.my.nextCheckTick := 0;
Scene.my.checkLineCol := 0;
Scene.my.deletedLineNum := Scene.my.INITIAL_DELETED_LINE_NUM;
Scene.my.ueKillerStock := Scene.my.INITIAL_UE_KILLER_STOCK;
Scene.my.gameScore := Scene.my.INITIAL_GAME_SCORE;
Scene.my.gameHighScore := 0;
Scene.my.gameLevel := Scene.my.INITIAL_GAME_LEVEL;
Sim.gravityStrength = Scene.my.INITIAL_GRAVITY_STRENGTH;
Scene.my.ID_forNextTetris := 0;
Scene.my.numBlockAtLine := 0;
Scene.my.bendTarget := 0;
/* Temp */
Scene.my.nextTetris := "temp";
Scene.my.nextTetrisColor := [1, 0, 0, 1];
Scene.my.nextTetrisText := "";
Scene.my.nextTetrisTextScale := 1;
//}}}1
// Actions {{{1
Scene.my.playSound_count := 0;
Scene.my.playSound_count = Scene.my.playSound_count + 1;
Scene.my.playSound := (basename)=>{
Scene.my.soundEffect ? {
System.WriteToFile("AMS\\" + Sim.time + "_" + Scene.my.playSound_count + ".out", Sim.time + "\nsndplay\n" + "c:\\my_sounds\\" + basename + "\n");
} : {
}
};
// On step {{{2
Scene.my.onStep := ()=>{
( !Scene.my.isGameover && Sim.tick >= Scene.my.nextCheckTick) ? {
Scene.my.nextCheckTick = Sim.tick + 2;
Scene.my.checkLineCol = (Scene.my.checkLineCol + 15) % 16;
Scene.my.CheckLine;
} : {};
};
//}}}2
// Delete line{{{2
Scene.my.LevelUP := ()=> {
Scene.my.playSound("levelup.wav");
Scene.my.gameLevel = Scene.my.gameLevel + 1;
Sim.gravityStrength = (Sim.gravityStrength * 1.1 > 100) ? {100} : {Sim.gravityStrength * 1.1};
Scene.my.gameLevel >= 10 ? {Scene.my.circleMode = !Scene.my.circleMode} : {}; // レベルアップ毎に自動でモード変更
};
Scene.my.DeleteLine := (col__)=>{
Scene.my.isGameover ? {} : {
Scene.my.playSound("1line.wav");
Scene.addBox{
pos := [0, col__ - 15.5];
size := [20, 0.1];
color := Scene.my.COLOR_FOR_DELETELINE;
text := "killerBox";
density := Sim.airDensity;
collideSet := eval("{ Sim.tick > " + Sim.tick + " ? { Scene.my.COLLIDESET_FOR_DELETELINE } : {0} }");
onCollide := (e)=>{
e.other.materialName == "UEHARA_BALL" ? {
Scene.RemoveEntity(e.other);
Scene.my.SetUeKillerStock(Scene.my.ueKillerStock + 1);
} : {}
};
immortal := false;
killer := true;
};
print("deleted" + col__ + " (tick = " + Sim.tick + ")");
Scene.my.SetGameScore(Scene.my.gameScore + 1000);
Scene.my.deletedLineNum = Scene.my.deletedLineNum + 1;
(Scene.my.deletedLineNum % Scene.my.LINE_PER_LEVEL == 0) ? {Scene.my.LevelUP} : {};
}
};
//}}}2
Scene.my.topIndex_forCheckLine := 15;
Scene.addLaserPen { // to get topIndex_forCheckLine
color := [0.1, 0, 0, 1];
pos := [3.5, -4];
maxRays := 1;
collideSet := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK;
collideWater := false;
onLaserHit := (e)=>{
Scene.my.topIndex_forCheckLine = - e.pos(1) - 0.5;
};
fadeDist := 20;
size := 0.001;
rotation := - math.pi/2;
};
Scene.my.uekillerflag := false;
// Check line {{{2
Scene.my.CheckLine := ()=>{
Scene.my.tick = Scene.my.lastTick7;
Scene.my.tick >= Sim.tick - 1 ? {
Scene.my.lastTick0 == Scene.my.tick ? {
Scene.my.lastTick5 == Scene.my.tick ? {
Scene.my.lastTick3 == Scene.my.tick ? {
Scene.my.lastTick6 == Scene.my.tick ? {
Scene.my.lastTick1 == Scene.my.tick ? {
Scene.my.lastTick4 == Scene.my.tick ? {
Scene.my.lastTick2 == Scene.my.tick ? {
Scene.my.DeleteLine(Scene.my.lastCheckCol);
} : {}
} : {}
} : {}
} : {}
} : {}
} : {}
} : {}
} : {
}
};
for(8, (row)=>{
Scene.addCircle{
materialName := Scene.my.MATERIALNAME_FOR_CHECK_BALL;
radius := Scene.my.DEBUG_MODE ? {0.3} : {0.03};
density := 0.01;
color := Scene.my.COLOR_FOR_CHECKLINE;
drawCake := false;
inertiaMultiplier := +inf;
pos := eval("{[" + (row - 3.5) + ", Scene.my.checkLineCol - 15.5]}");
immortal := true;
collideSet := 1;
onCollide := eval(@"
(e)=>{
e.other.materialName != Scene.my.MATERIALNAME_FOR_ACTIVE_BLOCK ? {
e.other.collideSet == Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK ? {
e.other.collideSet = Scene.my.COLLIDESET_FOR_INACTIVE_BLOCK;
} : {};
"
+ "Scene.my.lastTick" + row + " = Sim.tick;" +
(row == 0 ? {"Scene.my.lastCheckCol = pos(1) + 15.5;"} : {""}) +
"} : {}" +
"}";
);
};
eval("Scene.my.lastTick" + row + " := 0;");
});
Scene.my.lastCheckCol := 0;
//}}}2
// Gameover {{{2
Scene.my.Gameover := ()=>{
Scene.my.isGameover ? {} : {
Scene.my.isGameover = true;
Scene.my.nextTetrisColor = [1, 1, 1, 1];
Scene.my.nextTetrisText = "GAME\nOVER";
Scene.my.nextTetrisTextScale = 2.0;
Scene.my.playSound("gameover.wav");
//App.GUI.ShowMessage("GAMEOVER");
print ("==== GAMEOVER ====");
}
};
//}}}2
Scene.my.SetNextTetris := (id__)=>{
Scene.my.nextTetrisColor = Scene.my.nextTetrisColors(id__);
Scene.my.nextTetrisText = Scene.my.nextTetrisTexts(id__);
Scene.my.nextTetrisTextScale = Scene.my.nextTetrisTextScales(id__);
Scene.my.nextTetris = Scene.my.nextTetrises(id__);
};
Scene.my.UpdateNextTetris := ()=>{
Scene.my.ID_forNextTetris = (Scene.my.abs(Scene.my.rand + math.toInt(System.time * 61880))) % Scene.my.TETRIS_TYPE_NUM;
Scene.my.ueharaMode ? {
(Scene.my.count % 20 == 0) ? {Scene.my.stealth_flag = false; Scene.my.ID_forNextTetris = 9} : { // uehara ball
(Scene.my.count % 51 == 0) ? {Scene.my.stealth_flag = false; Scene.my.ID_forNextTetris = 10} : { // Tracer
(Scene.my.count % 12 == 0) ? {Scene.my.stealth_flag = false; Scene.my.ID_forNextTetris = 7} : { // UE
(Scene.my.count % 49 == 0) ? {Scene.my.stealth_flag = false; Scene.my.ID_forNextTetris = 8} : { // HARA
};
};
};
};
} : {};
Scene.my.SetNextTetris(Scene.my.ID_forNextTetris);
};
Scene.my.SetUeKillerStock := (stock__)=>{
Scene.my.ueKillerStock = stock__;
Scene.my.ueKillerStockText = stock__ == 0 ? {""} : {
stock__ == 1 ? {"●"} : {
stock__ == 2 ? {"●●"} : {
stock__ == 3 ? {"●●●"} : {
"● x " + Scene.my.ueKillerStock;
}
}
}
}
};
Scene.my.SetGameScore := (score__)=>{
Scene.my.isGameover ? {
// Do nothing.
} : {
Scene.my.gameScore = score__;
score__ > Scene.my.gameHighScore ? {Scene.my.gameHighScore = score__} : {};
}
};
// Next {{{2
Scene.my.Next := ()=>{
Scene.my.playSound("land.wav");
Scene.my.count = Scene.my.count + 1;
Scene.my.posY0 = 100;
Scene.my.posY1 = 100;
Scene.my.posY2 = 100;
Scene.my.posY3 = 100;
Scene.my.posY4 = 100;
Scene.my.currentPosY = 10;
Scene.my.gameoverTick = Sim.tick + 10;
Scene.my.bendTarget = 0;
Scene.my.stealth_flag = (
Scene.my.ueharaMode
&& (Scene.my.abs(Scene.my.rand + math.toInt(System.time * 61880))) % 40 == 0
&& Scene.my.gameLevel >= 2
) ? {true} : {false};
print("tetrisID: " + Scene.my.ID_forNextTetris);
Scene.my.DEBUG_MODE ? { Scene.my.TETRIS_TEST } : {eval(Scene.my.nextTetris)};
Scene.my.UpdateNextTetris;
};
//}}}2
//}}}1
// Objects template {{{1
{
// Surfaces {{{2
Scene.my.UE_SURFACES := [[[2.2326, -1.6377], [2.2500, -1.6370], [2.3826, -1.6606], [2.4093, -1.6638], [2.6130, -1.7015], [2.7342, -1.7007], [2.8220, -1.6835], [2.8738, -1.6678], [2.9207, -1.6417], [2.9397, -1.6250], [2.9892, -1.5367], [2.9900, -1.4736], [2.9695, -1.4359], [2.9489, -1.4061], [2.9475, -1.3884], [2.9227, -1.3697], [2.9024, -1.3435], [2.8285, -1.2942], [2.3727, -1.1059], [2.3338, -1.0917], [2.2789, -1.0669], [2.2727, -1.0669], [2.2079, -1.0437], [2.1024, -1.0357], [2.0925, -1.0290], [2.0032, -1.0321], [1.6973, -1.0914], [1.3914, -1.1508], [1.3667, -1.1466], [0.9708, -1.1467], [0.5749, -1.1469], [0.1790, -1.1470], [0.1544, -1.1442], [0.1544, -0.6638], [0.1544, -0.1835], [0.1544, 0.2969], [0.1544, 0.7773], [0.1544, 1.2576], [0.2020, 1.2296], [0.2128, 1.2201], [0.3667, 1.1392], [0.4719, 1.1380], [0.4770, 1.1404], [0.6527, 1.1405], [0.8281, 1.1681], [1.1508, 1.2316], [1.2410, 1.2656], [1.5053, 1.3305], [1.7253, 1.4176], [1.8077, 1.4991], [1.8326, 1.5359], [1.8387, 1.6008], [1.8316, 1.6415], [1.8149, 1.6702], [1.7584, 1.7460], [1.7221, 1.7633], [1.6980, 1.7774], [1.6306, 1.8245], [1.5419, 1.8474], [1.4770, 1.8543], [1.3256, 1.8544], [1.2427, 1.8353], [1.1101, 1.7878], [1.0309, 1.7506], [0.8714, 1.6866], [0.7541, 1.6536], [0.6355, 1.6263], [0.5378, 1.6143], [0.2309, 1.6142], [0.1970, 1.6152], [0.1580, 1.6380], [0.1500, 1.6742], [0.1499, 2.0378], [0.1499, 2.4014], [0.1499, 2.7650], [0.1698, 2.8152], [0.2229, 2.9045], [0.2756, 3.0139], [0.2700, 3.0806], [0.1877, 3.2068], [0.1328, 3.2542], [0.0272, 3.3341], [-0.1122, 3.4051], [-0.1442, 3.4185], [-0.2241, 3.4468], [-0.2433, 3.4573], [-0.3488, 3.4933], [-0.4622, 3.5011], [-0.5987, 3.4743], [-0.6532, 3.4547], [-0.7043, 3.3957], [-0.7119, 3.3623], [-0.6972, 3.3078], [-0.6762, 3.2642], [-0.6468, 3.2419], [-0.6335, 3.2215], [-0.6095, 3.2048], [-0.5664, 3.1544], [-0.4947, 3.1004], [-0.4638, 3.0851], [-0.4542, 3.0738], [-0.4066, 3.0413], [-0.3992, 3.0304], [-0.3955, 3.0010], [-0.3955, 2.4819], [-0.3955, 1.9628], [-0.3955, 1.4437], [-0.3955, 0.9246], [-0.3955, 0.4055], [-0.3955, -0.1135], [-0.3955, -0.6326], [-0.3955, -1.1517], [-0.3956, -1.1761], [-0.4004, -1.1983], [-0.4240, -1.2214], [-0.4524, -1.2270], [-0.4812, -1.2291], [-0.5545, -1.2389], [-0.5682, -1.2463], [-0.7257, -1.2544], [-1.1698, -1.3073], [-1.6139, -1.3602], [-2.0579, -1.4131], [-2.0944, -1.4172], [-2.3525, -1.4270], [-2.3608, -1.4255], [-2.7310, -1.4264], [-3.1728, -1.2491], [-3.1960, -1.2480], [-3.2005, -1.2417], [-3.2547, -1.2344], [-3.3076, -1.2639], [-3.3271, -1.2886], [-3.3505, -1.3052], [-3.3544, -1.3313], [-3.3527, -1.3954], [-3.3297, -1.4434], [-3.3142, -1.4669], [-3.0148, -1.7726], [-2.7468, -2.0016], [-2.6419, -2.0501], [-2.5973, -2.0627], [-2.5100, -2.0653], [-2.4862, -2.0550], [-2.4588, -2.0249], [-2.4299, -2.0113], [-2.0833, -1.9162], [-1.7367, -1.8212], [-1.7315, -1.8212], [-1.6281, -1.7963], [-1.6180, -1.7887], [-1.5944, -1.7822], [-1.5681, -1.7820], [-1.3371, -1.7270], [-1.3339, -1.7255], [-1.0339, -1.6923], [-0.7340, -1.6592], [-0.3423, -1.6206], [-0.3363, -1.6219], [0.1535, -1.6216], [0.6434, -1.6213], [1.1332, -1.6210], [1.6231, -1.6207], [2.1129, -1.6204]]];
Scene.my.HARA_SURFACES1 := [[[-0.40236044, -0.56783628], [-0.39838052, -0.56933594], [-0.38811052, -0.57142591], [-0.37723053, -0.57178593], [-0.37129045, -0.57067585], [-0.36691046, -0.56809616], [-0.36529052, -0.56536627], [-0.35483050, -0.51136589], [-0.34554052, -0.45713615], [-0.33742046, -0.40265608], [-0.33048046, -0.34793615], [-0.32471049, -0.29297590], [-0.32012045, -0.23776627], [-0.31670046, -0.18232584], [-0.31445050, -0.12663603], [-0.31217551, -0.070861340], [-0.30990052, -0.015086174], [-0.30637550, 0.040618896], [-0.30285048, 0.096323967], [-0.29808557, 0.15195894], [-0.29332054, 0.20759392], [-0.28731048, 0.26315928], [-0.28130054, 0.31872416], [-0.21344650, 0.31872416], [-0.14559257, 0.31872416], [-0.077738404, 0.31872416], [-0.0098844767, 0.31872416], [0.057969451, 0.31872416], [0.054889560, 0.25160408], [0.053799510, 0.22979403], [0.052739501, 0.21598387], [0.051239491, 0.20200396], [0.049129486, 0.18721390], [0.038629532, 0.18719387], [-0.0019204617, 0.18661404], [-0.050820470, 0.18492413], [-0.11001050, 0.18169403], [-0.11947048, 0.18134403], [-0.12807047, 0.18071413], [-0.13585055, 0.17971373], [-0.14285052, 0.17823410], [-0.14910054, 0.17620373], [-0.15463054, 0.17351389], [-0.15948045, 0.17009401], [-0.16370046, 0.16583395], [-0.16730046, 0.16066408], [-0.17034054, 0.15447378], [-0.17283046, 0.14719391], [-0.17483044, 0.13871384], [-0.17636049, 0.12895393], [-0.17747045, 0.11781406], [-0.17817044, 0.10522413], [-0.17853045, 0.091073990], [-0.17931044, 0.036484241], [-0.18009055, -0.018105984], [-0.18087053, -0.072696209], [-0.18301547, -0.13945103], [-0.18516052, -0.20620584], [-0.18390048, -0.21125603], [-0.18136048, -0.21571589], [-0.17770052, -0.21954584], [-0.17306054, -0.22268629], [-0.16758049, -0.22506618], [-0.16141045, -0.22665596], [-0.15470052, -0.22738600], [-0.14758050, -0.22719622], [-0.14080048, -0.22488594], [-0.13540053, -0.22116613], [-0.13105047, -0.21611595], [-0.12636054, -0.20743608], [-0.12327051, -0.19957590], [-0.059173822, -0.19736576], [0.0049229860, -0.19515562], [0.069019556, -0.19294596], [0.070264459, -0.24836588], [0.071509480, -0.30378628], [0.073626041, -0.36445570], [0.075742841, -0.42512608], [0.077859521, -0.48579597], [0.065939546, -0.48653603], [0.052909493, -0.48649597], [0.036499500, -0.48516607], [0.027299523, -0.48360586], [-0.00017046928, -0.47729588], [-0.013230443, -0.47467613], [-0.024100542, -0.47347593], [-0.029470444, -0.47384596], [-0.032900453, -0.47544622], [-0.038330436, -0.48176622], [-0.041780472, -0.48914623], [-0.043310523, -0.49756622], [-0.042610526, -0.51133585], [-0.040250540, -0.51826620], [-0.036010504, -0.52275610], [-0.024760485, -0.52882624], [-0.010810494, -0.53500605], [0.0036995411, -0.53994608], [0.018749475, -0.54363585], [0.028719544, -0.54561615], [0.055809498, -0.55219603], [0.070229530, -0.55519629], [0.077479482, -0.55631590], [0.084689498, -0.55706596], [0.091809511, -0.55734587], [0.098789454, -0.55708599], [0.10557950, -0.55617619], [0.11212945, -0.55453587], [0.11837947, -0.55208588], [0.12428951, -0.54872608], [0.12979949, -0.54436588], [0.13485956, -0.53713608], [0.13837945, -0.52958584], [0.14057946, -0.52169609], [0.14168954, -0.51346588], [0.14193952, -0.50488615], [0.14117956, -0.49133587], [0.13974953, -0.47695589], [0.13688457, -0.39888096], [0.13401949, -0.32080603], [0.13285947, -0.24731588], [0.13311946, -0.19294596], [0.17985451, -0.19054604], [0.22658956, -0.18814611], [0.24903953, -0.18761587], [0.26010954, -0.18768597], [0.27119958, -0.18802595], [0.28242958, -0.18868589], [0.29390943, -0.18968582], [0.30574954, -0.19106627], [0.31804955, -0.19287586], [0.33092940, -0.19515610], [0.38839948, -0.19294596], [0.39510953, -0.18417597], [0.39946949, -0.17150593], [0.40176952, -0.15541601], [0.40228951, -0.13635588], [0.40128958, -0.11480618], [0.39906943, -0.091216087], [0.38732445, -0.012145996], [0.37557948, 0.066924095], [0.37257946, 0.091703892], [0.37057960, 0.11480379], [0.36985958, 0.13574409], [0.37068951, 0.15515375], [0.36860955, 0.16330385], [0.36407959, 0.16953373], [0.35297954, 0.17475414], [0.34120953, 0.17880392], [0.32878959, 0.18169403], [0.31569946, 0.18341398], [0.30194962, 0.18397379], [0.27891958, 0.18372393], [0.26330960, 0.18391371], [0.20075953, 0.18659401], [0.15698946, 0.18800879], [0.11321950, 0.18942404], [0.11388946, 0.21274376], [0.11510956, 0.23659372], [0.11744952, 0.26906395], [0.12205946, 0.31872416], [0.20135939, 0.31880760], [0.28065956, 0.31889105], [0.35995948, 0.31897402], [0.43922961, 0.32093382], [0.44760954, 0.32633400], [0.45434940, 0.33278418], [0.45808947, 0.33871412], [0.46051943, 0.34587383], [0.46132958, 0.35146379], [0.46104944, 0.35915375], [0.45944941, 0.36618376], [0.45727956, 0.37051392], [0.45394957, 0.37456417], [0.44924939, 0.37832403], [0.44294941, 0.38181400], [0.43480957, 0.38503408], [0.36603463, 0.38369894], [0.29725945, 0.38236380], [0.21699440, 0.38254118], [0.13672948, 0.38271856], [0.056464434, 0.38289595], [-0.023800492, 0.38307381], [-0.092595577, 0.38301134], [-0.16139042, 0.38294888], [-0.23018539, 0.38288641], [-0.29898047, 0.38282394], [-0.30951047, 0.38295412], [-0.31586051, 0.38212395], [-0.32248044, 0.38027382], [-0.32870054, 0.37706375], [-0.33144045, 0.37483406], [-0.33381045, 0.37213373], [-0.33574045, 0.36891413], [-0.33714044, 0.36513376], [-0.34215045, 0.33789396], [-0.35078049, 0.28322411], [-0.35775054, 0.22831392], [-0.36328053, 0.17316389], [-0.36760044, 0.11777401], [-0.36994541, 0.075998783], [-0.37229049, 0.034224033], [-0.37431550, -0.021895885], [-0.37634051, -0.078016281], [-0.37727046, -0.10617590], [-0.37929046, -0.14835119], [-0.38131046, -0.19052601], [-0.38426554, -0.23258114], [-0.38722050, -0.27463627], [-0.39110553, -0.31657648], [-0.39499044, -0.35851622], [-0.39980543, -0.40034103], [-0.40462053, -0.44216585], [-0.41037047, -0.48387098], [-0.41612053, -0.52557611], [-0.41699052, -0.53647614], [-0.41704047, -0.54351616], [-0.41628051, -0.55017614], [-0.41437054, -0.55627584], [-0.41097045, -0.56161594], [-0.40575051, -0.56603622]], [[0.33534944, -0.12884617], [0.30735958, -0.12728596], [0.27950943, -0.12627602], [0.22401941, -0.12570620], [0.15258682, -0.12798357], [0.081154466, -0.13026094], [0.0097221136, -0.13253832], [-0.061710477, -0.13481617], [-0.12327051, -0.13547611], [-0.12106049, -0.092376232], [-0.11885047, -0.049275875], [-0.090150476, -0.045206070], [-0.034550548, -0.038755894], [0.019329548, -0.034316063], [0.072259545, -0.031576157], [0.12502956, -0.030196190], [0.17842948, -0.029876232], [0.24915445, -0.030736446], [0.31987941, -0.031596184], [0.32932961, -0.080036163], [0.33144939, -0.092206001], [0.33396947, -0.11049604], [0.33503950, -0.12272596]], [[0.30744946, 0.098983765], [0.30837953, 0.088943958], [0.30955946, 0.078794003], [0.31545961, 0.036923885], [0.31324947, 0.034713745], [0.25564945, 0.035953999], [0.20185959, 0.036183834], [0.15051949, 0.035453796], [0.10027945, 0.033813953], [0.024049520, 0.029764175], [-0.046295524, 0.024499416], [-0.11664045, 0.019234180], [-0.11443055, 0.067859173], [-0.11222053, 0.11648417], [-0.063640475, 0.11998415], [-0.013160467, 0.12217379], [0.038809538, 0.12326384], [0.11864948, 0.12322378], [0.18130600, 0.12171412], [0.24396288, 0.12020397], [0.30661952, 0.11869383], [0.30683959, 0.10889387]]];
Scene.my.HARA_SURFACES2 := [[[-0.094115973, -0.10900164], [-0.090605974, -0.11166191], [-0.088745952, -0.11300182], [-0.086815953, -0.11432171], [-0.084836006, -0.11559153], [-0.082826018, -0.11677170], [-0.080785990, -0.11784172], [-0.078735948, -0.11877155], [-0.076676011, -0.11954165], [-0.074625969, -0.12011194], [-0.072605968, -0.12045193], [-0.070605993, -0.12055159], [-0.068655968, -0.12036180], [-0.066756010, -0.11987162], [-0.064926028, -0.11904192], [-0.063176036, -0.11784172], [-0.052196026, -0.10662174], [-0.041216016, -0.095401764], [-0.030370951, -0.083831787], [-0.019526005, -0.072261810], [-0.0088210106, -0.060347080], [0.0018839836, -0.048431873], [0.012454033, -0.036171913], [0.023023963, -0.023911953], [0.031700611, -0.013551712], [0.040377378, -0.0031919479], [0.049054027, 0.0071682930], [0.060204029, 0.020843983], [0.071354032, 0.034519672], [0.082504034, 0.048196316], [0.093654037, 0.061872005], [0.10480404, 0.075548172], [0.10596406, 0.077408314], [0.10678399, 0.079368114], [0.10728395, 0.081408024], [0.10748398, 0.083498478], [0.10741401, 0.085638046], [0.10709405, 0.087808132], [0.10655403, 0.089968204], [0.10582399, 0.092118263], [0.10491395, 0.094238281], [0.10386395, 0.096298218], [0.10270405, 0.098288059], [0.10143399, 0.10018826], [0.10010397, 0.10197830], [0.098734021, 0.10363817], [0.097344041, 0.10514832], [0.095963955, 0.10648823], [0.091624022, 0.10969830], [0.087614059, 0.11239815], [0.083914042, 0.11461830], [0.080494046, 0.11639833], [0.077363968, 0.11774826], [0.074483991, 0.11871815], [0.071843982, 0.11931849], [0.069424033, 0.11958838], [0.067224026, 0.11954832], [0.065204024, 0.11922836], [0.063364029, 0.11866808], [0.061673999, 0.11788845], [0.060134053, 0.11690807], [0.058714032, 0.11576843], [0.057404041, 0.11449814], [0.056174040, 0.11311817], [0.044649839, 0.10009384], [0.033125401, 0.087069511], [0.021601081, 0.074045658], [0.010076880, 0.061021328], [-0.0014474392, 0.047996998], [-0.012971759, 0.034972668], [-0.024495959, 0.021948338], [-0.029595971, 0.016078472], [-0.042145967, 0.0012831688], [-0.054695964, -0.013511658], [-0.066926003, -0.028461933], [-0.079156041, -0.043411732], [-0.091055989, -0.058526516], [-0.10295594, -0.073641777], [-0.10412598, -0.075631618], [-0.10501599, -0.077721596], [-0.10564601, -0.079871655], [-0.10602593, -0.082101822], [-0.10616601, -0.084371567], [-0.10606599, -0.086681843], [-0.10574603, -0.089011669], [-0.10520601, -0.091361523], [-0.10445595, -0.093701839], [-0.10351598, -0.096031666], [-0.10237598, -0.098341942], [-0.10105598, -0.10060167], [-0.099555969, -0.10281181], [-0.097895980, -0.10496187], [-0.096086025, -0.10703182]]];
Scene.my.HARA_SURFACES3 := [[[0.053641319, -0.098957539], [0.054931164, -0.10002756], [0.056491137, -0.10083771], [0.058291197, -0.10139751], [0.060291290, -0.10172749], [0.062471151, -0.10181761], [0.064791203, -0.10169744], [0.067231178, -0.10135746], [0.069741249, -0.10081768], [0.072311163, -0.10007763], [0.074891329, -0.099147797], [0.077461243, -0.098037720], [0.079981327, -0.096767426], [0.082431316, -0.095327377], [0.084771156, -0.093727589], [0.086971283, -0.091987610], [0.089001179, -0.090117455], [0.090571165, -0.088377476], [0.092051268, -0.086527348], [0.093461275, -0.084587574], [0.094761133, -0.082567692], [0.095951319, -0.080497742], [0.097011328, -0.078387737], [0.097931147, -0.076257706], [0.098701239, -0.074117661], [0.099311113, -0.071997643], [0.099741220, -0.069917679], [0.099981308, -0.067887783], [0.10001111, -0.065927505], [0.099831104, -0.064057350], [0.099411249, -0.062297344], [0.098761320, -0.060667515], [0.097841263, -0.059177399], [0.089951277, -0.048717499], [0.081751108, -0.038347721], [0.073241234, -0.028067589], [0.064411163, -0.017867565], [0.055281162, -0.0077576637], [0.045831203, 0.0022625923], [0.036081314, 0.012202263], [0.026011229, 0.022052288], [0.015858650, 0.031617165], [0.0057063103, 0.041182518], [-0.0044462681, 0.050747395], [-0.014598846, 0.060312271], [-0.024613857, 0.069395065], [-0.034628868, 0.078477383], [-0.044643879, 0.087559700], [-0.054658890, 0.096642494], [-0.056228876, 0.097662449], [-0.057998896, 0.098442554], [-0.059948683, 0.098982334], [-0.062048674, 0.099312305], [-0.064278841, 0.099412441], [-0.066608667, 0.099302292], [-0.069028854, 0.098982334], [-0.071498871, 0.098462582], [-0.074008703, 0.097752571], [-0.076528788, 0.096842289], [-0.079038858, 0.095762253], [-0.081508875, 0.094492435], [-0.083918810, 0.093062401], [-0.086258888, 0.091472626], [-0.088478804, 0.089712620], [-0.090578794, 0.087802410], [-0.093388796, 0.084332466], [-0.094828844, 0.082462311], [-0.096248865, 0.080512524], [-0.097628832, 0.078512669], [-0.098918676, 0.076462269], [-0.10008883, 0.074392319], [-0.10110879, 0.072302341], [-0.10194874, 0.070212364], [-0.10257888, 0.068142414], [-0.10295868, 0.066102505], [-0.10304880, 0.064102650], [-0.10282874, 0.062172413], [-0.10226870, 0.060302258], [-0.10132885, 0.058532238], [-0.099968672, 0.056862354], [-0.090713739, 0.046707153], [-0.081458807, 0.036552429], [-0.071928740, 0.026537418], [-0.062398672, 0.016522408], [-0.052588701, 0.0066471100], [-0.042778730, -0.0032277107], [-0.032693863, -0.012967587], [-0.022608757, -0.022707462], [-0.012645483, -0.032323837], [-0.0026822090, -0.041940689], [0.0072813034, -0.051557541], [0.019141197, -0.063462257], [0.031001329, -0.075367451], [0.042321205, -0.087162495]]];
//}}}2
Scene.my.BLOCK_PROPERTY_TEMPLATE := @"
geomID := id__;
_materialName := """";
pos := pos__ + [-0.5, 0.5];
color := Scene.my.stealth_flag ? {[1, 1, 1, 0.07]} : {Scene.my.nextTetrisColor};
//color := [1, 1, 1, 1]; //FIXME
drawBorder := false;
density := 2.0;
restitution := 0.0;
friction := 0.5;
materialName := Scene.my.MATERIALNAME_FOR_ACTIVE_BLOCK;
_count := Scene.my.count;
airFrictionMult := {
_count != Scene.my.count ? {
entity.collideSet = Scene.my.COLLIDESET_FOR_INACTIVE_BLOCK;
entity.airFrictionMult = 0;
entity.materialName = entity._materialName;
entity.onCollide = (e)=>{};
} : {
};
0;
};
immortal := {_materialName == ""UEHARA_BALL"" ? {true} : {false}};
//inertiaMultiplier := {Scene.my.count == _count ? {1} : {+inf}}; //FIXME
//texture := ""237.gif""; // FIXME
//textureMatrix := [1.0, 0.0, 0.5, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0];
//textureMatrix := {[1.0, 0.0, Sim.time, 0.0, 1.0, 0.5, 0.0, 0.0, 1.0]}; // FIXME
//textureMatrix := {[0.125 * math.cos((readable entity).angle), -0.125 * math.sin((readable entity).angle), 0.5 + 0.125 * (readable entity).pos(0), 0.125 * math.sin((readable entity).angle), 0.125 * math.cos((readable entity).angle), 0.125 * (readable entity).pos(1), 0.0, 0.0, 1.0]}; // FIXME
collideSet := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK;
collideWater := true;
onCollide := Scene.my.BLOCK_ONCOLLIDE;
};";
//}}}1
// Block {{{2
Scene.my.addCircleBlock := (id__, pos__)=> {
eval(
@"
Scene.addCircle{
radius := 0.499;"
+ Scene.my.BLOCK_PROPERTY_TEMPLATE;
);
};
Scene.my.addBoxBlock := (id__, pos__)=> {
eval(
@"
Scene.addBox{
size := [0.95, 0.95];"
+ Scene.my.BLOCK_PROPERTY_TEMPLATE;
);
};
Scene.my.addRectangleBlock := (id__, pos__, size__)=>{
eval(
@"
Scene.addBox{"
+ "size := " + size__ + ";"
+ Scene.my.BLOCK_PROPERTY_TEMPLATE;
);
};
Scene.my.addPolygonBlock := (id__, pos__, surfaces__)=>{
eval(
@"
Scene.addPolygon {
surfaces := surfaces__;"
+ Scene.my.BLOCK_PROPERTY_TEMPLATE;
);
};
Scene.my.addBlock := (id__, pos__)=>{
Scene.my.circleMode ? {
Scene.my.addCircleBlock(id__, pos__)
} : {
Scene.my.addBoxBlock(id__, pos__)
}
};
//}}}2
// Joint (col) {{{2_
Scene.my.addJoint := (geom0__, geom1__)=>{ // col
Scene.addFixjoint{
geom0 := geom0__;
geom1 := geom1__;
geom0pos := [0.0, -0.5];
geom1pos := [0.0, 0.5];
color := Scene.my.COLOR_FOR_FIXJOINT;
size := 0.1;
};
};
// Joint (row) {{{2_
Scene.my.addJoint_ := (geom0__, geom1__)=>{ // row
Scene.addFixjoint{
geom0 := geom0__;
geom1 := geom1__;
geom0pos := [0.5, 0.0];
geom1pos := [-0.5, 0.0];
color := Scene.my.COLOR_FOR_FIXJOINT;
size := 0.1;
};
};
//}}}2
// Controller {{{2_
Scene.my.addController := (geomID__, radius__, pos__)=>{
Scene.my.checkTick = Sim.tick + 7; // ###
Scene.addCircle{
_count := Scene.my.count;
geomID := geomID__;
controllerAcc := 50;
forceController := "keys * right down left";
radius := radius__ / 2;
pos := pos__ + [-0.5, 0.5];
density := 2.0;
restitution := 0.0;
friction := 0.0;
airFrictionMult := 500 * radius__;
inertiaMultiplier := +inf;
collideSet := Scene.my.COLLIDESET_FOR_CONTROLLER;
heteroCollide := true;
collideWater := false;
color := Scene.my.COLOR_FOR_CONTROLLER;
drawBorder := false;
drawCake := {
Scene.my.isGameover ? {
entity.drawCake = false;
Scene.RemoveEntity(entity);
} : {
(Scene.my.count == entity._count) ? {
(Sim.tick >= Scene.my.checkTick) ? {
Scene.my.i = (Scene.my.i + 1) % 5;
Scene.my.currentPosY = entity.pos(1);
(Scene.my.getPosY(Scene.my.i) - Scene.my.currentPosY < 0.001) ? { // ###
Scene.my.Next;
Scene.my.SetGameScore(Scene.my.gameScore + 100);
entity.drawCake = false;
Scene.RemoveEntity(entity);
App.AddUndoPoint;
} : {
Scene.my.setPosY(Scene.my.i, Scene.my.currentPosY);
Scene.my.checkTick = Sim.tick + 7; // ###
};
} : {};
} : {
};
};
false;
};
};
};
// ControllerHinge {{{2_
Scene.my.addControllHinge := (geom0__, geom1__, geom0pos__, bendConstant__)=>{
Scene.addHinge{
geom0 := geom0__;
geom1 := geom1__;
geom0pos := geom0pos__;
geom1pos := [0, 0];
size := 0.5;
color := Scene.my.COLOR_FOR_CONTRALLHINGE;
motorTorque := +inf;
autoBrake := false;
motorSpeed := (2 * math.pi) * 0.4; //###
bendConstant := bendConstant__;
bendTarget := {Scene.my.bendTarget};
bend := true;
buttonForward := Scene.my.ROTATE_CW_KEY;
buttonBrake := Scene.my.ROTATE_STOP_KEY;
buttonBack := Scene.my.ROTATE_CCW_KEY;
};
};
//}}}2
// NormalHinge {{{2_
Scene.my.addNormalHinge := (geom0__, geom1__, geom0pos__, geom1pos__)=>{
Scene.addHinge{
geom0 := geom0__;
geom1 := geom1__;
geom0pos := geom0pos__;
geom1pos := geom1pos__;
size := 1.0;
color := [0, 0, 0, 1];
motorTorque := 0;
autoBrake := false;
};
};
//}}}2
// Tracer {{{2_
Scene.my.addTracer := (geom__, relPoint__, size__, fadeTime__, color__)=>{
Scene.addPen{
geom := geom__;
relPoint := relPoint__;
size := size__;
color := color__;
fadeTime := fadeTime__
};
};
//}}}1
// Tetrises {{{1
// Normal {{{2
// I-type {{{3
Scene.my.TETRIS_I := {
Scene.my.addController(5, 4, [0.5, 0]);
Scene.my.addBlock(1, [-1, 0]);
Scene.my.addBlock(2, [ 0, 0]);
Scene.my.addBlock(3, [ 1, 0]);
Scene.my.addBlock(4, [ 2, 0]);
Scene.my.addControllHinge(2, 5, [0.5, 0.0], 2000);
Scene.my.addJoint_(1, 2);
Scene.my.addJoint_(2, 3);
Scene.my.addJoint_(3, 4);
};
//}}}3
// O-type {{{3
Scene.my.TETRIS_O := {
Scene.my.addController(5, 4, [0.5, 0.5]);
Scene.my.addBlock(1, [0, 1]);
Scene.my.addBlock(2, [1, 1]);
Scene.my.addBlock(3, [1, 0]);
Scene.my.addBlock(4, [0, 0]);
Scene.my.addControllHinge(4, 5, [0.5, 0.5], 2000);
Scene.my.addJoint_(1, 2);
Scene.my.addJoint(2, 3);
Scene.my.addJoint_(4, 3);
Scene.my.addJoint(1, 4);
};
//}}}3
// S-type {{{3
Scene.my.TETRIS_S := {
Scene.my.addController(5, 4, [0.5, 1]);
Scene.my.addBlock(1, [0, 2]);
Scene.my.addBlock(2, [0, 1]);
Scene.my.addBlock(3, [1, 1]);
Scene.my.addBlock(4, [1, 0]);
Scene.my.addControllHinge(2, 5, [0.5, 0.0], 2000);
Scene.my.addJoint(1, 2);
Scene.my.addJoint_(2, 3);
Scene.my.addJoint(3, 4);
};
//}}}3
// Z-type {{{3
Scene.my.TETRIS_Z := {
Scene.my.addController(5, 4, [0.5, 1]);
Scene.my.addBlock(1, [1, 2]);
Scene.my.addBlock(2, [1, 1]);
Scene.my.addBlock(3, [0, 1]);
Scene.my.addBlock(4, [0, 0]);
Scene.my.addControllHinge(3, 5, [0.5, 0.0], 2000);
Scene.my.addJoint(1, 2);
Scene.my.addJoint_(3, 2);
Scene.my.addJoint(3, 4);
};
//}}}3
// J-type {{{3
Scene.my.TETRIS_J := {
Scene.my.addController(5, 4, [0.5, 1]);
Scene.my.addBlock(1, [1, 2]);
Scene.my.addBlock(2, [1, 1]);
Scene.my.addBlock(3, [1, 0]);
Scene.my.addBlock(4, [0, 0]);
Scene.my.addControllHinge(2, 5, [-0.5, 0.0], 2000);
Scene.my.addJoint(1, 2);
Scene.my.addJoint(2, 3);
Scene.my.addJoint_(4, 3);
};
//}}}3
// L-type {{{3
Scene.my.TETRIS_L := {
Scene.my.addController(5, 4, [0.5, 1]);
Scene.my.addBlock(1, [0, 2]);
Scene.my.addBlock(2, [0, 1]);
Scene.my.addBlock(3, [0, 0]);
Scene.my.addBlock(4, [1, 0]);
Scene.my.addControllHinge(2, 5, [0.5, 0.0], 2000);
Scene.my.addJoint(1, 2);
Scene.my.addJoint(2, 3);
Scene.my.addJoint_(3, 4);
};
//}}}3
// T-type {{{3
Scene.my.TETRIS_T := {
Scene.my.addController(5, 4, [0.5, 1]);
Scene.my.addBlock(1, [0, 2]);
Scene.my.addBlock(2, [0, 1]);
Scene.my.addBlock(3, [0, 0]);
Scene.my.addBlock(4, [1, 1]);
Scene.my.addControllHinge(2, 5, [0.5, 0.0], 2000);
Scene.my.addJoint(1, 2);
Scene.my.addJoint(2, 3);
Scene.my.addJoint_(2, 4);
};
//}}}3
//}}}2
// Uehara Tetris related {{{2
// cf. http://www.nicovideo.jp/watch/sm10219882
// UE-type {{{3
Scene.my.TETRIS_UE := {
Scene.my.addController(10, 9, [0, 1.5]);
Scene.my.addBlock(1, [0, 3]);
Scene.my.addBlock(2, [0, 2]);
Scene.my.addBlock(3, [0, 1]);
Scene.my.addBlock(4, [0, 0]);
Scene.my.addBlock(5, [1, 2]);
Scene.my.addBlock(6, [-2, 0]);
Scene.my.addBlock(7, [-1, 0]);
Scene.my.addBlock(8, [1, 0]);
Scene.my.addBlock(9, [2, 0]);
Scene.my.addControllHinge(3, 10, [0, 0.5], 10000);
Scene.my.addJoint(1, 2);
Scene.my.addJoint(2, 3);
Scene.my.addJoint(3, 4);
Scene.my.addJoint_(2, 5);
Scene.my.addJoint_(6, 7);
Scene.my.addJoint_(7, 4);
Scene.my.addJoint_(4, 8);
Scene.my.addJoint_(8, 9);
};
//}}}3
// HARA-type {{{3
Scene.my.TETRIS_HARA := {
Scene.my.addController(40, 39, [0, 4]);
Scene.my.addBlock( 1, [-3, 8]);
Scene.my.addBlock( 2, [-2, 8]);
Scene.my.addBlock( 3, [-1, 8]);
Scene.my.addBlock( 4, [ 0, 8]);
Scene.my.addBlock( 5, [ 1, 8]);
Scene.my.addBlock( 6, [ 2, 8]);
Scene.my.addBlock( 7, [ 3, 8]);
Scene.my.addBlock( 8, [-3, 7]);
Scene.my.addBlock( 9, [-3, 6]);
Scene.my.addBlock(10, [-3, 5]);
Scene.my.addBlock(11, [-3, 4]);
Scene.my.addBlock(12, [-3, 3]);
Scene.my.addBlock(13, [-3, 2]);
Scene.my.addBlock(14, [-3, 1]);
Scene.my.addBlock(15, [-3, 0]);
Scene.my.addBlock(16, [ 1, 7]);
Scene.my.addBlock(17, [ 1, 6]);
Scene.my.addBlock(18, [-1, 6]);
Scene.my.addBlock(19, [-1, 5]);
Scene.my.addBlock(20, [-1, 4]);
Scene.my.addBlock(21, [-1, 3]);
Scene.my.addBlock(22, [-1, 2]);
Scene.my.addBlock(23, [ 0, 6]);
Scene.my.addBlock(24, [ 2, 6]);
Scene.my.addBlock(25, [ 3, 6]);
Scene.my.addBlock(26, [ 3, 5]);
Scene.my.addBlock(27, [ 3, 4]);
Scene.my.addBlock(28, [ 3, 3]);
Scene.my.addBlock(29, [ 3, 2]);
Scene.my.addBlock(30, [ 0, 4]);
Scene.my.addBlock(31, [ 1, 4]);
Scene.my.addBlock(32, [ 2, 4]);
Scene.my.addBlock(33, [ 0, 2]);
Scene.my.addBlock(34, [ 1, 2]);
Scene.my.addBlock(35, [ 2, 2]);
Scene.my.addBlock(36, [ 1, 1]);
Scene.my.addBlock(37, [ 1, 0]);
Scene.my.addBlock(38, [-1, 0]);
Scene.my.addBlock(39, [ 3, 0]);
Scene.my.addControllHinge(30, 40, [0, 0], 200000);
Scene.my.addJoint_(1, 2);
Scene.my.addJoint_(2, 3);
Scene.my.addJoint_(3, 4);
Scene.my.addJoint_(4, 5);
Scene.my.addJoint_(5, 6);
Scene.my.addJoint_(6, 7);
Scene.my.addJoint( 1, 8);
Scene.my.addJoint( 8, 9);
Scene.my.addJoint( 9, 10);
Scene.my.addJoint(10, 11);
Scene.my.addJoint(11, 12);
Scene.my.addJoint(12, 13);
Scene.my.addJoint(13, 14);
Scene.my.addJoint(14, 15);
Scene.my.addJoint( 5, 16);
Scene.my.addJoint(16, 17);
Scene.my.addJoint(18, 19);
Scene.my.addJoint(19, 20);
Scene.my.addJoint(20, 21);
Scene.my.addJoint(21, 22);
Scene.my.addJoint_(18, 23);
Scene.my.addJoint_(23, 17);
Scene.my.addJoint_(17, 24);
Scene.my.addJoint_(24, 25);
Scene.my.addJoint(25, 26);
Scene.my.addJoint(26, 27);
Scene.my.addJoint(27, 28);
Scene.my.addJoint(28, 29);
Scene.my.addJoint_(20, 30);
Scene.my.addJoint_(30, 31);
Scene.my.addJoint_(31, 32);
Scene.my.addJoint_(32, 27);
Scene.my.addJoint_(22, 33);
Scene.my.addJoint_(33, 34);
Scene.my.addJoint_(34, 35);
Scene.my.addJoint_(35, 29);
Scene.my.addJoint(34, 36);
Scene.my.addJoint(36, 37);
Scene.my.addJoint_(38, 37);
Scene.my.addJoint_(37, 39);
};
// }}}3
// Tracer block {{{3
Scene.my.TETRIS_TRACER := {
Scene.my.addController(2, 5, [0, 0]);
Scene.my.addBlock(1, [0, 0]);
Scene.my.addControllHinge(1, 2, [0, 0], 10000);
Scene.my.addTracer(1, [0, 0], 1.45, +inf, Scene.my.nextTetrisColor);
};
// uehara ball {{{3
Scene.my.UEHARA_BALL := {
Scene.my.addController(2, 5, [0, 0]);
(Scene.my.addCircleBlock(1, [0, 0]))._materialName = "UEHARA_BALL";
Scene.my.addControllHinge(1, 2, [0, 0], 10000);
Scene.addGroup {
name := "tracked";
entityIDs := [100]
};
};
// }}}3
// UE Polygon {{{3
Scene.my.UE_POLYGON := {
Scene.my.addController(2, 5, [0.5, 1.0]);
Scene.my.addPolygonBlock(1, [0.5, 1.0], Scene.my.UE_SURFACES * 0.5);
Scene.my.addControllHinge(1, 2, [0, 0], 10000);
};
// HARA Polygon {{{3
Scene.my.HARA_POLYGON := {
Scene.my.addController(4, 5, [0.5, 3.0]);
Scene.my.addPolygonBlock(1, [ 0.5, 3.0], Scene.my.HARA_SURFACES1 * 5);
Scene.my.addPolygonBlock(2, [-0.35, 1.0], Scene.my.HARA_SURFACES2 * 5);
Scene.my.addPolygonBlock(3, [ 2.5, 1.0], Scene.my.HARA_SURFACES3 * 5);
Scene.my.addJoint_(1, 2);
Scene.my.addJoint_(1, 3);
Scene.my.addControllHinge(1, 4, [0, 0], 10000);
};
// }}}3
// Double Pendulum {{{3
Scene.my.DOUBLE_PENDULUM := {
Scene.my.addController(3, 5, [0.0, 0.0]);
Scene.my.addRectangleBlock(1, [0, 1], [1, 3]);
Scene.my.addRectangleBlock(2, [0, 2.5], [1, 2]);
Scene.my.addTracer(2, [0, 0.5], 0.1, 10, [1, 1, 0, 1]);
Scene.my.addNormalHinge(1, 2, [0, 1], [0, -0.5]);
Scene.my.addControllHinge(1, 3, [0, -1], 3000);
};
// }}}3
// Triple Pendulum {{{3
Scene.my.TRIPLE_PENDULUM := {
Scene.my.addController(4, 5, [0.0, 0.0]);
Scene.my.addRectangleBlock(1, [0, 0.5], [1, 2]);
Scene.my.addRectangleBlock(2, [0, 2.5], [1, 4]);
Scene.my.addRectangleBlock(3, [0.5, 4], [2, 1]);
Scene.my.addTracer(3, [1, 0], 0.1, 10, [1, 1, 0, 1]);
Scene.my.addNormalHinge(1, 2, [0, 0.5], [0, -1.5]);
Scene.my.addNormalHinge(2, 3, [0, 1.5], [-0.5, 0]);
Scene.my.addControllHinge(1, 4, [0, -0.5], 3000);
};
// }}}3
// }}}2
// Test Block {{{2
Scene.my.COLOR_FOR_TETRIS_TEST := [1, 1, 1, 1];
Scene.my.TETRIS_TEST := { //TEST
Scene.my.addController(9, 8, [0.5, 0.5]);
Scene.my.addBlock(1, [-1, 1]);
Scene.my.addBlock(2, [ 0, 1]);
Scene.my.addBlock(3, [ 1, 1]);
Scene.my.addBlock(4, [ 2, 1]);
Scene.my.addBlock(5, [-1, 0]);
Scene.my.addBlock(6, [ 0, 0]);
Scene.my.addBlock(7, [ 1, 0]);
Scene.my.addBlock(8, [ 2, 0]);
Scene.my.addControllHinge(6, 9, [0.5, 0.5], 10000);
Scene.my.addJoint(1, 5);
Scene.my.addJoint(2, 6);
Scene.my.addJoint(3, 7);
Scene.my.addJoint(4, 8);
Scene.my.addJoint_(1, 2);
Scene.my.addJoint_(2, 3);
Scene.my.addJoint_(3, 4);
Scene.my.addJoint_(5, 6);
Scene.my.addJoint_(6, 7);
Scene.my.addJoint_(7, 8);
};
// }}}2
// UE killer {{{2
Scene.my.addUE_KILLER := ()=>{
Scene.my.playSound("uehara_uekiller3.wav");
Scene.my.uekillerflag = true;
Scene.addPolygon {
_lastTick := Sim.tick;
_life := Scene.my.UE_KILLER_INTERVAL_TICK;
surfaces := Scene.my.UE_SURFACES;
color := [1.00000000, 0.00000000, 0.00000000, 1.0000000];
body := 0;
collideSet := Scene.my.COLLIDESET_NONE;
killer := true;
drawBorder := {
Sim.tick != entity._lastTick ? {
entity._lastTick = Sim.tick;
entity._life = entity._life - 1;
entity._life > 1 ? {
entity.collideSet = Scene.my.COLLIDESET_NONE;
} : {
entity._life == 1 ? {
entity.collideSet = Scene.my.COLLIDESET_FOR_UE_KILLER;
} : {
Scene.my.playSound("uehara_uekiller3.wav");
Scene.RemoveEntity(entity);
Scene.my.uekillerflag = false;
}
};
} : {
};
true;
};
pos := [0.1, -12.75];
};
};
//}}}2
}();
// }}}1
Scene.my.nextTetrises = [ // nextTetris Array {{{1
"Scene.my.TETRIS_I", // id: 0
"Scene.my.TETRIS_O", // id: 1
"Scene.my.TETRIS_S", // id: 2
"Scene.my.TETRIS_Z", // id: 3
"Scene.my.TETRIS_J", // id: 4
"Scene.my.TETRIS_L", // id: 5
"Scene.my.TETRIS_T", // id: 6
"Scene.my.TETRIS_UE", // id: 7
"Scene.my.TETRIS_HARA", // id: 8
"Scene.my.UEHARA_BALL", // id: 9
"Scene.my.TETRIS_TRACER", // id: 10
"Scene.my.UE_POLYGON", // id: 11
"Scene.my.HARA_POLYGON", // id: 12
"Scene.my.DOUBLE_PENDULUM", // id: 13
"Scene.my.TRIPLE_PENDULUM", // id: 14
]; //}}}1
Scene.my.nextTetrisTexts := [ // nextTetrisText Array {{{1
@"
■■■■", //I
@"
■■
■■", //O
@"
■■
■", //S
@"
■■
■", // Z
@"
■■", // J
@"
■■", // L
@"
■■
■", // T
@"
■■
■■■■■", //UE
@"
■■■■■■■
■ ■
■ ■■■■■
■ ■ ■
■ ■■■■■
■ ■ ■
■ ■■■■■
■ ■
■ ■ ■ ■", // HARA
"●", // Uehara ball
"■", // Tracer
@"
■■
■■■■■", //UE POLYGON
@"
■■■■■■■
■ ■
■ ■■■■■
■ ■ ■
■ ■■■■■
■ ■ ■
■ ■■■■■
■ ■
■ ■ ■ ■", // HARA POLYGON
"?", // Double Pendulum
"??", // Triple Pendulum
];
string.length(Scene.my.nextTetrises) != string.length(Scene.my.nextTetrisTexts) ? {
App.GUI.ShowMessage("Warning: Array size of Scene.my.nextTetrisTexts is not correct.")
} : {
};
//}}}1
Scene.my.nextTetrisTextScales := [ // nextTetrisTextScale Array {{{1
1.2, // I
1.2, // O
1.2, // S
1.2, // Z
1.2, // J
1.2, // L
1.2, // T
0.98, // UE
0.50, // HARA
1, // UEHARA BALL
1, // Tracer
0.98, // UE POLYGON
0.50, // HARA POLYGON
3, // Double Pendulum
3, // Triple Pendulum
];
string.length(Scene.my.nextTetrises) != string.length(Scene.my.nextTetrisTextScales) ? {
App.GUI.ShowMessage("Warning: Array size of Scene.my.nextTetrisTextScales is not correct.")
} : {
};
//}}}1
Scene.my.nextTetrisColors := [ // nextTetrisColor Array {{{1
[1, 0, 0, 1]; // I
[1, 1, 0, 1]; // O
[1, 0, 1, 1]; // S
[0, 1, 0, 1]; // Z
[1, 0.5, 0, 1]; // J
[0, 0, 1, 1]; // L
[0, 1, 1, 1]; // T
[1, 1, 1, 1]; // UE
[1, 0.5, 0.5, 1]; // HARA
[1, 0, 0, 1]; // UEHARA BALL
[1, 0, 1, 1]; // Tracer
[1, 1, 1, 1]; // UE POLYGON
[1, 0.5, 0.5, 1]; // HARA POLYGON
[1, 1, 1, 1]; // Double Pendulum
[1, 1, 1, 1]; // Triple Pendulum
];
string.length(Scene.my.nextTetrises) != string.length(Scene.my.nextTetrisColors) ? {
App.GUI.ShowMessage("Warning: Array size of Scene.my.nextTetrisColors is not correct.")
} : {
};
//}}}1
// StartSet {{{1
Scene.my.StartSet := ()=>{
// Start ball {{{2
Scene.addCircle {
radius := 0.5;
pos := [0, 0.5];
color := Scene.my.COLOR_FOR_STARTBALL;
drawBorder := false;
materialName := Scene.my.MATERIALNAME_FOR_ACTIVE_BLOCK;
collideSet := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK;
collideWater := false;
onCollide := (e)=>{
( e.other.materialName != Scene.my.MATERIALNAME_FOR_STARTBOARD &&
e.other.materialName != Scene.my.MATERIALNAME_FOR_CHECK_BALL
) ? {
print ("=== GAME START ===");
Scene.my.Next;
Scene.RemoveEntity(e.this);
} : { };
};
};
//}}}2
// Start board {{{2
Scene.addBox{
body := 0;
size := [4, 2];
pos := [0, -1.0];
color := Scene.my.COLOR_FOR_STARTBOARD;
drawBorder := false;
text := Scene.my.TEXT_FOR_STARTBOARD;
textScale := 1.35;
materialName := Scene.my.MATERIALNAME_FOR_STARTBOARD;
collideSet := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK;
collideWater := false;
onCollide := (e)=>{
Scene.my.UpdateNextTetris;
Scene.RemoveEntity(e.this);
}
};
//}}}2
};
// }}}1
// Reset {{{1
Scene.my.reset_flag := false;
Scene.my.Reset := ()=>{
Sim.running = false;
Scene.my.reset_flag = true;
// Template: Wall for Remove Tetris {{{2
addRemoveTetrisWall := (pos__, angle__)=>
{
Scene.addPlane {
_tick := Sim.tick;
body := 0;
collideWater := true;
collideSet := Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK + Scene.my.COLLIDESET_FOR_CONTROLLER + Scene.my.COLLIDESET_GAMEOVER;
color := Scene.my.COLOR_FOR_WALL * 0.5;
drawBorder := false;
killer := {
Sim.tick == (entity._tick + 1) ? {
Scene.my.reset_flag ? {
Scene.my.reset_flag = false;
Scene.my.StartSet;
Scene.my.lastTick0 = -1;
Sim.running = false;
}:{};
Scene.RemoveEntity(entity);
entity.killer = true;
} : {};
true;
};
pos := pos__;
angle := angle__;
};
};//}}}2
// Remove Tetris {{{2
addRemoveTetrisWall([ 1, 0]; 0);
addRemoveTetrisWall([-1, 0]; math.pi);
App.Step;
//}}}2
// Init {{{2
Scene.my.count = 1;
Scene.my.currentPosY = 10;
Scene.my.checkTick = 0;
Scene.my.gameoverTick = 0;
Scene.my.nextCheckTick = 0;
Scene.my.checkLineCol = 0;
Scene.my.i = 0;
Scene.my.lastTick7 = -1;
Scene.my.posY0 = 100;
Scene.my.posY1 = 100;
Scene.my.posY2 = 100;
Scene.my.posY3 = 100;
Scene.my.posY4 = 100;
Scene.my.SetUeKillerStock(Scene.my.INITIAL_UE_KILLER_STOCK);
Scene.my.isGameover = false;
Scene.my.deletedLineNum = Scene.my.INITIAL_DELETED_LINE_NUM;
Scene.my.gameScore = Scene.my.INITIAL_GAME_SCORE;
Scene.my.gameLevel = Scene.my.INITIAL_GAME_LEVEL;
Scene.my.ueharaMode = Scene.my.INITIAL_UEHARA_MODE;
Scene.my.circleMode = Scene.my.INITIAL_CIRCLE_MODE;
Scene.my.nextTetrisText = "";
//}}}2
// Scene setting {{{2
Sim.gravityStrength = Scene.my.INITIAL_GRAVITY_STRENGTH;
Sim.airSwitch = true;
App.GUI.drawHingesWhenRunning = false;
App.laserFuzziness = 0;
App.Background.drawClouds = false;
App.Background.skyColor = Scene.my.COLOR_FOR_SKY;
Scene.Camera.pan = [0, -8];
//Scene.Camera.zoom = 4 * System.resolution(1) / GUI.scale / 100;
Scene.Camera.zoom = 25;
Scene.Camera.trackRotation = true;
Scene.setFilter{
mask = Scene.my.COLLIDESET_FOR_ACTIVE_BLOCK
+ Scene.my.COLLIDESET_GAMEOVER
+ Scene.my.COLLIDESET_FOR_SWITCH
+ Scene.my.COLLIDESET_FOR_UE_KILLER;
};
Tools.DragTool.strength = 10000;
App.Grid -> { // Grid {{{3
grid = true;
snap = true;
base = 5;
scale = 1;
}; //}}}3
//}}}2
}; //}}}1
// Start {{{1
{
//Scene.Clear;
Scene.my.Reset;
// Template: Killer plane {{{2
Scene.my.addKillerPlane := (angle__)=>
{
Scene.addPlane {
pos := [0, 0];
color := Scene.my.COLOR_FOR_HIDDEN_KILLER1;
drawBorder := false;
angle := angle__;
collideSet := Scene.my.COLLIDESET_FOR_KILLERPLANE;
collideWater := false;
killer := true;
immortal := true;
};
};
// Killer planes {{{2
//}}}2
Scene.my.addKillerPlane(-math.pi / 2); // Upper side
Scene.my.addKillerPlane(math.pi / 2); // Lower side
//}}}2
// Template: Wall {{{2
Scene.my.addWall := (pos__, angle__, friction__, immortal__)=>
{
Scene.addPlane {
immortal := eval(immortal__);
collideWater := true;
restitution := 0.0;
friction := friction__;
reflectiveness := 0.5;
collideSet := Scene.my.COLLIDESET_FOR_WALL;
body := 0;
color := Scene.my.COLOR_FOR_WALL;
drawBorder := false;
pos := pos__;
angle := angle__;
};
};
//}}}2
// Walls {{{2
Scene.my.addWall([ 4, 0], math.pi, 0.0, "true"); // Right wal
Scene.my.addWall([-4, 0], 0, 0.0, "true"); // Left wall
Scene.my.addWall([ 0, -16], math.pi/2, 0.5, "{entity.collideSet = (Scene.my.isGameover) ? {Scene.my.COLLIDESET_FOR_KILLERPLANE} : {Scene.my.COLLIDESET_FOR_WALL}; true}"); // Floor (Ground)
//}}}2
// Template: LaserPen for key bind {{{2
Scene.my.addLaserPenForKeybind := (activationButton__, rotateAngle__, mode__, intervalTick__)=>{
Scene.addLaserPen {
_rotateAngle := rotateAngle__;
_mode := mode__;
_nextStandbyTick := 0;
_lastHitTick := 0;
_intervalTick := intervalTick__;
geom := 0;
pos := [0, 0];
rotation := 0;
maxRays := 1;
collideSet := Scene.my.COLLIDESET_FOR_KEYS;
color := Scene.my.COLOR_FOR_LASERPEN;
activationButton := activationButton__;
onLaserHit := (e)=>{
(Sim.tick < e.laser._nextStandbyTick - e.laser._intervalTick || (Sim.tick > e.laser._nextStandbyTick && Sim.tick > e.laser._lastHitTick + 5)) ? {
(e.laser._mode == "rotate") ? {
Scene.my.playSound("rotate.wav");
Scene.my.bendTarget = Scene.my.bendTarget + e.laser._rotateAngle;
} : {
(Scene.my.ueKillerStock > 0 && !Scene.my.isGameover) ? {
Scene.my.SetUeKillerStock(Scene.my.ueKillerStock - 1);
Scene.my.addUE_KILLER;
} : {};
};
e.laser._nextStandbyTick = Sim.tick + e.laser._intervalTick;
} : {
};
e.laser._lastHitTick = Sim.tick;
}
}
};
//}}}2
// LaserPens {{{2
Scene.my.addLaserPenForKeybind(Scene.my.CCW_KEY, math.pi * 2 / 4, "rotate", 10);
Scene.my.addLaserPenForKeybind(Scene.my.CW_KEY, -math.pi * 2 / 4, "rotate", 10);
Scene.my.addLaserPenForKeybind(Scene.my.TURN_KEY, math.pi, "rotate", 10);
Scene.my.addLaserPenForKeybind(Scene.my.UE_KEY, 0, "ue", Scene.my.UE_KILLER_INTERVAL_TICK + 10);
//}}}2
Scene.addBox{ // Box for LaserPens and onStep {{{2
pos := [1, 0];
size := [1, 1];
collideSet := Scene.my.COLLIDESET_FOR_KEYS;
color := Scene.my.COLOR_FOR_LASERPEN;
drawBorder := {Scene.my.onStep; false};
body := 0;
}; //}}}2
// Template: Label {{{2
Scene.my.addLabel := (pos__, size__, drawBorder__, color__, textColor__, text__, textScale__, textFont__)=>{
Scene.addBox {
pos := pos__;
size := size__;
body := 0;
collideSet := 0;
collideWater := false;
drawBorder := eval(drawBorder__);
color := eval(color__);
textColor := eval(textColor__);
text := eval(text__);
textScale := eval(textScale__);
textFont := textFont__;
}
};
// }}}2
// Template: Switch {{{2
Scene.my.addSwitch := (pos__, size__, thickness__, identifier__)=>
{
Scene.addBox {
pos := pos__ - [(size__(0)-2*thickness__)/6.0, 0] * (eval(identifier__) ? {-1} : {1});
size := [(size__(0)-2*thickness__)*2/3.0, size__(1)-2*thickness__];
color := [1.0, 0.0, 0.0, 1.0];
collideSet := Scene.my.COLLIDESET_FOR_SWITCH;
collideWater := false;
restitution := 0;
friction := 0;
inertiaMultiplier := +inf;
drawBorder := true;
geomID := 1;
entityID := 0;
};
Scene.addBox { // bottom
body := 0;
color := [0, 0, 0, 1];
collideSet := Scene.my.COLLIDESET_FOR_SWITCH;
pos := pos__ - [0, (size__(1)-thickness__)*0.5];
size := [size__(0), thickness__];
};
Scene.addBox { // top
body := 0;
color := [0, 0, 0, 1];
collideSet := Scene.my.COLLIDESET_FOR_SWITCH;
pos := pos__ + [0, (size__(1)-thickness__)*0.5];
size := [size__(0), thickness__];
};
Scene.addBox { // left
body := 0;
color := [0, 0, 0, 1];
collideSet := Scene.my.COLLIDESET_FOR_SWITCH;
pos := pos__ - [(size__(0)-thickness__)*0.5, 0];
size := [thickness__, size__(1)];
onCollide := eval("(e)=>{" + identifier__ + " = false}");
};
Scene.addBox { // right
body := 0;
color := [0, 0, 0, 1];
collideSet := Scene.my.COLLIDESET_FOR_SWITCH;
pos := pos__ + [(size__(0)-thickness__)*0.5, 0];
size := [thickness__, size__(1)];
onCollide := eval("(e)=>{" + identifier__ + " = true}");
};
Scene.addLineEndPoint {
geom := 1;
relPoint := [0, 0];
color := [0.0, 0.0, 0.0, 0.0];
size := thickness__ * 0.5;
entityID := 1;
};
Scene.addLineEndPoint {
geom := 0;
relPoint := pos__ - [(size__(0)-thickness__)*0.5, 0];
color := [0.0, 0.0, 0.0, 0.0];
size := thickness__ * 0.5;
entityID := 2;
};
Scene.addSpring {
length := eval("{" + identifier__ + " ? {" + size__(0) + "} : {" + thickness__ + "}}");
lineEndPoint0 := 1;
lineEndPoint1 := 2;
forceDirectSolve := false;
dampingFactor := 1.0;
strengthFactor := 0.03;
constant := 0.000001;
totImp := 0;
legacyMode := 3;
color := [1.0, 0.0, 0.0, 0.0];
opaqueBorders := true;
allowDirectSolve := true;
};
};
// }}}2
// Label: Next {{{3
Scene.my.addLabel([ 7.0, -0.6], [4, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 1, 0, 1]", "\"NEXT\"", "1.0", "Sans");
Scene.my.addLabel([ 7.0, -3.0], [4, 4], "false", "{[0.0, 0.0, 0.0, 1.0]}", "{Scene.my.nextTetrisColor}", "{Scene.my.nextTetrisText}", "{Scene.my.nextTetrisTextScale}", "MS Gothic");
// }}}3
// Label: For Debug {{{3
Scene.my.DEBUG_MODE ? {
Scene.my.addLabel([ 7.0, -6.7], [4, 0.6], "false", "[0.4, 0.2, 0.2, 0.8]", "[1, 1, 1, 1]", "\"For DEBUG\"", "0.7", "Sans");
Scene.my.addLabel([ 7.0, -7.5], [4, 1], "false", "[0.0, 0.0, 0.0, 1.0]", "[1, 1, 1, 1]", "{\"\" + Scene.my.checkTick}", "1.0", "Sans");
} : {
};
// Label: High Score {{{3
Scene.my.addLabel([ 7.0, -8.7], [4, 0.6], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 0, 1, 1]", "\"HIGH SCORE\"", "0.7", "Sans");
Scene.my.addLabel([ 7.0, -9.5], [4, 1], "false", "[0.0, 0.0, 0.0, 1.0]", "[1, 1, 1, 1]", "{\"\" + Scene.my.gameHighScore}", "1.0", "Sans");
// }}}3
// Label: Gravity {{{3
Scene.my.addLabel([ 7.0, -10.6], [4, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[0, 0.5, 1, 1]", "\"GRAVITY\"", "1.0", "Sans");
Scene.my.addLabel([ 7.0, -11.5], [4, 1], "false", "[0.0, 0.0, 0.0, 1.0]", "[1, 1.0, 1, 1]", "{\"\" + math.toInt(Sim.gravityStrength*10)/10.0 + \"m/s²\"}", "1.0", "Sans");
// }}}3
// Label: Score {{{3
Scene.my.addLabel([ 7.0, -13.6], [4, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 0, 1, 1]", "\"SCORE\"", "1.0", "Sans");
Scene.my.addLabel([ 7.0, -14.5], [4, 1], "false", "[0.0, 0.0, 0.0, 1.0]", "[1, 1, 1, 1]", "{\"\" + Scene.my.gameScore}", "1.0", "Sans");
// }}}3
// Label: Mode {{{3
Scene.my.addLabel([-6.5, -0.6], [3, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 1, 1, 1]", "{Scene.my.ueharaMode ? {\"UEHARA\"} : {\"NORMAL\"}}", "0.80", "Sans");
Scene.my.addSwitch([-6.5, -1.50], [3, 1.0], 0.1, "Scene.my.ueharaMode");
Scene.my.addLabel([-6.5, -2.6], [3, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 1, 1, 1]", "{Scene.my.circleMode ? {\"CIRCLE\"} : {\"BOX\"}}", "0.90", "Sans");
Scene.my.addSwitch([-6.5, -3.5], [3, 1.0], 0.1, "Scene.my.circleMode");
/*
Scene.my.addLabel([-6.5, -4.75], [3, 0.5], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 1, 1, 1]", "{Scene.my.soundEffect ? {\"SOUND ON\"} : {\"SOUND OFF\"}}", "0.63", "Sans");
Scene.my.addSwitch([-6.5, -5.5], [3, 1.0], 0.1, "Scene.my.soundEffect");
*/
// }}}3
// Label: Push UE! {{{3
Scene.my.addLabel([-6.5, -7.5], [3, 1], "true", "[1.0, 1.0, 1.0, 1.0]", "[1, 0, 0, 1]", "{Scene.my.ueKillerStockText}", "1.0", "Sans");
Scene.my.addLabel([-6.5, -9.0], [3, 2], "false", "[0.2, 0.2, 0.2, 0.0]", "[1, 1, 1, 1]", "{Scene.my.ueKillerStock != 0 ? {\" Push\\n UE!\"} : {\"\"}}", "1.15", "Sans");
// }}}3
// Label: Level {{{3
Scene.my.addLabel([-6.5, -11.6], [3, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[0, 1, 0, 1]", "\"LEVEL\"", "1.0", "Sans");
Scene.my.addLabel([-6.5, -12.5], [3, 1], "false", "[0.0, 0.0, 0.0, 1.0]", "[1, 1, 1, 1]", "{\"\" + Scene.my.gameLevel}", "1.0", "Sans");
// }}}3
// Label: Line {{{3
Scene.my.addLabel([-6.5, -13.6], [3, 0.8], "false", "[0.2, 0.2, 0.2, 0.0]", "[0, 1, 1, 1]", "\"LINE\"", "1.0", "Sans");
Scene.my.addLabel([-6.5, -14.5], [3, 1], "false", "[0.0, 0.0, 0.0, 1.0]", "[1, 1, 1, 1]", "{\"\" + Scene.my.deletedLineNum}", "1.0", "Sans");
// }}}3
// Pause {{{3
Scene.my.addLabel([0, -16.5], [8, 1], "false", "[0.0, 0.0, 0.0, 0.0]", "{[1, 1, 1, Sim.running ? {0} : {1}]}", "\"== Space-key to start ==\"", "1.0", "Sans");
// }}}3
/* FIXME
Scene.addCircle {
collideSet := 0;
collideWater := false;
color := [1, 0, 0, 0];
drawBorder := true;
radius := 1;
drawCake := true;
pos := [0, -8];
entityID := 61880;
geomID := 61880;
};
Scene.addHinge {
geom0 := 0;
geom0pos := [0, -8];
geom1 := 61880;
geom1pos := [0, 0];
motorTorque := 100;
autoBrake := false;
motorSpeed := (2 * math.pi) * 0.01; //###
bendConstant := 1000;
bendTarget := {-Scene.my.bendTarget2};
bend := true;
};
Scene.addGroup {
name := "tracked";
entityIDs := [61880];
};
*/
/* FIXME Setting Controller window?
Scene.addBox {
entityID := 61880;
size := [8, 16];
pos := [0, -8];
collideSet := 0;
color := [0, 0, 0, 0];
drawBorder := false;
density := {Sim.running ? {0} : {1}};
};
Scene.addWidget {
widgetID := "FiniteGeomController";
entityIDs := [61880];
title := "Controller Setting";
minimized := false;
pos := [785.00000, 269.00000];
size := [282.00000, 263.00000];
visible := true;
snappedParentMin := [false, false];
snappedParentMax := [false, false]
};
*/
}();
//}}}1
// FileInfo {{{1
FileInfo -> {
title = "TETRIS";
author = "tatt61880";
description = "" +
(Scene.my.DEBUG_MODE ? {"DEBUG MODE\n\n"} :{""}) +
"\n CCW KEY => " + Scene.my.CCW_KEY +
"\n CW KEY => " + Scene.my.CW_KEY;
version = 20;
};
//}}}1
// vim: expandtab shiftwidth=4 tabstop=4 softtabstop=4 fileencoding=utf-8
You can’t perform that action at this time.