rand bullets
This commit is contained in:
parent
55c2aeac80
commit
4ff19610d3
12 changed files with 126 additions and 56 deletions
|
|
@ -52,20 +52,22 @@ var _hitbox: CollisionShape2D = CollisionShape2D.new()
|
|||
## Returns a new [Bullet], which may be sourced from the cached bullets.
|
||||
@warning_ignore("shadowed_variable")
|
||||
static func create(
|
||||
texture: Texture2D = null,
|
||||
hitbox_size: Vector2i = Vector2i.ZERO,
|
||||
preset: BulletPreset,
|
||||
direction: Vector2 = Vector2.RIGHT,
|
||||
face_direction: bool = false,
|
||||
) -> Bullet:
|
||||
#var bullet: Bullet = _cached_bullets.pop_back()
|
||||
#if not bullet:
|
||||
#bullet = Bullet.new()
|
||||
var bullet := Bullet.new()
|
||||
|
||||
bullet.texture = texture
|
||||
bullet.hitbox_size = hitbox_size
|
||||
if not preset.textures.is_empty():
|
||||
bullet.texture = preset.textures.pick_random()
|
||||
if not preset.colors.is_empty():
|
||||
bullet.modulate = preset.colors.pick_random()
|
||||
bullet.hitbox_size = preset.hitbox_size
|
||||
bullet.face_direction = preset.face_direction
|
||||
|
||||
bullet.direction = direction
|
||||
bullet.face_direction = face_direction
|
||||
|
||||
bullet.time_elapsed = 0.0
|
||||
bullet.grazed = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue