Class Enemy
Parent: MovingSprite
Enemies are the little guys that hang around all over the world of TSC and try to hinder you in many different ways. This is the base class for all enemies and defines the methods that are available for every enemy, regardless of its type.
Currently, this class is not instanciatable.
Events
- Die
-
This event gets triggered when the enemy dies. The event handler doesn’t get passed any argument.
Instance Methods
fire_resistant=
fire_resistant=( val )
Enables/Disables fire resistance for this enemy.
Parameters
- val
-
true to enable the fire resistance, false to disable it.
fire_resistant?
fire_resistant?
Checks whether this enemy is resistant to fire.
kill!
kill!()
Immediately kills this enemy. No points are given to the player (i.e. it is as if the enemy fell into an abyss or something like that).
Causes a subsequent Die event.
See also: #kill_with_points!.
kill_points
kill_points() → an_integer
Returns the number of points the player gains after killing this enemy.
kill_points=
kill_points=( points )
Sets the number of points the player gains after killing this enemy. Note kill points are not applied if the enemy dies due to something else than player interaction, e.g. by falling into an abyss.
Parameters
- points
Number of points to add.
kill_sound
kill_sound() → a_string
Returns the filename of the sound to play when the enemy gets killed, relative to the sounds/ directory.
kill_sound=
kill_sound=( path )
Sets the sound to play when the enemy gets killed.
Parameters
- path
-
The path of the sound file to play. Relative to the sounds/ directory.
kill_with_points!
kill_with_points!()
Immediately kills this enemy. Points are given to the player. Also plays the dying sound for this enemy.
Causes a subsequent Die event.
See also: #kill!