Random Enemy Spawn

Godot Version



Good Day everyone! I would like to ask for help about my 2d platformer game. I can’t figure out the problem in my code. Basically my game is a high score chasing game where the cat(player) collects the fish(coin) as long as the cat avoids touching the enemies(arrows, spikes). I can’t figure out how to spawn falling arrow at a random fixed area in tilemap. I tried to print the output to check if the spawning location at a random position is working. It is working but, the arrow itself on the game is always spawning at the same position. the arrows are incrementing every after 2 fish have been collected by the player. I could send a google drive link for you guys to check my work if you like to see it.

Is it possible the random position needs to be scaled?

IE, if your tiles are 32x32 but you’re generating a random integer from 1-10, then those positions might all appear identical unless you’re multiplying them by the size of your tiles.

If not , a screenshot of where they’re spawning relative to your tilemap might help diagnose the issue.

I’ve already fixed it. Thanks!