# MONSTER SCRIPTS

### Overview

First, just play around in the demo scene to see each monster and their skin variations.

Drag and drop one of the monster prefabs in `Cainos\Pixel Art Monster - Dungeon\Prefab` into your scene and then you can control it with your mouse and keyboard.

For every monster prefab, there are 3 scripts attached to it:

<table data-header-hidden><thead><tr><th width="230"></th><th></th></tr></thead><tbody><tr><td>Pixel Monster</td><td>Controlling the appearance and animation of the monster.</td></tr><tr><td>Monster Controller</td><td>Controlling the movement of the monster.</td></tr><tr><td>Monster Input Mouse and Keyboard</td><td>Reading mouse and keyboard input and feed into the Monster Controller script</td></tr></tbody></table>

Generally, you would let an AI rather than players to control the monsters. In this case, remove the `Monster Input Mouse and Keyboard` component and let your AI to feed in the input values to the controller script, or you can only keep the `Pixel Monster` component and take full control of the monster’s movement by yourself.

###

### Pixel Monster

Script for controlling the appearance and animation of the monster.

Properties in the `Runtime` foldout should only be modified in the runtime except `Facing`.

Some properties in the `Runtime` foldout will be modified by `Monster Controller` script.

<table data-header-hidden><thead><tr><th width="229.5"></th><th></th></tr></thead><tbody><tr><td>Renderers</td><td>Reference to all the renderers inside the monster prefab.</td></tr><tr><td>Animator</td><td>Reference to the animator object inside the monster prefab.</td></tr><tr><td>Fx</td><td><p>Reference to the object that contain special effects inside the monster prefab.</p><p>Can be left empty.</p></td></tr><tr><td>Die Fx Prefab</td><td><p>The special effects object to instantiate when the monster dies.</p><p>Can be left empty.</p></td></tr><tr><td></td><td></td></tr><tr><td>Alpha</td><td>Controls the transparency of the entire monster.</td></tr><tr><td>Facing</td><td><p>The monster’s facing.</p><p>Can be changed in editor to set the character’s initial facing.</p></td></tr><tr><td>Is Hiding</td><td><p>Is the monster hiding.</p><p>Only works for Mimic.</p></td></tr><tr><td>Is Grounded</td><td>Is the monster on ground.</td></tr><tr><td>Is Dead</td><td><p>Is the monster dead?</p><p>Turn this on will only let the monster play the die animation. If you also want to stop the monster’s movement. Turn on the [Is Dead] property of the controller script.</p></td></tr><tr><td>Moving Blend</td><td><p>Moving animation blend.</p><p>0.0: Idle     0.5: Walk     1.0: Run</p></td></tr><tr><td></td><td></td></tr><tr><td>Attack</td><td>Play attack animation.</td></tr><tr><td>Injured Front</td><td>Play <code>Injured Front</code> animation.</td></tr><tr><td>Injured Back</td><td>Play <code>Injured Back</code> animation.</td></tr></tbody></table>

### Monster Controller

Script for controlling the monster’s movement.

It will modify some of the parameters in the `Pixel Character` script to control animation.

