mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Update style guide for new export and setget syntax
This commit is contained in:
@@ -35,10 +35,12 @@ Here is a complete class example based on these guidelines:
|
||||
|
||||
signal state_changed(previous, new)
|
||||
|
||||
export var initial_state = NodePath()
|
||||
var is_active = true setget set_is_active
|
||||
@export var initial_state: Node
|
||||
var is_active = true:
|
||||
set = set_is_active
|
||||
|
||||
@onready var _state = get_node(initial_state) setget set_state
|
||||
@onready var _state = initial_state:
|
||||
get = set_state
|
||||
@onready var _state_name = _state.name
|
||||
|
||||
|
||||
@@ -777,11 +779,13 @@ variables, in that order.
|
||||
|
||||
const MAX_LIVES = 3
|
||||
|
||||
export(Jobs) var job = Jobs.KNIGHT
|
||||
export var max_health = 50
|
||||
export var attack = 5
|
||||
@export var job: Jobs = Jobs.KNIGHT
|
||||
@export var max_health = 50
|
||||
@export var attack = 5
|
||||
|
||||
var health = max_health setget set_health
|
||||
var health = max_health:
|
||||
set(new_health):
|
||||
health = new_health
|
||||
|
||||
var _speed = 300.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user