I am trying to get a platform to randomly generate somewhere on the right side of the screen, move to the left, and lastly disappear once it hits the left edge and start over from some other random spot on the right side of the display. I feel like this should be really easy but whenever I load my code the platform just randomly shoots around in the y-axis of the far right of the display.
here is the code snippet of code giving me trouble
[dbSprite(2, 500, dbRnd(500), 4);
while (LoopGDK( ))
{
dbRotateSprite(2, 90);
dbMoveSprite(2, -5);
dbRotateSprite(2, 0);
if (dbSpriteX(2) > -500)
{
dbSprite(2, 500, dbRnd(500), 4);
}
]
4 is just the image used for the platform.
adsfffffdscsdd