Improved bullet spacing code now works with all number of bullets! Thank
you @jennie!
This commit is contained in:
parent
0ccdc03bf8
commit
8d89271074
1 changed files with 2 additions and 2 deletions
|
|
@ -87,7 +87,7 @@ func _on_weapon_cooldown_timeout() -> void:
|
|||
|
||||
|
||||
func shoot():
|
||||
var projectiles: int = 3
|
||||
var projectiles: int = 4
|
||||
const PROJECTILE_SPACING: float = 10
|
||||
const MUZZLE_HEIGHT: int = -23
|
||||
for b in projectiles:
|
||||
|
|
@ -95,7 +95,7 @@ func shoot():
|
|||
# Instantiate the bullets
|
||||
var bullet = weapon_current.instantiate()
|
||||
get_tree().root.add_child(bullet)
|
||||
bullet.position = position + Vector2((b * PROJECTILE_SPACING) - (projectiles * projectiles), MUZZLE_HEIGHT)
|
||||
bullet.position = position + Vector2((b - (projectiles - 1) / 2.0) * PROJECTILE_SPACING, MUZZLE_HEIGHT)
|
||||
|
||||
# Get weapon speed and spacing for equidistant calculations
|
||||
weapon_rate = bullet.shot_data.rate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue