# Prey

{% hint style="success" %}
**COPY/PASTE PARAMETERS**

New in GM 0.11! Right click on a behaviour or component to copy. Then open an object, add the same behaviour or component, and right click it to paste identical parameter settings.
{% endhint %}

<figure><img src="https://4251931498-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO_j99BJEXK4zHqxgqS%2F-MOynuJYYG79OP64BljB%2F-MOyoSj-kYeEMAE_Bu33%2FHerbivore.gif?alt=media&#x26;token=42845250-5ff4-4c8e-bb0b-4509d7e5b48f" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
This behaviour has not yet been migrated for use in multiplayer Experiences.
{% endhint %}

## ![](/files/d0QFynSUGQEXj7YGUOAt) Prey

* Walk within a defined zone
* Eat specific assets within its range
* The eating frequency can be changed within its parameters
* Once it detects a predator, it tries to escape by increasing its speed and running away from the predator
* Once an asset gets eaten, it goes for another one if its hunger hasn’t reached its maximum
* Peaceful creature that doesn’t attack any targets

## Common Uses

* A creature that flees from Predators and seeks a food source, which will stop seeking food when hunger parameters are met
* Removing Objects from an Experience at a more consistent rate than the Farmer Behaviour's random and continuous "harvesting"

## Communications

<table data-header-hidden><thead><tr><th width="278"></th><th></th></tr></thead><tbody><tr><td><p><strong>Inputs:</strong></p><ul><li>Detects specified Tags as targets to flee (default Tag is Predator)</li><li>Detects specified Tags as targets to eat (default Tag is Plant)</li></ul></td><td><p><strong>Outputs:</strong></p><ul><li>If any of its Tags to Flee are detected, moves away</li><li>If any of its Food Tags are detected, moves toward a random object with the tag(s), displays its eating animation, and makes the target object disappear (no death/destroy animation)</li></ul></td></tr></tbody></table>

<img src="/files/VGzfCWHDfNI5DTCjU1ak" alt="" class="gitbook-drawing">

## Parameters

| Options                          | Details                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| ![](/files/muCZGqPrXBb27oFIbwwM) | <p><strong>Walk Speed</strong> (slider) - Determines the amount of blocks travelled per second by your Object when walking.<br><br>This parameter's max value is determined by the ASSET's <img src="/files/yZdk0h4jWRoKzXe80kJd" alt=""> <mark style="color:blue;">Speed</mark> stat.<br><br><strong>Flee Speed</strong> (slider) - Determines the amount of blocks travelled per second by your Object when fleeing.<br><br>This parameter's max value is determined by the ASSET's <img src="/files/yZdk0h4jWRoKzXe80kJd" alt=""> <mark style="color:blue;">Speed</mark> stat.</p>                                                                                                                                                                                                                                                                                                                                                                                                      |
| ![](/files/k4mW7PKlgp2sMTkPVTdL) | <p><strong>Food Tag</strong> - Tags that the Object will look for to eat. You may add more than one tag or remove unwanted tags.<br><br><strong>Tags to Flee</strong> - Tags that the Object will flee from if the tags enter their <mark style="color:red;">Enemy Detection Range</mark>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ![](/files/FKrz2w5ZlW7fknkxFXmE) | <p><strong>Enemy Detection Range</strong> (slider) - Defines the area in which the Object will detect <mark style="color:red;">Tags to Flee</mark>.<br><br>This parameter is visualised with a <mark style="color:yellow;"><strong>yellow</strong></mark> circle Gizmo that adjusts as you move the slider or change the value.<br><br>This parameter's max value is determined by the ASSET's <img src="/files/pE8MLE381D4DXwDPd3gv" alt=""> <mark style="color:red;">Defense</mark> stat.<br><br><strong>Food Detection Range</strong> (slider) - Defines the area in which the Object will detect <mark style="color:green;">Food Tags</mark>.<br><br>This parameter is visualised with a <mark style="color:green;"><strong>green</strong></mark> circle Gizmo that adjusts as you move the slider or change the value.<br><br>This parameter's max value is determined by the ASSET's <img src="/files/ZXe3DbSYJYBxoGSXULvQ" alt=""> <mark style="color:green;">Luck</mark> stat.</p> |
| ![](/files/6DHNukuXCI1pP2MrUHBZ) | <p><strong>Food Value</strong> - Determines the amount of hunger your Object earns from eating a target.<br></p><p><strong>Max Hunger</strong> - The maximum hunger value that can be reached by the Object. When the Prey is hungry, it will look for <mark style="color:green;">Food Tags</mark>.<br><br><strong>Hunger Decrease Rate</strong> - How much hunger your Object loses automatically per second.<br><br><strong>Eating Duration</strong> - The time, in seconds, that it takes for the Object to eat a target.<br><br><strong>Hunger Threshold</strong> - Determines at which hunger level your Object must be to look for <mark style="color:green;">Food Tags</mark>.</p>                                                                                                                                                                                                                                                                                                  |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sandbox.game/en/creator/game-maker/docs/behaviours/npc-ai-pawns/prey.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
