Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mikolasan/godot-recipes

GDScript code snippets
https://github.com/mikolasan/godot-recipes

gdscript godot-engine

Last synced: about 1 month ago
JSON representation

GDScript code snippets

Awesome Lists containing this project

README

        

# GDScript Language

### Check type

```gdscript
if typeof(data.selected_card.one_time_effect) == TYPE_OBJECT:
pass
```

### Iterate over array

```gdscript
# no index
for item in array:
pass

# with index
for i in range(array.size()):
var item = array[i]
```

### Iterate over dictionary

```gdscript
# with keys
for key in dict:
var value = dict[key]

# or
for key in dict.keys():
var value = dict[key]

# no keys, only values
for value in dict.values():
pass
```

### Multiline string

```gdscript
var stats = """
Move: {move}
Energy: {energy}
Skills: {skills}
Equipment: {equipment}
"""
```