GDevelopApp / GDevelop-extensions

Repository of behaviors, actions, conditions and expressions to be used in GDevelop for creating games
https://gdevelop.io
MIT License
131 stars 52 forks source link

New extension: Return Game Version #232

Closed UlisesFreitas closed 3 years ago

UlisesFreitas commented 3 years ago

Description

I made this simple extension since some users ask this in the forum https://forum.gdevelop-app.com/t/game-version-to-variable/26120 https://forum.gdevelop-app.com/t/is-there-a-way-to-check-the-game-version-in-a-variable/32317

A simple extension string expression that returns the current version number the user set in Game settings->Properties

How to use the extension

  1. Simply add a Text Object
  2. Go to actions add Modify text
  3. Click Formula or write CurrentGameVersion::ReturnCurrentGameVersion() as value
  4. Done

Checklist

Example

gd-project-CurrentGameVersion-1.0.0.zip

Extension file

ReturnGameVersion.zip

Bouh commented 3 years ago

Thank you, added in https://github.com/GDevelopApp/GDevelop-extensions/commit/d4cf5a759942051a52e550250af0959582cc04cb !

I've made a change to the JS Events, we prefer using the GDJS API.

Before: eventsFunctionContext.returnValue= gdjs.projectData.properties.version; After: eventsFunctionContext.returnValue = runtimeScene.getGame().getGameData().properties.version;

Nit: Format is an option in the context menu in a JS event, we use it for cleaning and format the source code .

Tests: Ok Registry file: Updated

UlisesFreitas commented 3 years ago

Hi I don't know how to update the username on the extension so here the extension with my username added as the author CurrentGameVersion.zip

Bouh commented 3 years ago

Thank again, done in https://github.com/GDevelopApp/GDevelop-extensions/commit/501e20107af33e248963e867fe9f1cb71b5909a8