Compare commits
10 Commits
ce01edd830
...
6de49449ae
Author | SHA1 | Date | |
---|---|---|---|
6de49449ae | |||
42a84bce44 | |||
7a522dde53 | |||
9cfcddad52 | |||
1c7bb3dc45 | |||
ef266c75db | |||
211639c073 | |||
0be1783252 | |||
9ca2d00c77 | |||
07639e8c3f |
18
LICENSE
Normal file
18
LICENSE
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
Copyright 2014-2019 Alex Yatskov
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
README.md
15
README.md
@ -1,4 +1,4 @@
|
|||||||
# Tetrys #
|
# Tetrys
|
||||||
|
|
||||||
Tetrys is a minimalist Tetris clone written in Python. It is cross-platform compatible and has basic gamepad support.
|
Tetrys is a minimalist Tetris clone written in Python. It is cross-platform compatible and has basic gamepad support.
|
||||||
There is presently no way to configure what the buttons do; that is an exercise left to the reader.
|
There is presently no way to configure what the buttons do; that is an exercise left to the reader.
|
||||||
@ -8,15 +8,6 @@ When running the application you can press the <kbd>N</kbd> key to start a new g
|
|||||||
of the current piece, and <kbd>Space</kbd> drops it to the bottom of the well instantly. A small shadow tetrad at the
|
of the current piece, and <kbd>Space</kbd> drops it to the bottom of the well instantly. A small shadow tetrad at the
|
||||||
bottom of the well indicates where the current piece will fall.
|
bottom of the well indicates where the current piece will fall.
|
||||||
|
|
||||||
## Requirements ##
|
Tetrys requires [Python](http://www.python.org/) and [pygame](http://www.pygame.org/).
|
||||||
|
|
||||||
* [Python 2.7](http://www.python.org/download/releases/2.7/)
|
![](img/tetrys.png)
|
||||||
* [pygame](http://www.pygame.org/)
|
|
||||||
|
|
||||||
## Screenshots ##
|
|
||||||
|
|
||||||
[![Game window](https://foosoft.net/projects/tetrys/img/tetrys-thumb.png)](https://foosoft.net/projects/tetrys/img/tetrys.png)
|
|
||||||
|
|
||||||
## License ##
|
|
||||||
|
|
||||||
MIT
|
|
||||||
|
BIN
img/tetrys.png
Normal file
BIN
img/tetrys.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
10
tetrys.py
10
tetrys.py
@ -35,8 +35,8 @@ class Tetrad:
|
|||||||
layout = list()
|
layout = list()
|
||||||
|
|
||||||
mask = self.block_configs[self.config][1] >> (16 * self.rotation)
|
mask = self.block_configs[self.config][1] >> (16 * self.rotation)
|
||||||
for bit in xrange(16):
|
for bit in range(16):
|
||||||
position = bit % 4, bit / 4
|
position = bit % 4, bit // 4
|
||||||
if mask & (1 << bit):
|
if mask & (1 << bit):
|
||||||
layout.append((self.position[0] + position[0], self.position[1] + position[1]))
|
layout.append((self.position[0] + position[0], self.position[1] + position[1]))
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ class Tetrad:
|
|||||||
|
|
||||||
|
|
||||||
def centered(self, width):
|
def centered(self, width):
|
||||||
return Tetrad((width / 2 - 2, 0), self.config, self.rotation)
|
return Tetrad((width // 2 - 2, 0), self.config, self.rotation)
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -113,8 +113,8 @@ class Board:
|
|||||||
|
|
||||||
|
|
||||||
def render_blocks(self, surface):
|
def render_blocks(self, surface):
|
||||||
for y in xrange(self.grid_dims[1]):
|
for y in range(self.grid_dims[1]):
|
||||||
for x in xrange(self.grid_dims[0]):
|
for x in range(self.grid_dims[0]):
|
||||||
self.render_block(surface, self.blocks[y][x], (x, y))
|
self.render_block(surface, self.blocks[y][x], (x, y))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user