I creating a 2d computer game, and I want to put enemies that in that appear at random coordinates. The problem is i'm not sure entirely how to do it. I have the "enemy" in a array of 30,and then i want to put these 30 enemies on a map, with separate random x y coordinates,the map also has a set x y coordinates already, 350 x, 20000 y so i want the random coordinates between the map range e.g. 200 x,4000 y. Also if possible to refresh them when they are destroyed or, moved off screen.
This is what i i have tried already, only the enemies or at least one of them are "destroyed" before they seem to be blitted.
(aEnemy[m].posX2)= rand() % 350 + 1; (rand()%350)+1;
(aEnemy[m].posY2)= rand() % 20000 + 1; (rand()%20000)+1
Please help me.