still working on movement, for some reason some cells do not get set as solid that's why multiple can go on a cell
This commit is contained in:
@@ -7,11 +7,20 @@ public partial class Bucket : Node2D
|
||||
[Signal]
|
||||
public delegate void AttackEnteredEventHandler(Attack ATTACK);
|
||||
public int _minX = -500, _maxX = 500, _movementSign = 1, _movementSpeed = 3;
|
||||
public Vector2 _startPoisition;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_startPoisition = GlobalPosition;
|
||||
}
|
||||
|
||||
|
||||
public void Move()
|
||||
{
|
||||
Position += new Vector2(_movementSign * _movementSpeed, 0);
|
||||
if (Position.X >= _maxX || Position.X <= _minX)
|
||||
GlobalPosition += new Vector2(_movementSign * _movementSpeed, 0);
|
||||
Vector2 offset = _startPoisition - GlobalPosition;
|
||||
if (offset.X >= _maxX || offset.X <= _minX)
|
||||
{
|
||||
_movementSign *= -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user