yes, they canjj st!

This commit is contained in:
Haze Weathers 2025-12-14 17:06:42 -06:00
parent 6b92473eeb
commit a6421235f8
22 changed files with 510 additions and 14 deletions

View file

@ -0,0 +1,12 @@
@abstract
class_name BulletBehavior
extends Resource
## Called when a bullet is spawned with this behavior in order to set up
## behavior-specific state.
@warning_ignore("unused_parameter")
func init_bullet(bullet: Bullet) -> void: pass
## Called to process a tick of a bullet's movement.
@abstract func process_bullet(bullet: Bullet, delta: float) -> void

View file

@ -0,0 +1 @@
uid://djcajenyac4sd

View file

@ -0,0 +1,15 @@
class_name SimpleLinearBehavior
extends BulletBehavior
## Makes bullets move in [member Bullet.direction], potentially accelerating.
## Initial speed of the bullet when it is spawned.
@export_custom(0, "suffix:px/s") var initial_speed: float = 0.0
## Rate at which the bullet will speed up.
@export_custom(0, "suffix:px/s²") var acceleration: float = 0.0
func process_bullet(bullet: Bullet, delta: float) -> void:
var speed = initial_speed + acceleration * bullet.time_elapsed
bullet.position += bullet.direction * speed * delta

View file

@ -0,0 +1 @@
uid://dntp60my5f65m