B
Blueoriontiger
Guest
Hello,
Long story short, I have a tile-matching game that gets its data from a JSON file, as an array. When one enters the playing area, a script generates the play area as an object from the JSON, creating the area where the player can drag the right tiles to the correct spot.
The datasets are organized by a "family", so if tiles of a different family are spawned, they will not fit into the tileset.
I want to make an area where multiple families of objects are spawned, so the player has 2-3 different areas to contend with. However, I can't seem to get it to spawn more than one group at a time.
This is my code below that calls the script to spawn the tiles. This is in the Create section of an invisible object in the play area, and Script_Game_CreateMatchData is the actual script that's called:
-
if(room == Room_Game_Alone)
{
gameDataMap = json_decode(Script_Game_CreateMatchData(6)) //number in brackets denotes which family spawns; -1 for a random family.
name = gameDataMap[?"name"]
description = gameDataMap[?"description"]
optionBlocksList = gameDataMap[?"optionBlocksList"]
jsonAnswers = json_encode(gameDataMap[?"Answers"])
pagNum = ceil(ds_list_size(optionBlocksList)/2/displayNum)
Script_Game_CreateAnswers(jsonAnswers,name)
event_perform(ev_other,ev_user0)
}
else
{
-
Someone told me if I call the function twice and change the family in the 2nd call, I'll be able to get it to spawn with multiple blocks. But for the life of me I cannot figure out how to get it to call a second time. I've tried repeating json_decode to no success; I also realize if I try to give it a different variable, it'll not plug in directly to the scorekeeping and UI displays I have set up.
Any suggestions are appreciated. Thanks.
Long story short, I have a tile-matching game that gets its data from a JSON file, as an array. When one enters the playing area, a script generates the play area as an object from the JSON, creating the area where the player can drag the right tiles to the correct spot.
The datasets are organized by a "family", so if tiles of a different family are spawned, they will not fit into the tileset.
I want to make an area where multiple families of objects are spawned, so the player has 2-3 different areas to contend with. However, I can't seem to get it to spawn more than one group at a time.
This is my code below that calls the script to spawn the tiles. This is in the Create section of an invisible object in the play area, and Script_Game_CreateMatchData is the actual script that's called:
-
if(room == Room_Game_Alone)
{
gameDataMap = json_decode(Script_Game_CreateMatchData(6)) //number in brackets denotes which family spawns; -1 for a random family.
name = gameDataMap[?"name"]
description = gameDataMap[?"description"]
optionBlocksList = gameDataMap[?"optionBlocksList"]
jsonAnswers = json_encode(gameDataMap[?"Answers"])
pagNum = ceil(ds_list_size(optionBlocksList)/2/displayNum)
Script_Game_CreateAnswers(jsonAnswers,name)
event_perform(ev_other,ev_user0)
}
else
{
-
Someone told me if I call the function twice and change the family in the 2nd call, I'll be able to get it to spawn with multiple blocks. But for the life of me I cannot figure out how to get it to call a second time. I've tried repeating json_decode to no success; I also realize if I try to give it a different variable, it'll not plug in directly to the scorekeeping and UI displays I have set up.
Any suggestions are appreciated. Thanks.
Attachments
-
143.3 KB Views: 5