2
« on: March 03, 2015, 12:17:25 pm »
I'm writing a Tetris game for class and I'm having a problem with getting the block to move down in incremented time. I've tried quite a few ways and searched all over but have not found a way that works for me. Here is what I currently have. Hopefully someone can point out an obvious mistake.
while (window.isOpen() && lost == false)
{
//clear the window, draw the blocks, then display the window.
window.clear();
drawWell(*gameWell, LAYOUT_BOARD_TOP, LAYOUT_BOARD_LEFT, BLOCK_SIZE_PIXELS);
drawTetrimino(tetriminoInPlay, LAYOUT_BOARD_TOP, LAYOUT_BOARD_LEFT, BLOCK_SIZE_PIXELS);
window.display();
sf::Clock clock;
sf::Time dropTime = sf::milliseconds(100);
sf::Time gameTime = clock.getElapsedTime();
if (gameTime.asMilliseconds() > dropTime.asMilliseconds())
{
do stuff that needs doing
}
For some reason the stuff never gets done. What am I doing wrong?