updating movement and added a bucket, still some clean up to do on movement. TODO: if enemy becomes stuck, reclculate path.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Bucket : Node2D
|
||||
{
|
||||
|
||||
[Signal]
|
||||
public delegate void AttackEnteredEventHandler(Attack ATTACK);
|
||||
public int _minX = -500, _maxX = 500, _movementSign = 1, _movementSpeed = 3;
|
||||
|
||||
public void Move()
|
||||
{
|
||||
Position += new Vector2(_movementSign * _movementSpeed, 0);
|
||||
if (Position.X >= _maxX || Position.X <= _minX)
|
||||
{
|
||||
_movementSign *= -1;
|
||||
}
|
||||
}
|
||||
public void OnBodyEntered(Node2D BODY)
|
||||
{
|
||||
if (BODY is Attack attack)
|
||||
{
|
||||
EmitSignal(SignalName.AttackEntered, attack);
|
||||
attack.EnteredBucket();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user