Skip to content
ural89 edited this page Nov 9, 2025 · 1 revision

Scene

When you create a new project with create_new_project.sh script, you will have an entry scene (Source/Scenes/EntryScene.h/.cpp)

To change scene from anywhere you can call:

auto scene = new YourAnotherScene(); //scene is inherited from Scene class
SceneManager::ChangeScene(scene);

Methods

CreateGameObject(name, position)

You can create a game object with this method. It will return a GameObject ptr.

AddGameObject(GameObject*, position)

You can manually create a class inherited from GameObject class for more customized GameObject. And to add this GameObject to scene you can pass it as parameter to AddGameObject method:

auto playerGameObject = new PlayerGameObject(*this, position); //this is called from scene class

FindGameObject(gameObjectName)

Returns GameObject pointer

GetGameObjects() const

Returns full list of GameObjects in the scene

Virtual Methods

Init() and Start()

Init is called first when game starts. And then Start method is called.

Update()

Called every tick. You must call Scene::Update(deltaTime) !!!:

void YourScene::Update(float deltaTime)
{
	YourScene::Update(deltaTime);
    // your logic here
}

Raycaster

There is a raycaster class you can use to raycast:

bool Raycaster::RayCast(Vector2 startPosition, Vector2 direction, RayHit &rayHit, int distance, const std::string& targetName);
// you can use RayHit.gameObject

Clone this wiki locally