Fighter
Fights for a Unit or a Building (a tower): it attacks enemies that come within its unit’s sight on its own, and whatever it’s told to. Up close it hits straight away; with a Projectile it fires one that flies to the target and hurts it on arrival.
Part of the Strategy module: Real-time strategy: factions, units that walk around obstacles and fight, workers that gather and build, buildings that train units, fog of war, the computer playing a side, the player’s controls and HUD, playing online team against team, and the Strategy template.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
damage: a number = 2. Hit points each hit takes off the target’s Health. (Field: a number.)range: a number = 0.4. How close it has to be to hit, from its edge to the target’s, in world units. (Field: a number.)cooldown: a number = 1. Seconds between hits. (Field: a number.)projectile: text = null. A prefab it fires at the target, e.g. “Arrow”. Empty hits straight away. (Names a prefab.) (Field: a name.)projectileSpeed: a number = 12. How fast its projectile flies, in world units per second. (Only used when projectile is set.) (Field: a number.)sound: text = null. A sound played with each hit or shot, e.g. “Sounds/swing.wav”. (A sound in Assets, e.g. “Sounds/hit.wav”.) (Field: a sound.)
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
target: an entity: its name, id or path. The enemy it’s hitting, if any.
Scripts use it as Fighter: its methods, events and values that aren’t saved with the scene.