Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2025
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. i want to spawn these things at a set distance from the player, in a random point of the upper circumference formed by the distance radius, but after spawning they just travel in random (relative to where they spawned relative to the player) directions
  2.  
  3. this shouldn't need sharing since it works for other travelling attacks but whatever
  4.  
  5. #_process of the attack node
  6. func _process(delta: float) -> void:
  7. if Time.get_ticks_msec() > endtime:
  8. queue_free()
  9. global_position = prior_global_position+travel.call(self)*delta
  10. prior_global_position = global_position
  11. return
  12.  
  13. #the travel and spawner functions:
  14. func page_flurry_travel(node,travel_angle):
  15. return Vector2.LEFT.rotated(travel_angle)*200
  16. func page_flurry_exec(delta) -> void:
  17. flurry_duration -= delta
  18. if flurry_duration <= 0:
  19. flurry_duration = 0
  20. flurry = false
  21. attacks_onscreen -= 1
  22. return
  23. if Time.get_ticks_msec() < flurry_lastspawn+333:
  24. return
  25. flurry_lastspawn = Time.get_ticks_msec()
  26. var pinpoint = RandomNumberGenerator.new().randi_range(0,PI) #top half circle
  27. var player = get_tree().current_scene.get_node("Player")
  28. #FIXME vector magnitudes
  29. var startpos = player.global_position + Vector2.RIGHT.rotated(pinpoint)*200
  30. get_node("Hitbox").attack(1,false,startpos,2,func(x): return page_flurry_travel(x,pinpoint),droppable_init)
  31. return
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement