Successfully reported this slideshow.
Your SlideShare is downloading. ×

Tetris_game_presentation_for_github.pptx

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 13 Ad

More Related Content

Recently uploaded (20)

Advertisement

Tetris_game_presentation_for_github.pptx

  1. 1. Tetris game by Mila
  2. 2. Rules and capabilities Rotate Clockwise Escape from game :) Move right Move left Move Down Rotate Counter Clockwise
  3. 3. Rules and capabilities Only 1 speed 1 line = 1 score Lose only if you reach the ceiling No “winning” score
  4. 4. Logics drawField drawBlock Rectangle
  5. 5. keyProc(hWnd, wParam) switch (wParam) MOVE / DOWN / ROTATE InvalidateRect WM_KEYDOWN ID_BUTTON_START initializeGame WM_COMMAND GameStatus = PLAYING SetTimer createTetromino initializeGame downTetromino updateScore InvalidateRect WM_TIMER WM_PAINT InvalidateRect WM_PAINT InvalidateRect Logics
  6. 6. Tetromino.c • next_t = *currentTetromino • switch (type): LEFT / RIGHT / DOWN BOOL moveTetromino(Tetromino* currentTetromino, MoveType type) • t.tetromino[i][j] = tetrominos[type][i][j] • *currentTetromino = t BOOL createTetromino(Tetromino* currentTetromino, int x, int y, int type) BOOL downTetromino (Tetromino* currentTetromino, GameStatus* currentGameStatus, int* score) • moveTetromino(currentTetromino, MOVE_TO_DOWN) • Check if can`t DOWN > stopTetromino, *score = eraseLines() • Check if can`t createTetromino > GAME OVER • noCollisionCheck • placeTetromino(currentTetromino) • removeTetromino(currentTetromino) • placeTetromino(&next_t) • *currentTetromino = next_t BOOL rotateTetromino(Tetromino* currentTetromino, RotateType type) • Tetromino next_t = *currentTetromino • next_t[i][j] = currentTetromino->[TETROMINO_HEIGHT - 1 - j][i] OR • next_t[i][j] = currentTetromino->[j][TETROMINO_WIDTH - 1 - i] • removeTetromino(currentTetromino) • placeTetromino(&next_t) • *currentTetromino = next_t
  7. 7. Tetromino-helper.c void stopTetromino(Tetromino* t) void removeTetromino(Tetromino* t) BOOL placeTetromino(Tetromino* t) void forFunction(int y1, int y2, int x1, int x2, Tetromino* t, void (*innerFunction)(Tetromino*, int, int)) void innerStopTetromino(Tetromino* t, int x, int y) void innerPlaceTetromino(Tetromino* t, int x, int y) void innerRemoveTetromino(Tetromino* t, int x, int y)
  8. 8. Tetromino-helper.c void shiftLine(int n) BOOL isFullLine(int n) BOOL noCollisionCheck(Tetromino* t, int x, int y) int eraseLines()
  9. 9. rotateTetromino: Clockwise
  10. 10. rotateTetromino: Clockwise
  11. 11. rotateTetromino: Counter CW
  12. 12. rotateTetromino: Counter CW
  13. 13. Thank you! Let`s play!

×