https://kotlinlang.org logo
Title
n

Nico

06/30/2020, 8:01 PM
The Scene Tutorial is finally out

https://youtu.be/pdUEQP1Ry08

👍 3
🎉 5
s

SerVB

06/30/2020, 8:08 PM
Great, thank you. Question: how can I pass data between scenes?
n

Nico

06/30/2020, 8:27 PM
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

Iván C.

06/30/2020, 8:30 PM
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.
:tnx: 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

Rishav Sharan

07/01/2020, 6:36 AM
thank you Nico! If I may request, please do viewports/cameras next. Thats confounding me right now. 😅
n

Nico

07/01/2020, 6:45 AM
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