mirror of
https://github.com/stan220/godot-docs.git
synced 2026-09-08 17:28:58 +00:00
Update GDScript syntax in the First 3D game tutorial (#6118)
Co-authored-by: Jeferson Leite Borges <jeferson.borges@ihsmarkit.com>
This commit is contained in:
co-authored by
Jeferson Leite Borges
parent
8bb2b02eda
commit
0ca949a46c
@@ -22,9 +22,9 @@ character.
|
||||
extends KinematicBody
|
||||
|
||||
# How fast the player moves in meters per second.
|
||||
export var speed = 14
|
||||
@export var speed = 14
|
||||
# The downward acceleration when in the air, in meters per second squared.
|
||||
export var fall_acceleration = 75
|
||||
@export var fall_acceleration = 75
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
@@ -236,9 +236,9 @@ Here is the complete ``Player.gd`` code for reference.
|
||||
extends KinematicBody
|
||||
|
||||
# How fast the player moves in meters per second.
|
||||
export var speed = 14
|
||||
@export var speed = 14
|
||||
# The downward acceleration when in the air, in meters per second squared.
|
||||
export var fall_acceleration = 75
|
||||
@export var fall_acceleration = 75
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
|
||||
@@ -103,9 +103,9 @@ the ``velocity``.
|
||||
extends KinematicBody
|
||||
|
||||
# Minimum speed of the mob in meters per second.
|
||||
export var min_speed = 10
|
||||
@export var min_speed = 10
|
||||
# Maximum speed of the mob in meters per second.
|
||||
export var max_speed = 18
|
||||
@export var max_speed = 18
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
@@ -257,9 +257,9 @@ Here is the complete ``Mob.gd`` script for reference.
|
||||
extends KinematicBody
|
||||
|
||||
# Minimum speed of the mob in meters per second.
|
||||
export var min_speed = 10
|
||||
@export var min_speed = 10
|
||||
# Maximum speed of the mob in meters per second.
|
||||
export var max_speed = 18
|
||||
@export var max_speed = 18
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ always spawn following the same sequence.
|
||||
|
||||
extends Node
|
||||
|
||||
export (PackedScene) var mob_scene
|
||||
@export var mob_scene: PackedScene
|
||||
|
||||
|
||||
func _ready():
|
||||
@@ -280,7 +280,7 @@ Here is the complete ``Main.gd`` script so far, for reference.
|
||||
|
||||
extends Node
|
||||
|
||||
export (PackedScene) var mob_scene
|
||||
@export var mob_scene: PackedScene
|
||||
|
||||
|
||||
func _ready():
|
||||
|
||||
@@ -114,7 +114,7 @@ the ``jump_impulse``.
|
||||
|
||||
#...
|
||||
# Vertical impulse applied to the character upon jumping in meters per second.
|
||||
export var jump_impulse = 20
|
||||
@export var jump_impulse = 20
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
@@ -212,7 +212,7 @@ when jumping.
|
||||
|
||||
# Vertical impulse applied to the character upon bouncing over a mob in
|
||||
# meters per second.
|
||||
export var bounce_impulse = 16
|
||||
@export var bounce_impulse = 16
|
||||
|
||||
.. code-tab:: csharp
|
||||
|
||||
|
||||
@@ -234,9 +234,9 @@ Next is ``Mob.gd``.
|
||||
signal squashed
|
||||
|
||||
# Minimum speed of the mob in meters per second.
|
||||
export var min_speed = 10
|
||||
@export var min_speed = 10
|
||||
# Maximum speed of the mob in meters per second.
|
||||
export var max_speed = 18
|
||||
@export var max_speed = 18
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
@@ -317,13 +317,13 @@ Finally, the longest script, ``Player.gd``.
|
||||
signal hit
|
||||
|
||||
# How fast the player moves in meters per second.
|
||||
export var speed = 14
|
||||
@export var speed = 14
|
||||
# The downward acceleration when in the air, in meters per second squared.
|
||||
export var fall_acceleration = 75
|
||||
@export var fall_acceleration = 75
|
||||
# Vertical impulse applied to the character upon jumping in meters per second.
|
||||
export var jump_impulse = 20
|
||||
@export var jump_impulse = 20
|
||||
# Vertical impulse applied to the character upon bouncing over a mob in meters per second.
|
||||
export var bounce_impulse = 16
|
||||
@export var bounce_impulse = 16
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
|
||||
@@ -374,7 +374,7 @@ Here is the complete ``Main.gd`` script for reference.
|
||||
|
||||
extends Node
|
||||
|
||||
export (PackedScene) var mob_scene
|
||||
@export var mob_scene: PackedScene
|
||||
|
||||
|
||||
func _ready():
|
||||
|
||||
@@ -288,13 +288,13 @@ Here's the *Player* script.
|
||||
signal hit
|
||||
|
||||
# How fast the player moves in meters per second.
|
||||
export var speed = 14
|
||||
@export var speed = 14
|
||||
# The downward acceleration when in the air, in meters per second per second.
|
||||
export var fall_acceleration = 75
|
||||
@export var fall_acceleration = 75
|
||||
# Vertical impulse applied to the character upon jumping in meters per second.
|
||||
export var jump_impulse = 20
|
||||
@export var jump_impulse = 20
|
||||
# Vertical impulse applied to the character upon bouncing over a mob in meters per second.
|
||||
export var bounce_impulse = 16
|
||||
@export var bounce_impulse = 16
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
@@ -455,9 +455,9 @@ And the *Mob*'s script.
|
||||
signal squashed
|
||||
|
||||
# Minimum speed of the mob in meters per second.
|
||||
export var min_speed = 10
|
||||
@export var min_speed = 10
|
||||
# Maximum speed of the mob in meters per second.
|
||||
export var max_speed = 18
|
||||
@export var max_speed = 18
|
||||
|
||||
var velocity = Vector3.ZERO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user