Class MovementTask
java.lang.Object
com.deco2800.game.ai.tasks.DefaultTask
com.deco2800.game.components.tasks.MovementTask
- All Implemented Interfaces:
Task
Move to a given position, finishing when you get close enough. Requires an entity with a
PhysicsMovementComponent.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.deco2800.game.ai.tasks.Task
Task.Status
-
Field Summary
Fields inherited from class com.deco2800.game.ai.tasks.DefaultTask
owner, status
-
Constructor Summary
ConstructorsConstructorDescriptionMovementTask
(com.badlogic.gdx.math.Vector2 target) Create movement taskMovementTask
(com.badlogic.gdx.math.Vector2 target, float stopDistance) Create movement taskMovementTask
(com.badlogic.gdx.math.Vector2 target, float stopDistance, float speed) Create movement task -
Method Summary
Methods inherited from class com.deco2800.game.ai.tasks.DefaultTask
create, getStatus
-
Constructor Details
-
MovementTask
public MovementTask(com.badlogic.gdx.math.Vector2 target) Create movement task- Parameters:
target
- The target to move towards
-
MovementTask
public MovementTask(com.badlogic.gdx.math.Vector2 target, float stopDistance, float speed) Create movement task- Parameters:
target
- The target to move towardsstopDistance
- The distance to stop at.speed
- The speed to move at.
-
MovementTask
public MovementTask(com.badlogic.gdx.math.Vector2 target, float stopDistance) Create movement task- Parameters:
target
- The target to move towardsstopDistance
- The distance to stop at.
-
-
Method Details
-
setSpeed
public void setSpeed(float speed) -
start
public void start()Start movement task.- Specified by:
start
in interfaceTask
- Overrides:
start
in classDefaultTask
-
update
public void update()Update movement task- Specified by:
update
in interfaceTask
- Overrides:
update
in classDefaultTask
-
setTarget
public void setTarget(com.badlogic.gdx.math.Vector2 target) Set a new target.- Parameters:
target
- The target to move towards
-
stop
public void stop()Stop this task.- Specified by:
stop
in interfaceTask
- Overrides:
stop
in classDefaultTask
-