Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- this shouldn't need sharing since it works for other travelling attacks but whatever
- #_process of the attack node
- func _process(delta: float) -> void:
- if Time.get_ticks_msec() > endtime:
- queue_free()
- global_position = prior_global_position+travel.call(self)*delta
- prior_global_position = global_position
- return
- #the travel and spawner functions:
- func page_flurry_travel(node,travel_angle):
- return Vector2.LEFT.rotated(travel_angle)*200
- func page_flurry_exec(delta) -> void:
- flurry_duration -= delta
- if flurry_duration <= 0:
- flurry_duration = 0
- flurry = false
- attacks_onscreen -= 1
- return
- if Time.get_ticks_msec() < flurry_lastspawn+333:
- return
- flurry_lastspawn = Time.get_ticks_msec()
- var pinpoint = RandomNumberGenerator.new().randi_range(0,PI) #top half circle
- var player = get_tree().current_scene.get_node("Player")
- #FIXME vector magnitudes
- var startpos = player.global_position + Vector2.RIGHT.rotated(pinpoint)*200
- get_node("Hitbox").attack(1,false,startpos,2,func(x): return page_flurry_travel(x,pinpoint),droppable_init)
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement