Class StaticEnemy
Parent: Enemy
Static enemies are usually not-moving enemies that keep their place. The prime example for a static enemy is a saw, which does nothing but rotate around itself.
Static enemies don’t change their image by themselves, they always show the same one, just potentially rotated.
Class Methods
new
new() → a_static
Creates a new static enemy with the default values.
Instance Methods
path
path() → a_string or nil
Get the path identifier assigned to this static enemy.
Return value
The path identifier as a string. If no path identifier has been assigned to this static enemy, returns nil.
path=
path=( ident ) → ident
Assign a path identifier to this static enemy. If you also set a movement speed using #speed=, this will make the static enemy move along the given path with the specified velocity.
Parameters
- path
-
The identifier of the TSC path you want to assign to this static enemy, as a string.
rotation_speed
rotation_speed() → a_float
Returns the static enemy’s rotation speed.
rotation_speed=
rotation_speed=( speed ) → speed
Specify the velocity the sprite uses to rotate around its centre. By default, static enemies do not rotate (i.e. the speed is 0).
Parameters
- speed
The new rotation speed. A float.
speed
speed() → a_float
Returns the static enemy’s moving speed.
speed=
speed=( val ) → val
Specify the speed the static enemy uses to move along the TSC path assigned to it. This requires you to assign an TSC path by means of the #path= method.
Parameters
- val
The new moving speed of the static enemy.