-
Notifications
You must be signed in to change notification settings - Fork 7
Scene
ural89 edited this page Nov 9, 2025
·
1 revision
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);You can create a game object with this method. It will return a GameObject ptr.
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 classReturns GameObject pointer
Returns full list of GameObjects in the scene
Init is called first when game starts. And then Start method is called.
Called every tick. You must call Scene::Update(deltaTime) !!!:
void YourScene::Update(float deltaTime)
{
YourScene::Update(deltaTime);
// your logic here
}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