# Game Objects

As your scene becomes more complicated, it's useful to put some of the logic into separate game object files. By doing this, you can keep the main code for the scene clean and simple to read, while encapsulating reusable parts that control several entities in the scene.

A Game Object holds all the properties and methods for a type of entity you might find in your scene, for example a door or a button or a monster. Thanks to this abstraction, the files with your scene's main logic can instance full game objects through just one line of code. You can also call the methods on these objects with the same ease.

We recommend keeping game object definitions each in a separate file.

## The Type Object Pattern

If your scene uses various types of game objects that have much in common, you might want to take this refactor even further, and define a *base* game object type with all the things that these have in common. You can then create sub classes that inherit from this base class.

You can read more about this pattern in [Game Programming Patterns](http://www.gameprogrammingpatterns.com/type-object.html).


---

# 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.decentraland.org/creator/scenes-sdk7/programming-patterns/game-objects.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.
