How to make a tower - Praytic/youtd2 GitHub Wiki

Introduction

The following steps describe how to make a tower based on an existing tower from the original game. You may also use these steps to create a new custom tower.

Define tower properties

  1. See tower properties on this website: https://interactive.youtd.best/towers/
  2. When you've found your tower, open it's family by clicking on the "Family ID" number. This will show all of the towers in the family.
  3. Open tower_properties.csv in a spreadsheet editor.
  4. When opening the file, a dialog with options should come up. Select "Comma" as a separator and accept the dialog.
  5. Add a new row below the first row, the one that contains column names.
  6. Fill in properties.
  7. Note that everything related to specials, spells and other effects is defined in scripts, not the csv file.
  8. Repeat for other towers in the family.

Create tower script

  1. Create new script in the Scenes/Towers/TowerBehaviors folder.
  2. Select TowerBehavior as base class of the script.
  3. Name the script like this: [name of first tier tower without spaces] + 1.gd. For example: TinyShrub1.gd.

This script file is used to define tower spells and effects. Only one script is created per tower family because scripts for towers of same family do the same thing with increasing numbers for each tier. This means that one script can be defined and change values based on tower tier.

You can learn about writing the tower script on this page: How to script a tower.

Create tower sprite

  1. Create new scene in the Scenes/Towers/TowerSprites folder.
  2. Select Sprite2D as root type of the scene.
  3. Name the scene file like this: [name of first tier tower without spaces] + [tier number].tscn. For example: TinyShrub3.tscn.
  4. Repeat for all tiers of the tower family.

You should define the following properties of the tower sprite:

  • Texture of the sprite
  • Position of the sprite
  • Scale of the sprite

Load tower in the game

Once you have finished the tower script, sprite scene and added properties, the game will load the tower automatically into the game.