who the fuck knows
This commit is contained in:
parent
1c33ea2f59
commit
1da411cacd
31 changed files with 1372 additions and 78 deletions
|
|
@ -6,6 +6,7 @@ class_name BeeTravelling
|
|||
@onready var bee = get_parent().get_parent() as Bee # I think this is bad but I dont care it works
|
||||
|
||||
var return_to_hive : bool = false
|
||||
var moving_to : Vector2 = Vector2(0,0)
|
||||
|
||||
func enter(_msg := {}):
|
||||
return_to_hive = false
|
||||
|
|
@ -23,20 +24,22 @@ func enter(_msg := {}):
|
|||
# If we have no target, we are returning to the hive
|
||||
if !target:
|
||||
return_to_hive = true
|
||||
else:
|
||||
moving_to = target.get_global_position()
|
||||
|
||||
bee.animation_player.play("Flying")
|
||||
bee.bee_position_animation.play("Flying")
|
||||
|
||||
|
||||
func update(delta : float) -> void:
|
||||
|
||||
func update(_delta : float) -> void:
|
||||
if return_to_hive:
|
||||
state_transition.emit(self, "Returning")
|
||||
return
|
||||
|
||||
func physics_update(delta : float) -> void:
|
||||
if target:
|
||||
if bee.position.distance_to(target.position) > 3:
|
||||
|
||||
bee.velocity = (target.get_global_position() - bee.position).normalized() * bee.speed * delta
|
||||
bee.velocity = (moving_to - bee.position).normalized() * bee.speed * delta
|
||||
bee.move_and_collide(bee.velocity)
|
||||
bee.look_at(target.position)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue