The Scene Tutorial is finally out <https://youtu.b...
# korge
n
The Scene Tutorial is finally out

https://youtu.be/pdUEQP1Ry08

🎉 5
👍 3
s
Great, thank you. Question: how can I pass data between scenes?
n
Hehe I had to delete that part of the video because of audio issues. You can use dependency injection like in this sample https://github.com/korlibs/korge-samples/blob/8ef957b086bf218aad13859d0f08aa10b3cae52d/scenes/src/commonMain/kotlin/main.kt#L19
👌 1
i
The
changeTo
method signature receives N number of objects as the first argument, that objects are added to the injector and then are injected if needed to the scene that you’re changing to.
🙏 1
For instance here https://github.com/i-d-c-p/parasite-game/blob/d8fc04dbcd9cff6c0e59b905cea9a08e98ce697c/src/commonMain/kotlin/util/LoadingProxyScene.kt#L10 my
LoadingProxyScene
needs a
NextScreen
instance to be created so when I call
changeTo
I fulfill that dependency injecting an object of type
NextScreen
here https://github.com/i-d-c-p/parasite-game/blob/d8fc04dbcd9cff6c0e59b905cea9a08e98ce697c/src/commonMain/kotlin/scenes/MainScene.kt#L55. I injected another object called instructions as well.
🔥 1
r
thank you Nico! If I may request, please do viewports/cameras next. Thats confounding me right now. 😅
n
We are working on a new camera api at the moment. Right now, the camera is not as intuitive as it should be. Maybe you can ask your questions here so that we could handle them on a issue by issue basis 😃
❤️ 1