Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Extension: <title> Load and Save (Objects) Made by God-Sonic #1565

Closed
3 tasks done
KillerDSonic opened this issue Mar 1, 2025 · 1 comment
Closed
3 tasks done
Labels
✨ New extension A new extension

Comments

@KillerDSonic
Copy link

KillerDSonic commented Mar 1, 2025

[Description]

It save and load object's variables, zorder, angles, and position. It can save and load multiple objects at a time.

How to use the extension

You need the object you want to save with the save behavior and the loader object with the loader behavior. In the event, there are two action . One is for save the object in the scene every 0.1 to 1 seconds that is save to storage. The other one load the object from storage in the scene.

Checklist

  • I've followed all of the best practices.
  • I confirm that this extension can be integrated to this GitHub repository, distributed and MIT licensed.
  • I am aware that the extension may be updated by anyone, and do not need my explicit consent to do so.

What tier of review do you aim for your extension?

Community (Unreviewed)

Example file

Don't have one.

Extension file

Extension Save & Load .json

{
  "author": "",
  "category": "Game mechanic",
  "extensionNamespace": "",
  "fullName": "Load and Save ",
  "helpPath": "",
  "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWNvbnRlbnQtc2F2ZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0xNSw5SDVWNUgxNU0xMiwxOUEzLDMgMCAwLDEgOSwxNkEzLDMgMCAwLDEgMTIsMTNBMywzIDAgMCwxIDE1LDE2QTMsMyAwIDAsMSAxMiwxOU0xNywzSDVDMy44OSwzIDMsMy45IDMsNVYxOUEyLDIgMCAwLDAgNSwyMUgxOUEyLDIgMCAwLDAgMjEsMTlWN0wxNywzWiIgLz48L3N2Zz4=",
  "name": "Load_and_Save",
  "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/ed9dc9aba04820ae44e5adf70bd3b955cd899dec13739488e94ae6ef2b6ef180_content-save.svg",
  "shortDescription": "Load and save object or objects variable and position \n.",
  "version": "1.0",
  "description": "Load and save object oo objects variable and position. This include angle and other parts to the objects. The Object variables array and structure main name must be \"Variables\" for it with not work. And storage must not be group name that is \"Obj\" and storage name that is \"Save\"",
  "tags": [
    "Save",
    "Load",
    "Objects"
  ],
  "authorIds": [
    "S1Dr159GgRVwFTmtngHmd8MIMUs2"
  ],
  "dependencies": [],
  "globalVariables": [],
  "sceneVariables": [
    {
      "name": "Array",
      "type": "array",
      "children": []
    },
    {
      "name": "Store",
      "type": "string",
      "value": ""
    },
    {
      "name": "J_Array",
      "type": "array",
      "children": []
    },
    {
      "name": "Array_Json",
      "type": "string",
      "value": "0"
    },
    {
      "name": "Climb",
      "type": "number",
      "value": 0
    },
    {
      "name": "Number",
      "type": "string",
      "value": "0"
    },
    {
      "name": "Array_Num",
      "type": "number",
      "value": 0
    },
    {
      "name": "Load",
      "type": "string",
      "value": "0"
    },
    {
      "name": "Json",
      "type": "string",
      "value": "0"
    }
  ],
  "eventsFunctions": [
    {
      "description": "Save a object or objects during a certain time period",
      "fullName": "Save Object",
      "functionType": "Action",
      "name": "Save_Object",
      "sentence": "save _PARAM1_ on layer _PARAM5_ every _PARAM3_ seconds. The loader that is _PARAM2_. (_PARAM4_)",
      "events": [
        {
          "type": "BuiltinCommonInstructions::Standard",
          "conditions": [],
          "actions": [
            {
              "type": {
                "value": "Cache"
              },
              "parameters": [
                "Loader"
              ]
            }
          ]
        },
        {
          "type": "BuiltinCommonInstructions::Standard",
          "conditions": [
            {
              "type": {
                "value": "BuiltinCommonInstructions::Once"
              },
              "parameters": []
            }
          ],
          "actions": [
            {
              "type": {
                "value": "ResetTimer"
              },
              "parameters": [
                "",
                "\"Object\""
              ]
            }
          ]
        },
        {
          "folded": true,
          "type": "BuiltinCommonInstructions::Standard",
          "conditions": [
            {
              "type": {
                "value": "CompareTimer"
              },
              "parameters": [
                "",
                "\"Object\"",
                ">=",
                "Time"
              ]
            },
            {
              "type": {
                "value": "BuiltinCommonInstructions::Once"
              },
              "parameters": []
            }
          ],
          "actions": [
            {
              "type": {
                "value": "ResetTimer"
              },
              "parameters": [
                "",
                "\"Object\""
              ]
            },
            {
              "type": {
                "value": "VariableClearChildren"
              },
              "parameters": [
                "Array"
              ]
            }
          ],
          "events": [
            {
              "folded": true,
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [
                {
                  "type": {
                    "value": "BehaviorActivated"
                  },
                  "parameters": [
                    "Loader",
                    "Extra"
                  ]
                }
              ],
              "actions": [
                {
                  "type": {
                    "value": "Create"
                  },
                  "parameters": [
                    "",
                    "Loader",
                    "0",
                    "0",
                    ""
                  ]
                }
              ],
              "events": [
                {
                  "type": "BuiltinCommonInstructions::Standard",
                  "conditions": [
                    {
                      "type": {
                        "value": "AjoutObjConcern"
                      },
                      "parameters": [
                        "",
                        "Loader"
                      ]
                    }
                  ],
                  "actions": [
                    {
                      "type": {
                        "value": "Wait"
                      },
                      "parameters": [
                        "0.1"
                      ]
                    },
                    {
                      "type": {
                        "value": "Delete"
                      },
                      "parameters": [
                        "Loader",
                        ""
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [],
              "actions": [
                {
                  "type": {
                    "value": "DeleteGroupFichier"
                  },
                  "parameters": [
                    "\"Save\"",
                    "\"Obj\""
                  ]
                },
                {
                  "type": {
                    "value": "EcrireFichierTxt"
                  },
                  "parameters": [
                    "\"Save\"",
                    "\"Obj\"",
                    "Array_Json"
                  ]
                }
              ]
            },
            {
              "type": "BuiltinCommonInstructions::ForEach",
              "object": "Object",
              "conditions": [],
              "actions": [
                {
                  "type": {
                    "value": "SceneVariablePushString"
                  },
                  "parameters": [
                    "Array",
                    "Object.ObjectName()"
                  ]
                },
                {
                  "type": {
                    "value": "SceneVariablePushNumber"
                  },
                  "parameters": [
                    "Array",
                    "Object.X()"
                  ]
                },
                {
                  "type": {
                    "value": "SceneVariablePushNumber"
                  },
                  "parameters": [
                    "Array",
                    "Object.Y()"
                  ]
                },
                {
                  "type": {
                    "value": "SceneVariablePushNumber"
                  },
                  "parameters": [
                    "Array",
                    "Object.Angle()"
                  ]
                },
                {
                  "type": {
                    "value": "SceneVariablePushNumber"
                  },
                  "parameters": [
                    "Array",
                    "Object.ZOrder()"
                  ]
                },
                {
                  "type": {
                    "value": "SceneVariablePushString"
                  },
                  "parameters": [
                    "Array",
                    "ObjectVarToJSON(Object,Variables)"
                  ]
                },
                {
                  "type": {
                    "value": "SetStringVariable"
                  },
                  "parameters": [
                    "Array_Json",
                    "=",
                    "ToJSON(Array)"
                  ]
                }
              ]
            },
            {
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [
                {
                  "type": {
                    "value": "SceneInstancesCount"
                  },
                  "parameters": [
                    "",
                    "Object",
                    "=",
                    "0"
                  ]
                }
              ],
              "actions": [
                {
                  "type": {
                    "value": "VariableClearChildren"
                  },
                  "parameters": [
                    "Array"
                  ]
                },
                {
                  "type": {
                    "value": "SetStringVariable"
                  },
                  "parameters": [
                    "Array_Json",
                    "=",
                    "ToJSON(Array)"
                  ]
                }
              ]
            }
          ]
        }
      ],
      "parameters": [
        {
          "description": "Save Object",
          "name": "Object",
          "type": "objectList"
        },
        {
          "description": "Loader",
          "name": "Loader",
          "type": "objectList"
        },
        {
          "description": "Set time between 0.1 to 1 seconds",
          "name": "Time",
          "type": "expression"
        },
        {
          "description": "For Loader",
          "name": "Extra",
          "supplementaryInformation": "Load_and_Save::Loader",
          "type": "behavior"
        },
        {
          "description": "The layer that the object is on",
          "name": "Layer",
          "type": "layer"
        }
      ],
      "objectGroups": []
    },
    {
      "description": "Load a object or objects during a certain time period",
      "fullName": "Load the Object",
      "functionType": "Action",
      "name": "Load_Object",
      "sentence": "Load _PARAM1_ on the scene.",
      "events": [
        {
          "folded": true,
          "type": "BuiltinCommonInstructions::Standard",
          "conditions": [
            {
              "type": {
                "value": "DepartScene"
              },
              "parameters": [
                ""
              ]
            }
          ],
          "actions": [
            {
              "type": {
                "value": "ReadStringFromStorage"
              },
              "parameters": [
                "\"Save\"",
                "\"Obj\"",
                "",
                "Load"
              ]
            }
          ],
          "events": [
            {
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [],
              "actions": [
                {
                  "type": {
                    "value": "JSONToVariableStructure2"
                  },
                  "parameters": [
                    "VariableString(Load)",
                    "J_Array"
                  ]
                }
              ]
            },
            {
              "folded": true,
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [
                {
                  "type": {
                    "value": "BuiltinCommonInstructions::Once"
                  },
                  "parameters": []
                }
              ],
              "actions": [
                {
                  "type": {
                    "value": "Create"
                  },
                  "parameters": [
                    "",
                    "Object_1",
                    "0",
                    "0",
                    ""
                  ]
                },
                {
                  "type": {
                    "value": "Wait"
                  },
                  "parameters": [
                    "0.01"
                  ]
                }
              ],
              "events": [
                {
                  "type": "BuiltinCommonInstructions::Standard",
                  "conditions": [
                    {
                      "type": {
                        "value": "PosX"
                      },
                      "parameters": [
                        "Object_1",
                        "=",
                        "0"
                      ]
                    },
                    {
                      "type": {
                        "value": "PosY"
                      },
                      "parameters": [
                        "Object_1",
                        "=",
                        "0"
                      ]
                    }
                  ],
                  "actions": [
                    {
                      "type": {
                        "value": "Delete"
                      },
                      "parameters": [
                        "Object_1",
                        ""
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "BuiltinCommonInstructions::Standard",
              "conditions": [
                {
                  "type": {
                    "value": "BuiltinCommonInstructions::Once"
                  },
                  "parameters": []
                }
              ],
              "actions": [
                {
                  "type": {
                    "value": "SetNumberVariable"
                  },
                  "parameters": [
                    "Climb",
                    "=",
                    "0"
                  ]
                }
              ]
            },
            {
              "folded": true,
              "type": "BuiltinCommonInstructions::Repeat",
              "repeatExpression": "VariableChildCount(J_Array)/6",
              "conditions": [],
              "actions": [],
              "events": [
                {
                  "folded": true,
                  "type": "BuiltinCommonInstructions::Standard",
                  "conditions": [],
                  "actions": [
                    {
                      "type": {
                        "value": "ModVarSceneTxt"
                      },
                      "parameters": [
                        "Number",
                        "=",
                        "J_Array[Climb]"
                      ]
                    }
                  ],
                  "events": [
                    {
                      "type": "BuiltinCommonInstructions::Standard",
                      "conditions": [
                        {
                          "type": {
                            "value": "VarSceneTxt"
                          },
                          "parameters": [
                            "Number",
                            "!=",
                            "Object_1.ObjectName()"
                          ]
                        },
                        {
                          "type": {
                            "value": "BuiltinCommonInstructions::Once"
                          },
                          "parameters": []
                        }
                      ],
                      "actions": [
                        {
                          "type": {
                            "value": "SetNumberVariable"
                          },
                          "parameters": [
                            "Climb",
                            "+",
                            "6"
                          ]
                        }
                      ]
                    },
                    {
                      "folded": true,
                      "type": "BuiltinCommonInstructions::Standard",
                      "conditions": [
                        {
                          "type": {
                            "value": "VarSceneTxt"
                          },
                          "parameters": [
                            "Number",
                            "=",
                            "Object_1.ObjectName()"
                          ]
                        }
                      ],
                      "actions": [
                        {
                          "type": {
                            "value": "Create"
                          },
                          "parameters": [
                            "",
                            "Object_1",
                            "1",
                            "1",
                            ""
                          ]
                        }
                      ],
                      "events": [
                        {
                          "type": "BuiltinCommonInstructions::Standard",
                          "conditions": [
                            {
                              "type": {
                                "value": "PosX"
                              },
                              "parameters": [
                                "Object_1",
                                "=",
                                "1"
                              ]
                            },
                            {
                              "type": {
                                "value": "PosY"
                              },
                              "parameters": [
                                "Object_1",
                                "=",
                                "1"
                              ]
                            }
                          ],
                          "actions": [
                            {
                              "type": {
                                "value": "MettreAutourPos"
                              },
                              "parameters": [
                                "Object_1",
                                "J_Array[Climb+1]",
                                "J_Array[Climb+2]",
                                "0",
                                "J_Array[Climb+3]"
                              ]
                            },
                            {
                              "type": {
                                "value": "SetAngle"
                              },
                              "parameters": [
                                "Object_1",
                                "=",
                                "J_Array[Climb+3]"
                              ]
                            },
                            {
                              "type": {
                                "value": "ChangePlan"
                              },
                              "parameters": [
                                "Object_1",
                                "=",
                                "J_Array[Climb + 4]"
                              ]
                         
@KillerDSonic KillerDSonic added the ✨ New extension A new extension label Mar 1, 2025
@D8H
Copy link
Contributor

D8H commented Mar 1, 2025

The bot needs a zip to create a PR.

@D8H D8H closed this as completed Mar 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ New extension A new extension
Projects
None yet
Development

No branches or pull requests

2 participants