Godot Nature of Code  1.2.0
Nature of Code implemented in Godot Engine
Public Member Functions | Public Attributes | List of all members
Utils.SimpleTouchSpawner Class Reference

Touch spawner. Touch anywhere and spawn something. Can also spawn on demand using SpawnBody. More...

Inherits Node2D.

Public Member Functions

delegate Node2D SpawnFuncDef (Vector2 position)
 Spawn function definition More...
 
 SimpleTouchSpawner ()
 Create a simple touch spawner. More...
 
void SpawnBody (Vector2 position)
 Spawn body at position. More...
 

Public Attributes

SpawnFuncDef SpawnFunction
 Spawn function More...
 
Node Container
 Target container. Defaults to parent.
 

Detailed Description

Touch spawner. Touch anywhere and spawn something. Can also spawn on demand using SpawnBody.

Definition at line 13 of file SimpleTouchSpawner.cs.

Constructor & Destructor Documentation

◆ SimpleTouchSpawner()

Utils.SimpleTouchSpawner.SimpleTouchSpawner ( )
inline

Create a simple touch spawner.

Definition at line 27 of file SimpleTouchSpawner.cs.

28  {
29  Name = "SimpleTouchSpawner";
30  }

Member Function Documentation

◆ SpawnBody()

void Utils.SimpleTouchSpawner.SpawnBody ( Vector2  position)
inline

Spawn body at position.

Parameters
positionTarget position

Definition at line 36 of file SimpleTouchSpawner.cs.

37  {
38  if (SpawnFunction != null)
39  {
40  var body = SpawnFunction(position);
41  var container = Container ?? GetParent();
42  container.AddChild(body);
43  }
44  }
Node Container
Target container. Defaults to parent.
SpawnFuncDef SpawnFunction
Spawn function

◆ SpawnFuncDef()

delegate Node2D Utils.SimpleTouchSpawner.SpawnFuncDef ( Vector2  position)

Spawn function definition

Member Data Documentation

◆ SpawnFunction

SpawnFuncDef Utils.SimpleTouchSpawner.SpawnFunction

Spawn function

Definition at line 19 of file SimpleTouchSpawner.cs.


The documentation for this class was generated from the following file: