Skip to content

Add Page for using GDScript with Entities #6

@DeerTears

Description

@DeerTears

This page should include how to add scripts that interface with entities.

Right now this is lumped into the "entities" page, I will separate this out.

This page will include:

  • A general template for new entity scripts
  • Attaching the script to the entity definition
  • A link to new pages on updating the FGD and CFG
  • Code safety to retrieve trenchbroom-set values: if "color" in properties:
  • Code safety with entities (if entity is SpawnPoint: entity.spawn("enemy"))
  • Separating in-editor behaviour from in-game behaviour: Engine.is_editor_hint()
  • Adding and finding entities by group: `func _ready(): add_to_group("SpawnPoints") get_tree().get_nodes_in_group("SpawnPoints")
  • Connecting Area and Body signals at runtime with code: connect("is_area_entered", "_on_area_entered")
  • Creating child nodes in code (as an alternative to using .tscn files for more complex node setups)

The old entities page needs removed:

  • Writing code for entities

Going forward it'd be nice to group entity stuff into subpages, and split up the big entities page into smaller chunks, similar to the Beginner's Guide to Qodot.

All suggestions (additions, removals, reworkings) are welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions