Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,32 @@ export default class MySprite extends godot.Sprite {
godot.register_property(MySprite, 'direction', new godot.Vector2(1, 0));
```

There are 2 ways of using the `godot.register_property`, the thrid param can either be
a default value for the property you're trying to export or an object giving a more detailed
description on how the editor should show it.

```js
function register_property(target: GodotClass | godot.Object, name: string, value: any);
function register_property(target: GodotClass | godot.Object, name: string, info: PropertyInfo);
```

So calling the register_property like this:
```js
godot.register_property(MyClass, 'number_value', 3.14);
```

Is the simplified version of:
```js
godot.register_property(MyClass, 'number_value', {
type: godot.TYPE_REAL,
hint: godot.PropertyHint.PROPERTY_HINT_NONE,
hint_string: "",
default: 3.14
});
```

For more detail on how to use it, [click here](https://github.com/GodotExplorer/ECMAScript/issues/24#issuecomment-655584829).

#### About the API

All of godots api's are defined within the `godot` namespace.
Expand Down