<table data-header-hidden><thead><tr><th width="230"></th><th></th></tr></thead><tbody><tr><td>Default Movement</td><td>Default movement type, walk or run.</td></tr><tr><td>Walks Speed Max</td><td>Max walking speed.</td></tr><tr><td>Walks Acc</td><td>Walking Acceleration.</td></tr><tr><td>Run Speed Max</td><td>Max running speed.</td></tr><tr><td>Run Acc</td><td>Running Acceleration.</td></tr><tr><td>Air Speed Max</td><td>Max move speed while in air.</td></tr><tr><td>Air Acc</td><td>Air acceleration.</td></tr><tr><td>Ground Brake Acc</td><td><p>Braking acceleration while on ground.</p><p>Applied when there is no movement input.</p></td></tr><tr><td>Air Brake Acc</td><td><p>Braking acceleration while in air.</p><p>Applied when there is no movement input.</p></td></tr><tr><td>Jump Speed</td><td>Speed applied to the character when jump.</td></tr><tr><td>Jump Cooldown</td><td>Time needed to be able to jump again after landing.</td></tr><tr><td>Jump Delay</td><td><p>Time it takes from the moment the jump input is fired to the moment the monster actually jumps.</p><p>During this time, the jump prepare animation will be played to achieve a more realistic jump behavior, and you will need to press the key for a little while until the monster actually jump.</p><p>If you do not need this, you can set it to 0.</p></td></tr><tr><td>Jump Gravity Multiplier</td><td><p>Gravity multiplier when the monster is jumping.</p><p>Set it to lower value so that the longer you press the jump button, the higher the monster can jump.</p></td></tr><tr><td>Fall Gravity Multiplier</td><td>Gravity multiplier when monster is falling.</td></tr><tr><td>Moving Blend Transition Speed</td><td>The transition speed when modifying the <code>Moving Blend</code> property in <code>Pixel Monster</code> script.</td></tr><tr><td>Ground Check Size</td><td>Size of the box on character's bottom to determine whether the character is on ground.</td></tr><tr><td>Can Attack in Air</td><td>Can the monster perform attack action while in air.</td></tr><tr><td>Can Attack When Moving</td><td><p>Can the monster perform attack action while moving.</p><p>When turned off, it also forbids the monster to move while in attack animation.</p></td></tr><tr><td></td><td></td></tr><tr><td>Input Move</td><td>Movement input, x for horizontal, y for vertical, x and y should be in <code>[-1.0, 1.0]</code>.</td></tr><tr><td>Input Move Modifier</td><td>Input to switch between walk and run.</td></tr><tr><td>Input Jump</td><td>Jump input.</td></tr><tr><td>Input Attack</td><td>Attack input.</td></tr><tr><td>Is Dead</td><td><p>Is the monster dead?</p><p>When turned on, it will also turn on the <code>Is Dead</code> property on <code>Pixel Monster</code> script and stop the monster’s movement.</p></td></tr></tbody></table>

### Monster Flying Controller

Same as `Monster Controller` script, but for monsters that can fly.

<table data-header-hidden><thead><tr><th width="230"></th><th></th></tr></thead><tbody><tr><td>Speed Max</td><td>Max moving speed.</td></tr><tr><td>Acc</td><td>Moving Acceleration.</td></tr><tr><td>Brake Acc</td><td><p>Braking acceleration</p><p>Applied when there is no movement input.</p></td></tr><tr><td>Ground Check Size</td><td>Size of the box on character's bottom to determine whether the character is on ground.</td></tr><tr><td>Moving Blend Transition Speed</td><td>The transition speed when modifying the <code>Moving Blend</code> property in <code>Pixel Monster</code> script.</td></tr><tr><td>Dead Gravity Scale</td><td><p>Gravity scale when the character is dead.</p><p>Flying monsters will have their gravity scale set to 0 when there are alive.</p><p>So, this parameter actually controls whether the flying monster should fall to the ground when it is dead.</p></td></tr><tr><td></td><td></td></tr><tr><td>Input Move</td><td>Movement input, x for horizontal, y for vertical, x and y should be in <code>[-1.0, 1.0]</code>.</td></tr><tr><td>Input Attack</td><td>Attack input.</td></tr><tr><td>Is Dead</td><td><p>Is the monster dead?</p><p>When turned on, it will also turn on the <code>Is Dead</code> property on <code>Pixel Monster</code> script and stop the monster’s movement.</p></td></tr></tbody></table>

### Monster Input Mouse and Keyboard

Script for feeding player inputs to `Monster Controller` script using mouse and keyboard.


---

# 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.cainos.net/pixel-art-monster-dungeon/monster-scripts.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.
