Hey i’m new to gdevelop, i’m creating a flappy bird(ish) ( rpg elements ) kinda of game, for the sae of simplicity treat it like just flappy bird.
I have pretty much all the mechanics figured out, i’ve done test code for the mechanics i want to implement, the only thing i’m not beeing able to figure out is how to make randomly generated barriers ( or pipes like they appear in real flapy bird), i need each pair of them to spawn in line with eachother, i need them to spawn with random distances appart in the middle of each pair ( but i need a minimum distance in order for it to be do-able), i need them to spawn at random distances in front of the player, but i need both a minimum and maximum distance.
I’ve also run into a couple of problems with the things that i’ve tried, ( i use platforms as pipes ) the pipes have no colosion from the front side, some dont have colosion at all past the top of them, invisible pipes spawning, trying to spawn top pipes with the x position of bottom pipes spawns them slightly of to the side but it’s not consistent.
( also i don’t know why, i can export to windows just fine, but i can’t export to android, it just fails, and to web i get the link but when i open it it’s just a black screen )
Basiccly i’m struggling, i would apreciate some pointers, any help would be nice really.
Thanks in advance for any help.
For the random distance between pipes, I would use a timer. Each time you create a new pipe generate (only once) a random number an store it in a variable and reset a “create pipe” timer. Then if the timer is greater than the random number create a new pipe.
Now GD supports random ranges, so no more need for “min + Random(max - min)”, the final result would be:
Conditions: Value of timer "create pipe" is greater than Variable(create_pipe)
Actions: Reset timer "create pipe"
Do = RandomInRange(2, 3) to variable create_pipe
Create a new pipe at the end of the screen
I’ve put 2 and 3 as the minimum and maximum time to create a new pipe, of course put your own values.
Pipe size, it depends on your pipes sprite objects, the idea is to generate a random value (in range) to locate the top pipe at a position between the top of the screen and the bottom - minimum space between pipes. Then locate the bottom pipe at the position of the top pipe + minimum space between pipes + random offset value.
Ghost pipes, check that you’re creating the pipes in the right layer, that you’re not spawning pipes over the player and your collision checking events.
Failing Android build, make sure you’ve set the application icons (Project panel >> Icons).
Web black screen, yeah, I think it’s a bug. But it will work fine if you export your project for web locally and upload it to a server. Thanks for the reminder