First, you are defining the same set of variables twice - the ones in the loop are completely different to the ones outside the loop, and they'll get reset every time.
Next, you are using a variable called GrassY - from your code, it should be iGrassY
Then you are using an assignment in one of your 'if's - single equals means 'assign', double equals means 'compare'.
Finally, just changing the variables won't move the sprite - that seems like the effect you are hoping for in that code. You need to use the dbSprite function to move the sprite.
Here's what I think you are after:
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetDisplayMode ( 800, 600, 32 );
int iX = 0;
int iY = 0;
int iGrassY = 400;
int iGrassX = 0;
dbLoadImage ( "monster1.png", 1 );
dbLoadImage ( "monster2.png", 2 );
dbLoadImage ( "grass.png", 3 );
dbSprite ( 3, iGrassX, iGrassY, 3 );
dbSprite ( 1, iX, iY, 1 );
while ( LoopGDK ( ) )
{
if (iY < iGrassY)
iY += 1;
if (iY == iGrassY)
iY = iGrassY + 32;
dbSprite ( 1, iX, iY, 1 );
dbSync ( );
}
return;
}