What you are asking is perfectly possible to do in GD, but is a huge question.
One question that to be answered could take an entire book on how to design random worlds.
The most summarized answer to
How to generate random worlds?
Creating trees of logical structures capable of making random decisions within certain ranges
This does not mean that creating 2D random worlds is an incomprehensible science or something impossible to do, but it does require at least some knowledge and experience in game logic… and this in turn implies understanding logical blocks and progammatic components, for example :
I don’t know what your skills are, but my advice is to give a good and deep read to the GD WIKI, follow the game creation tutorials, take a look at the examples included in your GD installation, and start with simpler things.
I’m just working on a video game in which there are going to be completely random levels.
For now, I have worked on generating trees with random shapes and random ground decoration. Something very basic.
This links takes to the post where I maintain a devlog of the game and comment on some of those topics: [WIP] FORESTFUL [Updated JULY 13] Finished ground merging algorithm (downloable example)
I’ll give you a basic idea of how to generate random elements in a level:
At the beginning of a scene iterate (with a for each object… loop) through each instance of the ground sprite and randomly place (evaluating a random result through the RandomInRange expression) some element (flowers or rocks or trees) on top of each piece of ground.
Regarding how to save a random world, you will need to catalog each random element of the level (its position and characteristics) in a structure of nested variables that you will later have to save in a file. You will also need to create the events capable of recreating the elements from the data stored in that file.