Files
GDevelop/newIDE/app/resources/examples/parse-json-from-api/parse-json-from-api.json
T
Florian Rival fd63f7bc96 Add Examples tab in CreateProjectDialog with new examples
Add a script to update web-app examples from the examples in resources/examples folder (used by IDE running on Electron
runtime).
2018-06-09 16:34:39 +01:00

659 lines
16 KiB
JSON
Executable File

{
"firstLayout": "",
"gdVersion": {
"build": 96,
"major": 4,
"minor": 0,
"revision": 0
},
"properties": {
"folderProject": false,
"linuxExecutableFilename": "",
"macExecutableFilename": "",
"packageName": "com.gametemplates.itch",
"projectFile": "C:\\Users\\szoszo\\Desktop\\Projects\\gametemplates\\gdevelop5\\parse-json-from-api\\game.json",
"useExternalSourceFiles": false,
"winExecutableFilename": "",
"winExecutableIconFile": "",
"name": "Parse JSON from SWAPI",
"author": "gametemplates.itch.io",
"windowWidth": 800,
"windowHeight": 600,
"latestCompilationDirectory": "C:\\Users\\szoszo\\Desktop\\parse-json-from-api",
"maxFPS": 60,
"minFPS": 10,
"verticalSync": false,
"extensions": [
{
"name": "BuiltinObject"
},
{
"name": "BuiltinAudio"
},
{
"name": "BuiltinVariables"
},
{
"name": "BuiltinTime"
},
{
"name": "BuiltinMouse"
},
{
"name": "BuiltinKeyboard"
},
{
"name": "BuiltinJoystick"
},
{
"name": "BuiltinCamera"
},
{
"name": "BuiltinWindow"
},
{
"name": "BuiltinFile"
},
{
"name": "BuiltinNetwork"
},
{
"name": "BuiltinScene"
},
{
"name": "BuiltinAdvanced"
},
{
"name": "Sprite"
},
{
"name": "BuiltinCommonInstructions"
},
{
"name": "BuiltinCommonConversions"
},
{
"name": "BuiltinStringInstructions"
},
{
"name": "BuiltinMathematicalTools"
},
{
"name": "BuiltinExternalLayouts"
}
],
"platforms": [
{
"name": "GDevelop JS platform"
}
],
"currentPlatform": "GDevelop JS platform"
},
"resources": {
"resources": [
{
"alwaysLoaded": false,
"file": "sw.png",
"kind": "image",
"name": "sw.png",
"smoothed": true,
"userAdded": false
}
],
"resourceFolders": []
},
"objects": [],
"objectsGroups": [],
"variables": [],
"layouts": [
{
"b": 155,
"disableInputWhenNotFocused": true,
"mangledName": "NewScene",
"name": "NewScene",
"oglFOV": 90,
"oglZFar": 500,
"oglZNear": 1,
"r": 155,
"standardSortMethod": true,
"stopSoundsOnStartup": true,
"title": "",
"v": 155,
"uiSettings": {
"grid": false,
"gridB": 255,
"gridG": 180,
"gridHeight": 32,
"gridOffsetX": 0,
"gridOffsetY": 0,
"gridR": 158,
"gridWidth": 32,
"snap": true,
"windowMask": false,
"zoomFactor": 1
},
"objectsGroups": [],
"variables": [
{
"name": "person_json",
"value": ""
},
{
"name": "planet_json",
"value": ""
},
{
"name": "person",
"value": ""
},
{
"name": "num",
"value": "1"
},
{
"name": "prev_num",
"value": "1"
},
{
"name": "planet",
"value": ""
}
],
"instances": [
{
"angle": 0,
"customSize": false,
"height": 0,
"layer": "",
"locked": false,
"name": "logo",
"width": 0,
"x": 258.297,
"y": 33.2376,
"zOrder": 1,
"numberProperties": [],
"stringProperties": [],
"initialVariables": []
},
{
"angle": 0,
"customSize": false,
"height": 0,
"layer": "",
"locked": false,
"name": "person",
"width": 0,
"x": 255.89,
"y": 240.911,
"zOrder": 2,
"numberProperties": [],
"stringProperties": [],
"initialVariables": []
},
{
"angle": 0,
"customSize": false,
"height": 0,
"layer": "",
"locked": false,
"name": "message",
"width": 0,
"x": 20.7414,
"y": 565.168,
"zOrder": 3,
"numberProperties": [],
"stringProperties": [],
"initialVariables": []
}
],
"objects": [
{
"name": "logo",
"type": "Sprite",
"updateIfNotVisible": false,
"variables": [],
"behaviors": [],
"animations": [
{
"name": "",
"useMultipleDirections": false,
"directions": [
{
"looping": false,
"timeBetweenFrames": 1,
"sprites": [
{
"hasCustomCollisionMask": false,
"image": "sw.png",
"points": [],
"originPoint": {
"name": "origine",
"x": 0,
"y": 0
},
"centerPoint": {
"automatic": true,
"name": "centre",
"x": 0,
"y": 0
},
"customCollisionMask": []
}
]
}
]
}
]
},
{
"bold": false,
"italic": false,
"name": "person",
"smoothed": true,
"type": "TextObject::Text",
"underlined": false,
"variables": [],
"behaviors": [],
"string": "person",
"font": "Play-Regular.ttf",
"characterSize": 30,
"color": {
"b": 28,
"g": 231,
"r": 248
}
},
{
"bold": false,
"italic": false,
"name": "message",
"smoothed": true,
"type": "TextObject::Text",
"underlined": false,
"variables": [],
"behaviors": [],
"string": "Press any key or left mouse button to get a random Star Wars character from SWAPI",
"font": "Play-Regular.ttf",
"characterSize": 20,
"color": {
"b": 255,
"g": 255,
"r": 255
}
}
],
"events": [
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "at the beginning of the scene, parse JSON from SWAPI",
"comment2": ""
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"inverted": false,
"value": "DepartScene"
},
"parameters": [
""
],
"subInstructions": []
}
],
"actions": [
{
"type": {
"inverted": false,
"value": "SceneBackground"
},
"parameters": [
"",
"\"0;0;0;\""
],
"subInstructions": []
}
],
"events": [
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Link",
"include": {
"includeConfig": 0
},
"target": "parse_json"
}
]
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "if any key or the left mouse button is pressed, parse JSON from SWAPI",
"comment2": ""
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Standard",
"conditions": [
{
"type": {
"inverted": false,
"value": "BuiltinCommonInstructions::Or"
},
"parameters": [],
"subInstructions": [
{
"type": {
"inverted": false,
"value": "AnyKeyPressed"
},
"parameters": [
""
],
"subInstructions": []
},
{
"type": {
"inverted": false,
"value": "SourisBouton"
},
"parameters": [
"",
"Left"
],
"subInstructions": []
}
]
},
{
"type": {
"inverted": false,
"value": "BuiltinCommonInstructions::Once"
},
"parameters": [],
"subInstructions": []
}
],
"actions": [],
"events": [
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Link",
"include": {
"includeConfig": 0
},
"target": "parse_json"
}
]
}
],
"layers": [
{
"name": "",
"visibility": true,
"cameras": [
{
"defaultSize": true,
"defaultViewport": true,
"height": 0,
"viewportBottom": 1,
"viewportLeft": 0,
"viewportRight": 1,
"viewportTop": 0,
"width": 0
}
],
"effects": []
}
],
"behaviorsSharedData": []
}
],
"externalEvents": [
{
"associatedLayout": "NewScene",
"lastChangeTimeStamp": 0,
"name": "parse_json",
"events": [
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "Generate a random number",
"comment2": ""
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"inverted": false,
"value": "ModVarScene"
},
"parameters": [
"prev_num",
"=",
"Variable(num)"
],
"subInstructions": []
},
{
"type": {
"inverted": false,
"value": "ModVarScene"
},
"parameters": [
"num",
"=",
"Random(61)"
],
"subInstructions": []
}
],
"events": []
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "As long the new random number is the same as the previous number, generate a new random number to avoid repeating the same number twice",
"comment2": ""
},
{
"disabled": false,
"folded": false,
"infiniteLoopWarning": true,
"type": "BuiltinCommonInstructions::While",
"whileConditions": [
{
"type": {
"inverted": false,
"value": "VarScene"
},
"parameters": [
"prev_num",
"=",
"Variable(num)"
],
"subInstructions": []
}
],
"conditions": [],
"actions": [
{
"type": {
"inverted": false,
"value": "ModVarScene"
},
"parameters": [
"num",
"=",
"Random(61)"
],
"subInstructions": []
}
],
"events": []
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "Get a random person and planet from SWAPI using the random number we generated",
"comment2": ""
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"inverted": false,
"value": "SendRequest"
},
"parameters": [
"\"https://swapi.co/\"",
"\"api/people/\" + ToString(Variable(num)) + \"/\"",
"\"person\"",
"\"GET\"",
"",
"person_json"
],
"subInstructions": []
},
{
"type": {
"inverted": false,
"value": "SendRequest"
},
"parameters": [
"\"https://swapi.co/\"",
"\"api/planets/\" + ToString(Variable(num)) + \"/\"",
"\"planet\"",
"\"GET\"",
"",
"planet_json"
],
"subInstructions": []
}
],
"events": []
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Comment",
"color": {
"b": 109,
"g": 230,
"r": 255,
"textB": 0,
"textG": 0,
"textR": 0
},
"comment": "Parse the JSON we got from SWAPI in to variables and update the text to display name and genre of person and name of planet",
"comment2": ""
},
{
"disabled": false,
"folded": false,
"type": "BuiltinCommonInstructions::Standard",
"conditions": [],
"actions": [
{
"type": {
"inverted": false,
"value": "JSONToVariableStructure"
},
"parameters": [
"VariableString(person_json)",
"person"
],
"subInstructions": []
},
{
"type": {
"inverted": false,
"value": "JSONToVariableStructure"
},
"parameters": [
"VariableString(planet_json)",
"planet"
],
"subInstructions": []
},
{
"type": {
"inverted": false,
"value": "TextObject::String"
},
"parameters": [
"person",
"=",
"\"NAME: \" + VariableString(person.name) + NewLine() + \"GENDER: \" + VariableString(person.gender) + NewLine() + \"HOMEWORLD: \" + VariableString(planet.name)"
],
"subInstructions": []
}
],
"events": []
}
]
}
],
"externalLayouts": [],
"externalSourceFiles": []
}