YeOldeDM
YeOldeDM
We will write yet another global script, this time to handle the pathfinding for our soon-to-be Artificial Intelligence! This script will utilize Godot's AStar class, and use some of its...
 This image doesn't illustrate this well. There should be other blocking Things affecting the path. The idea is to, instead of generating a PathMap for the entire dungeon and...
With that we should now have three characteristic variables that make up our Fighter: Health (HP), Strength(attack), and Resistance(defense). With even just these (and some graphics), you could create a...
To make combat interesting, we can incorporate a couple variables into the damage factor of our attacks. Fighter script gets: `export(int) var attack = 2` `export(int) var defense = 2`...
Where we put our placeholder print statement in the bump-fighting portion of our step method, replace with `self.attack( other_fighter )`.
These methods go under Fighter. `func attack( target ):` Calls take_damage() on `target` `take_damage( amount ):` subtracts `amount` from current HP, and sets the new HP.
Hitpoints should require little explanation. Fighter should have two vars: `export(int) var max_HP = 10` `var HP = 10 setget _set_HP` We will do some work with our HP var....
Create a new instance of the Thing base object in our Database and give it the Fighter script. This will be the base Fighter object we'll use for non-player fighters....
The standard method of performing a melee attack against an enemy in a roguelike is to "bump into" them; that is, attempt to step into the cell they occupy. In...
The Fighter component will be where our script inheritance system for Things will start to work for us. Fighter will extend Thing, and provide all members and methods for a...