How am I supposed to spawn stuff in random places

I have been trying to spawn some things between a certain x and y range. I have tried two things that have failed:
#1
Counting up with the mouse on the squares. It shows you what it’s x y position is. I multiplyed it by 32, because that is the number for each block. (Right?) I tried without the multiplcation too, but both did not work.

result:

#2
Using the extractions from other objects. I placed objects on each boundry and extracted their positions. I was sure this would work but it didn’t.

Here is the game link:
https://flowlab.io/game/view/1773141

Please help!

What is the repeater set at?

The object is not in the level, so nothing will spawn. The range of where to spawn the object (The Y) is only set to a range of 11, meaning it will all spawn in a line. Something else to note is that you’re spawning every thing in a single frame (Which works fine), but it spawns 1000 objects so there is a little bit of lag when loading the level (After you actually add the object to the level)

  1. 15 and 26 are not multiplied by 32
  2. You need to move the repeater Below the numbers.

There’s a scan order error that’s not updating the Y random block before the repeater.
I really suggest to just put the numbers you need Inside the Random blocks.

2 Likes

Yes, that was the try without the multiplication.
I will try again with your suggestions after school.

The object is actually there. (The green thingys from the second picture.)

I’m not sure how to make it have less lag, because the world is supposed to be a bit random. Like Minecraft. But maybe something where it spawns right where you are (inside your screen) and little by little spreads out (as you move in different directions.) But that sounds very tricky for little cause.

Is it fixed now? Seems like it’s working fine

Yeah. It is fixed, I’ll just put it onto the grid…

1 Like

some extra things, make sure to make objects have no friction to make jumping over them easier,and make those slopes and that boulder(?) have a polygon hit box for smoother collisions

If objects have no friction the player will not slow down. The boulder should have a Circle hitbox, it’s much smoother and is easier to generate.