Apply general code formatting to some pages in the tutorial section

This commit is contained in:
Michael Alexsander
2020-07-08 23:01:07 -03:00
parent bb7b596a6e
commit 1f6d3995e4
19 changed files with 180 additions and 89 deletions

View File

@@ -91,9 +91,11 @@ This is a simple example of how to create a sprite from code and move it using t
extends Node2D
# VisualServer expects references to be kept around
# VisualServer expects references to be kept around.
var sprite
func _ready():
# Create a canvas item, child of this node.
var ci_rid = VisualServer.canvas_item_create()
@@ -130,9 +132,11 @@ The 3D APIs are different from the 2D ones, so the instantiation API must be use
extends Spatial
# VisualServer expects references to be kept around
# VisualServer expects references to be kept around.
var mesh
func _ready():
# Create a visual instance (for 3D).
var instance = VisualServer.instance_create()
@@ -157,14 +161,16 @@ and moves a :ref:`CanvasItem <class_CanvasItem>` when the body moves.
.. tabs::
.. code-tab:: gdscript GDScript
# Physics2DServer expects references to be kept around
# Physics2DServer expects references to be kept around.
var body
var shape
func _body_moved(state, index):
# Created your own canvas item, use it here.
VisualServer.canvas_item_set_transform(canvas_item, state.transform)
func _ready():
# Create the body.
body = Physics2DServer.body_create()