> For the complete documentation index, see [llms.txt](https://electoriaengine.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://electoriaengine.gitbook.io/api/engine/sounds-and-shaders.md).

# Sounds and Shaders

Who wants to listen to rickroll?

## Sounds

```javascript
const sound = new Audio("./sa.mp3");
sound.currentTime = 0;//start time (do not have to enter)
sound.play().catch(()=>{});
sound.volume = 1;
sound.loop = true;
```

{% hint style="danger" %}
(android, macos, windows, linux) for those other than

To prevent sudden sound in browsers: if you do play() directly, it will give an erorr. the user will not give an error when the user presses a key or clicks somewhere. (you can do something like press a key to start the game).

more information:<https://goo.gl/xX8pDD>
{% endhint %}

### Add

{% code overflow="wrap" fullWidth="true" %}

```javascript
autocomponentsound(
true,//add or remove
sound,//example: const sound = new Audio("./sa.mp3");
player1.name,//Enter the name of 1 obje
player2.name,//Enter the name of 2 obje
area//you choose how much area you want to have, manually 1.5 is set (you don't have to enter it)
)
```

{% endcode %}

### Remove

{% code overflow="wrap" %}

```javascript
autocomponentsound(false,sound)
```

{% endcode %}

{% embed url="<https://1070416189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAoN3PvLitJVdWdsmwATH%2Fuploads%2Fy5HGUdqAn3FbaJrAK1JH%2Fsaturkvarmi.mp4?alt=media&token=289160eb-1b2b-47cc-941f-c372c35d96c2>" %} <mark style="color:red;">**Warning:**</mark>**&#x20;**<mark style="color:yellow;">**the sound may be loud**</mark>
{% endembed %}

## Shaders

{% hint style="warning" %}
You may need to turn this feature on onload
{% endhint %}

{% code title="onload.js" overflow="wrap" %}

```javascript
{
autoshaders:20000//One hour advances in a game every 20 minutes
autoshaders:0//if you do this, you will shut down the system
}
```

{% endcode %}

```javascript
autoshaders(true,"player1")//add
autoshaders(false,"player1")//remove
```

{% hint style="danger" %}
The character must have shadow\.status = true. and as a suggestion, do not assign blur to the character
{% endhint %}

{% embed url="<https://1070416189-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAoN3PvLitJVdWdsmwATH%2Fuploads%2F0bkz9tGsLhNWdzc6zE6J%2F0730.mp4?alt=media&token=5f541b93-a638-458f-a787-b90a9c7fd088>" %}
