You would more want to do it on a timer based system, like:
int timer=0;
bool settimer=false;
int spritemovements=0;
bool movesprite=true;
if(spritemovements==10)
{
settimer=true;
movesprite=false;
}
if(settimer)
{
timer++;
}
if(timer>9)
{
timer=0;
settimer=false;
movesprite=true;
spritemovements=0;
}
if(movesprite==true)
{
//code to move the sprite here
spritemovements++;
}
Thats just an example, but you get the idea, you want the movement code to be dependant on if the timer is ticking or not, once the timer stops ticking, then move the sprite. Then count how many times you move the sprite, and once it reaches the desired amount of times, stop the sprite and start the timer again.
Here's a working program to demonstrate:
// Dark GDK - The Game Creators - www.thegamecreators.com
// the wizard has created a very simple 3D project that uses Dark GDK
// it can be used as a starting point in making your own 3D games
// whenever using Dark GDK you must ensure you include the header file
#include "DarkGDK.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbAutoCamOff();
dbPositionCamera(0, 0, 150);
dbPointCamera(0, 0, 0);
int timer=0;
bool timerset=false;
bool movesprite=true;
int spritemovements=0;
bool settimer=false;
dbMakeObjectPlane(1, 20, 20);
dbSetObjectToCameraOrientation(1);
while ( LoopGDK ( ) )
{
if(spritemovements==10)
{
settimer=true;
movesprite=false;
}
if(settimer)
{
timer++;
}
if(timer>30)
{
timer=0;
settimer=false;
movesprite=true;
spritemovements=0;
}
if(movesprite==true)
{
dbPositionObject(1, dbObjectPositionX(1), dbObjectPositionY(1)-1, 0);
spritemovements++;
}
dbSync ( );
}
// and now everything is ready to return back to Windows
return;
}