Jump to content

  • Log In with Google      Sign In   
  • Create Account


iQuality

Member Since 17 Aug 2012
Offline Last Active Aug 18 2012 11:53 AM
-----

Posts I've Made

In Topic: C++. A loop for rendering array of blocks

18 August 2012 - 11:54 AM

The problem is solved... I use timer. Thanks for attention. The topic may be closed

In Topic: C++. A loop for rendering array of blocks

18 August 2012 - 06:57 AM

Are you wanting to move one object, and then a few seconds later, the next object? Are you wanting a delay/pause in time before each object moves?

Yes, your understand me correctly. But the problem of delay - it`s stoppes all the "game loop", it will just pause for a while all loop, at as a result it would do nothing except of changing the speed of movement.
I`ll explain it in code:

while( n <= objects)
{
array[n].x+=0.02;
SDL_Delay(2000) // the code stoppes for 2 seconds, so the iterations stops too. As a result the 'n = 0' object moves fo "0.02" pixels,
//then stoppes for 2 seconds, and after it another 'n = 1'object moves for "0.02" pixels and stoppes.
n++;
}


that will move in column one after another


I think this part needs to be explained in a little more detail.

If you want to "see" anything move, you'll have to render your scene after every single displacement. Also, it might help to position your objects in different locations; Right now, they're all initialized to the exact same values, so x and y are set to 0 and 200, respectively.


Yes, with rendering scenes all correct, the problem is with movement objects, like Goran Milovanovic says, I need a delay after all of my objects.
In another word, i`m making like simple "tower defence game", and i need to generate my enemies, that will move in column, without collision.

PARTNERS