2

I am trying to follow the following tutorial,
I use eclipse as my IDE of choice and maven for the dependencies. Since I am unfamiliar with Kotlin and I am actually programming in Java I have no idea how to solve the issue. I had a look at the following posts:

un-initialized property access exception late-init property pref has not been initialize
How to check if a late-init variable has been initialized

Exception:

 kotlin.UninitializedPropertyAccessException: lateinit property engine
 has not been initialized   at
 com.almasb.fxgl.dsl.FXGL$Companion.getAssetLoader(FXGL.kt:106)     at
 com.almasb.fxgl.dsl.FXGL$Companion.image(FXGL.kt:199)  at
 com.almasb.fxgl.dsl.FXGL.image(FXGL.kt)    at
 AnimationComponent.<init>(AnimationComponent.java:18)  at
 SimpleGameApp.initSettings(SimpleGameApp.java:15)  at
 com.almasb.fxgl.app.GameApplication.takeUserSettings(GameApplication.java:118)
    at
 com.almasb.fxgl.app.GameApplication.launch(GameApplication.java:96)
    at
 com.almasb.fxgl.app.GameApplication.launch(GameApplication.java:58)
    at SimpleGameApp.main(SimpleGameApp.java:37)

I have no clue what could be wrong, I tried to add some dependencies for Kotlin in my pom file but this didn't help either. I think a source of my problem could be the deprecation warning in my IDE which you can see in the image.

Deprecation Warning fxgl.component Img

Dushyant Tankariya
  • 1,432
  • 3
  • 11
  • 17
madave
  • 97
  • 8
  • 1
    Based on the stacktrace, `AnimationComponent.`, which is `new AnimationComponent` gets called in `initSettings()`. In the tutorial, there is no code inside `initSettings()`. There is full source code at the end of the tutorial page, please can you make sure it's copied verbatim: https://github.com/AlmasB/FXGL/wiki/Adding-Sprite-Animations-%28FXGL-11%29#full-source-code – AlmasB Aug 03 '19 at 09:05
  • 1
    @AlmasB oh, thanks. I oversaw this i have put my code into initSettings() instead of initGame(). Problem solved! – madave Aug 03 '19 at 09:21

0 Answers0