Bee flying animation, dancing drone

This commit is contained in:
Dan Baker 2024-05-03 20:39:41 +01:00
parent 7c3bca07f9
commit bce75a9a97
13 changed files with 154 additions and 21 deletions

View file

@ -3,6 +3,7 @@ class_name Bee
@onready var fsm = $StateMachine as FiniteStateMachine
@onready var drone_manager = get_tree().get_first_node_in_group("dronemanager") as DroneManager
@onready var animation_player = $AnimationPlayer as AnimationPlayer
@export var nectar : int = 0
@export var speed : int = 30
@ -10,13 +11,20 @@ class_name Bee
var latest_target_director : int = 0
# This is updated when the bee enters or exits a flower patch
var in_range_of_flowers : bool = false
var in_range_of_flowers : bool = false
var just_gathering : bool = false # Used to check if the bee has just been gathering to return to their previous director
func _ready():
speed = randi_range(35,55) # Randomise the bee speed a bit
Log.pr("I have never bee-n so ready!")
Log.pr(fsm.current_state.name)
func get_current_director():
return drone_manager.get_director(latest_target_director)
## Get the next target to move to
## If we have no nectar, we need to go up the director list
## If we have nectar, we need to go down the director list

View file

@ -0,0 +1,18 @@
extends Node2D
class_name Beehive
var dancer_in_range : bool = false
func _ready():
Log.pr("Beehive has joined the party")
func _on_area_2d_area_entered(area:Area2D):
Log.pr("Beehive: Area entered", area)
if area.is_in_group("dancer"):
dancer_in_range = true
print("Dancer in range")
func _on_area_2d_area_exited(area:Area2D):
if area.is_in_group("dancer"):
dancer_in_range = false
print("Dancer out of range")