Hey everyone, question is i have my random set as such
random_number1 = rand() % 9;
random_number2 = rand() % 9;
Then i am spawning my monster as
//check for spawning on player
if(game[random_number1][random_number2]!=game[posX][posY]){
game[random_number1][random_number2] = monster;
}
Question is i want to despawn the previous position of the monster but the problem is i have just one variable for monster as such
monster = 'T'
and i am setting them in my array for the game as such
game[8][7] = monster;
game[7][7] = monster;
game[7][8] = monster;
and i want to delete it's previous space everytime its randomly generated a new spot on the grid.So any advice is appreciated.
Of course the first time you shouldn't do that (there are no previous random numbers!) but you can figure out a way to take care of it. Isn't this solving your problem?