Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - greenman76

Pages: [1]
1
System / Re: Time/Clock
« on: March 03, 2015, 07:23:16 pm »
Thanks, that fixed it.  8)

2
System / Time/Clock
« 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?

Pages: [1]