Cleaned up code around shooting logic to try to get it to work (didn't

help!)
This commit is contained in:
Henry 2026-03-23 10:41:11 +00:00
parent 4015e1c719
commit 97606c8233
2 changed files with 8 additions and 9 deletions

View file

@ -7,16 +7,15 @@ extends Area2D
func _process(delta):
#var player_position: float = player.position.y
var spacing: int = 5
var travel: float
travel += shot_data.speed * delta + (player.position.y - player.previous_location)
player.previous_location = player.position.y
var spacing: int = 100
var travel: float
travel += shot_data.speed * delta + (player.position.y - player.previous_position.y)
player.previous_position.y = player.position.y
if travel > spacing:
position += shot_data.speed * delta #This works normally
print("travel is greater than spacing!")
position += shot_data.speed * delta # This works normally
travel -= spacing
#position += (transform.y + player.velocity) * shot_data.speed * delta #This doesn'tt
func _on_visible_on_screen_notifier_2d_screen_exited() -> void:
queue_free()