I'd like to create a Snake game, and for that, I'd like to position the sweet which makes the snake bigger in a random position.
For that, I use this code in the create event of the object bonbon :
position_x = round(random(10)); position_y = round(random(10)); x = position_x*16; y = position_y*16;
But the sprite of this object is always in the same position of the room.
I tried changing the argument to the function
random(), and then it changed the position of the sweet once, but after a rerun, the position doesn't change from that new location.
I think the position of the sweet is set using the argument to the
How can the position of the sweet be randomized? Why does the random function return the same values every time I run the game?
Thanks to DMGregory, I changed the code and this code works :
randomize(); position_x = irandom(10); position_y = irandom(10); x = position_x*16; y = position_y*16;