Projectile¶
Abstract Node for common behavior between all projectiles.
Inherits : KinematicBody2D
Properties¶
Description¶
This is an Abstract Node, meaning it’s just a script (there is no scene associated to this script).
It is used to define common behavior between all projectiles to avoid code duplication.
Common behaviors handled by this Node are mainly :
- Collision with Entities
- Bouncing (or not) on walls
- Projectile being stabbed into walls
Properties description¶
remain_time
¶
Type | float |
Default | 0 |
Number of seconds the projectile stay stabbed into a wall before being freed.
Methods description¶
init(s=1000, d=25, bn=0, rt=0, kp=10)
¶
Arguments
|
This method is used to initialize as we want a new projectile, instead of setting each property by hand.
physics_process()
¶
Arguments
|
Process the main physic of the projectile :
- Move according to current
velocity
- If a collision with an entity happen, free this projectile and hit the entity.
- If a collision with a wall happen, bounce, and later stay stabbed in the wall.
impact()
¶
Stab the projectile into the wall (effectively immobolizing the projectile).
It starts a timer for
remain_time
seconds, which call _on_timer_timeout()
when done._on_timer_timeout()
¶
Method called when the projectile have been stabbed into the wall for
remain_time
seconds.Simply free the projectile.
Receives signals
|