Attempting to translate pseudocode to useable code…
This commit is contained in:
parent
e5eea103ab
commit
4015e1c719
2 changed files with 12 additions and 1 deletions
|
|
@ -7,7 +7,16 @@ extends Area2D
|
|||
|
||||
|
||||
func _process(delta):
|
||||
position += transform.y * (shot_data.speed + player.velocity.y) * delta #This works normally
|
||||
#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
|
||||
|
||||
if travel > 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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue