mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Apply general code formatting to some pages in the tutorial section
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user