# Component

Let's just define an example

{% hint style="warning" %}
"\*" at the beginning indicates that it must be entered
{% endhint %}

```javascript
const player1 = new Component({
  name: "player1",//*Component name
  inscreen: true,//prevents exiting the screen
  physic: {
    status: true//Adds physics
  },
  position: {//*starting position
    x: 0,
    y: 0,
  },
  scale: {//*how big will it be
    x: 100,
    y: 180,
  },
  color:"red",//optional color
  notick:false//Turns off physics and collision rendering optimization
});
```

![](https://644134079-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAoN3PvLitJVdWdsmwATH%2Fuploads%2FFGxQaguaE6DrUSQ4T0nj%2Fimage.png?alt=media\&token=1da696ff-99c7-4f3d-9f2e-b82d4b1a0d53) :tada::tada::tada: **Yes we created a new object**

## Update&#x20;

<pre class="language-javascript"><code class="lang-javascript"><strong>player1.update({
</strong>    physic:{
        x:5,
        y:20
    }
<strong>})
</strong><strong>//or 
</strong>updateData({
    name:"player1",
    physic:{
        x:5,
        y:20
    }
})
</code></pre>

## Get

```javascript
console.log(player1.get())
console.log(getData("player1"))
//Example
console.log(
player1.get().physic.x
)
```

## Remove

```javascript
player1.remove()
removeData("player1")
```


---

# 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://electoriaengine.gitbook.io/api/components/component.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.
