S
Shajian28
Guest
I am creating a game in which fruit randomly appear on the screen (within a set range).
The problem is that the fruit sometimes appears in a wall. When the fruit hits a wall it jumps to a random spot again until it finds an open spot. The game works, but I know the coding could be more efficient.
Is there a way to make the fruit randomly appear in an open spot the first time every time?
This is the code I got so far (when fruit is initially created):
instance_create(random_range(32,704), random_range(96,416), obj_orange)
The problem is that the fruit sometimes appears in a wall. When the fruit hits a wall it jumps to a random spot again until it finds an open spot. The game works, but I know the coding could be more efficient.
Is there a way to make the fruit randomly appear in an open spot the first time every time?
This is the code I got so far (when fruit is initially created):
instance_create(random_range(32,704), random_range(96,416), obj_orange)