who the fuck knows
This commit is contained in:
parent
1c33ea2f59
commit
1da411cacd
31 changed files with 1372 additions and 78 deletions
|
|
@ -5,12 +5,25 @@ class_name BeeIdle
|
|||
|
||||
var idle_time : float = 0.0
|
||||
|
||||
var target : Vector2 = Vector2.ZERO
|
||||
|
||||
var acquire_new_target : bool = false
|
||||
|
||||
|
||||
func enter(_msg := {}):
|
||||
#animator.play("Idle")
|
||||
pass
|
||||
if acquire_new_target:
|
||||
target = bee.get_global_position() + Vector2(randi_range(-60, 60), randi_range(-60, 60))
|
||||
|
||||
func exit():
|
||||
acquire_new_target = true
|
||||
|
||||
func update(delta : float):
|
||||
|
||||
if target == Vector2.ZERO:
|
||||
randomize()
|
||||
target = bee.get_global_position() + Vector2(randi_range(-60, 60), randi_range(-60, 60))
|
||||
|
||||
|
||||
idle_time += delta
|
||||
|
||||
if idle_time > 2.0:
|
||||
|
|
@ -18,6 +31,14 @@ func update(delta : float):
|
|||
idle_time = 0.0
|
||||
pass
|
||||
|
||||
func physics_update(delta : float) -> void:
|
||||
if target:
|
||||
if bee.position.distance_to(target) > 3:
|
||||
|
||||
bee.velocity = (target - bee.position).normalized() * bee.speed / 2 * delta
|
||||
bee.move_and_collide(bee.velocity)
|
||||
bee.look_at(target)
|
||||
|
||||
func find_something_to_do():
|
||||
if bee.nectar > 0:
|
||||
Log.pr("I have pollen, time to move..")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue