Disasters Game

Submitted by ian on Wed, 04/17/2019 - 12:32

Image of the game

In a game I've been working on recently, I've made a system that can load maps and play different things. In this game, you have to survive a variety of disasters on randomly selected maps that I made.

To make the game work, I had to work on a system that could load the maps, play the disasters (and delete them once they finish), randomly select everything, and more. In fact, most of it is random. I've also worked to make the system easy to customize, like changing settings on how long disasters last, easily adding maps/disasters/bosses, how many disasters play per map, and more. All of the settings are variables, that are checked whenever the code runs.

Here is an example of my settings (will be updated as I update the game):

local maps = {
    "Bricks"
}
local disasters = {
    "Rain",
    "Avalanche",
    "Rising Lava",
    "Rising Acid",
    "The Walls Are Closing In",
    "Acid Rain"
}

local bosses = {
    "TestBoss"
}
local intermission_mapchange = 30
local intermission_disasterchange = 5
local disasterspermap = 7
local disastertimeframe = 30
local bosstimeframe = 120

Later on, in the code, I have to load disasters somehow. To prevent them from playing while they shouldn't, they are saved in ServerStorage (I've coded disasters to only play when they are in workspace). When the game wants to play a disaster, it will find it in the folders and then clone it using Instance:Clone, then moves it to workspace where it can be seen by the player. When the disaster is over, it simply removes it using Instance:Destroy. The game repeats this process until a new map should be loaded. It simply loads the map the same way it loads disasters.