-
-
Save babycourageous/ccd9fb96ec460168fcb836f07c4a0171 to your computer and use it in GitHub Desktop.
Tetris kicks from official Tetris SRS wiki translated to JavaScript Object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const kicks = { | |
'JLSTZ': [ | |
{ | |
rotation: 0, | |
direction: -1, | |
tests:[ | |
{ | |
dx: 0, | |
dy: 0 | |
}, | |
{ | |
dx:1, | |
dy:0 | |
}, | |
{ | |
dx:1, | |
dy:-1 | |
}, | |
{ | |
dx:0, | |
dy:2 | |
}, | |
{ | |
dx:1, | |
dy:2 | |
}, | |
] | |
}, | |
{ | |
rotation: 0, | |
direction: 1, | |
tests:[ | |
{ | |
dx:0, dy:0 | |
}, | |
{ | |
dx:-1, dy:0 | |
}, | |
{ | |
dx:-1, dy:-1 | |
}, | |
{ | |
dx:0, dy:2 | |
}, | |
{ | |
dx:-1, dy:2 | |
}, | |
] | |
}, | |
{ | |
rotation: 1, | |
direction: -1, | |
tests:[ | |
{ | |
dx:0, dy:0, | |
}, | |
{ | |
dx:1, dy:0, | |
}, | |
{ | |
dx:1, dy:1, | |
}, | |
{ | |
dx:0, dy:-2, | |
}, | |
{ | |
dx:1, dy:-2, | |
}, | |
] | |
}, | |
{ | |
rotation: 1, | |
direction: 1, | |
tests:[ | |
{ | |
dx:0, dy:0, | |
}, | |
{ | |
dx:1, dy:0, | |
}, | |
{ | |
dx:1, dy:1, | |
}, | |
{ | |
dx:0, dy:-2, | |
}, | |
{ | |
dx:1, dy:-2, | |
}, | |
] | |
}, | |
{ | |
rotation: 2, | |
direction: -1, | |
tests:[ | |
{ | |
dx:0, dy: 0, | |
}, | |
{ | |
dx:-1, dy: 0, | |
}, | |
{ | |
dx:-1, dy: -1, | |
}, | |
{ | |
dx:0 , dy:2, | |
}, | |
{ | |
dx:-1 , dy:2, | |
}, | |
] | |
}, | |
{ | |
rotation: 2, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy:0, | |
}, | |
{ | |
dx: 1, dy:0, | |
}, | |
{ | |
dx: 1, dy:-1, | |
}, | |
{ | |
dx: 0, dy:2, | |
}, | |
{ | |
dx: 1, dy:2, | |
}, | |
] | |
}, | |
{ | |
rotation: 3, | |
direction: -1, | |
tests:[ | |
{ | |
dx:0, dy: 0, | |
}, | |
{ | |
dx:-1, dy: 0, | |
}, | |
{ | |
dx:-1 , dy:1, | |
}, | |
{ | |
dx:0, dy: -2, | |
}, | |
{ | |
dx:-1, dy: -2, | |
}, | |
] | |
}, | |
{ | |
rotation: 3, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy:0, | |
}, | |
{ | |
dx: -1, dy:0, | |
}, | |
{ | |
dx: -1, dy:1, | |
}, | |
{ | |
dx: 0, dy:-2, | |
}, | |
{ | |
dx: -1, dy:-2, | |
}, | |
] | |
} | |
], | |
'I': [ | |
{ | |
rotation: 0, | |
direction: -1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: -1, dy: 0, | |
}, | |
{ | |
dx: 2, dy: 0, | |
}, | |
{ | |
dx: -1, dy: -2, | |
}, | |
{ | |
dx: 2, dy: 1, | |
}, | |
] | |
}, | |
{ | |
rotation: 0, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: -2, dy: 0, | |
}, | |
{ | |
dx: 1, dy: 0, | |
}, | |
{ | |
dx: -2, dy: 1, | |
}, | |
{ | |
dx: 1, dy: -2, | |
}, | |
] | |
}, | |
{ | |
rotation: 1, | |
direction: -1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: 2, dy: 0, | |
}, | |
{ | |
dx: -1, dy: 0, | |
}, | |
{ | |
dx: 2, dy: -1, | |
}, | |
{ | |
dx: -1, dy: 2, | |
}, | |
] | |
}, | |
{ | |
rotation: 1, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: -1, dy: 0, | |
}, | |
{ | |
dx: 2, dy: 0, | |
}, | |
{ | |
dx: -1, dy: -2, | |
}, | |
{ | |
dx: 2, dy: 1, | |
}, | |
] | |
}, | |
{ | |
rotation: 2, | |
direction: -1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: 1, dy: 0, | |
}, | |
{ | |
dx: -2, dy: 0, | |
}, | |
{ | |
dx: 1, dy: 2, | |
}, | |
{ | |
dx: -2, dy: -1, | |
}, | |
] | |
}, | |
{ | |
rotation: 2, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: 2, dy: 0, | |
}, | |
{ | |
dx: -1, dy: 0, | |
}, | |
{ | |
dx: 2, dy: -1, | |
}, | |
{ | |
dx: -1, dy: 2, | |
}, | |
] | |
}, | |
{ | |
rotation: 3, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: -2, dy: 0, | |
}, | |
{ | |
dx: 1, dy: 0, | |
}, | |
{ | |
dx: -2, dy: 1, | |
}, | |
{ | |
dx: 1, dy: -2, | |
}, | |
] | |
}, | |
{ | |
rotation: 3, | |
direction: 1, | |
tests:[ | |
{ | |
dx: 0, dy: 0, | |
}, | |
{ | |
dx: 1, dy: 0, | |
}, | |
{ | |
dx: -2, dy: 0, | |
}, | |
{ | |
dx: 1, dy: 2, | |
}, | |
{ | |
dx: -2, dy: -1, | |
}, | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/babycourageous/ccd9fb96ec460168fcb836f07c4a0171#file-kicks-js-L306
LINE 306 should be
direction: -1
Already made a tetris clone in vanilla
javascripttypescript, thank you for your tetris in svelte guide, it had help me a lot in understanding how to use stores and just svelte in general!