pollen-not-included/entities/snail/states/snail_eating.gd
Dan 84f07fde20 Updated entity interaction and game state
Significant changes include:
- Disabled input pickability for DeathBox in Dog entity
- Simplified mouse click detection logic in Snail script
- Removed unnecessary conditions and actions from snail eating state
- Adjusted cursor hotspot position for hand cursor in Cursor Manager
- Reset flower nectar level upon game reset
2024-05-16 12:33:24 +01:00

33 lines
725 B
GDScript

extends State
class_name SnailEating
@onready var snail : Snail = get_parent().get_parent() as Snail # I think this is bad but I dont care it works
var eat_interval : float = 3.0
var eat_timer : float = 0.0
var move_to : Vector2 = Vector2.ZERO
var speed : float = 20.0
func enter(_msg : Dictionary = {}) -> void:
Log.pr("I am a snail and I will eat!")
snail.eating = true
func exit() -> void:
snail.eating = false
func update(_delta : float) -> void:
eat_timer += _delta
if move_to == Vector2.ZERO:
move_to = snail.get_random_target()
snail.look_at(move_to)
snail.move_to(move_to, speed)
if eat_timer >= eat_interval:
snail.eat()
eat_timer = 0.0
func physics_update(_delta : float) -> void:
pass