Spikeweed
This commit is contained in:
parent
8f66b9e565
commit
b543631c86
5 changed files with 151 additions and 1 deletions
20
scripts/components/plants/behaviours/SpikeweedBehaviour.cs
Normal file
20
scripts/components/plants/behaviours/SpikeweedBehaviour.cs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class SpikeweedBehaviour : Node
|
||||
{
|
||||
[Export] private AnimationPlayer _player;
|
||||
|
||||
private int _inCount = 0;
|
||||
public void OnHitboxEntered(Area2D _area)
|
||||
{
|
||||
if (_inCount++ == 0)
|
||||
_player.Play("attack");
|
||||
}
|
||||
|
||||
public void OnHitboxExited(Area2D _area)
|
||||
{
|
||||
if (--_inCount == 0)
|
||||
_player.Play("idle");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue