---
title: GKAgent2D
framework: gameplaykit
role: symbol
role_heading: Class
path: gameplaykit/gkagent2d
---

# GKAgent2D

An agent that operates in a two-dimensional space.

## Declaration

```swift
class GKAgent2D
```

## Overview

Overview Agents are game entities that move according to realistic constraints and whose behavior is determined by goals that motivate movement. The general functionality of an agent is defined by the abstract superclass GKAgent; however, you use instances of the GKAgent2D class to implement agent-based gameplay in a 2D game (or in a 3D game where gameplay-relevant movement is restricted to two dimensions). To learn more about using goals and agents, see Agents, Goals, and Behaviors in GameplayKit Programming Guide.

## Topics

### Managing an Agent’s Position and Orientation

- [position](gameplaykit/gkagent2d/position.md)
- [rotation](gameplaykit/gkagent2d/rotation.md)

### Running the Agent Simulation

- [update(deltaTime:)](gameplaykit/gkagent2d/update(deltatime:).md)
- [velocity](gameplaykit/gkagent2d/velocity.md)

## Relationships

### Inherits From

- [GKAgent](gameplaykit/gkagent.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Agents, Goals, and Behaviors

- [GKAgent](gameplaykit/gkagent.md)
- [GKAgent3D](gameplaykit/gkagent3d.md)
- [GKGoal](gameplaykit/gkgoal.md)
- [GKBehavior](gameplaykit/gkbehavior.md)
- [GKCompositeBehavior](gameplaykit/gkcompositebehavior.md)
- [GKPath](gameplaykit/gkpath.md)
- [GKAgentDelegate](gameplaykit/gkagentdelegate.md)
