View.moveTo deprecated
Hi, I am trying to run this game locally and I am facing a few issues with one function which has been deprecated (View.moveTo). Also, I can't figure out how to solve it using animator as the documentation suggests.
blocks[id]!!.moveTo(columnX(pos.x), rowY(pos.y), 0.15.seconds, Easing.LINEAR)
It is important to highlight that I've updated this project with the following:
gradle-7.5-all.zip korge-gradle-plugin 3.4.0
Could you please help me?
Thank you!
Hi @pcorreia89! Unfortunately, I haven't used KorGE for a long time, so I don't know the new API and can't help you here. Sorry :( But I think you can ask how to solve this problem in the official KorGE discord server: https://discord.gg/jKCxCHn If you find a solution, please provide it here, so you'll help other people. If you have some free time and desire, you can also provide a PR - that would be very helpful, too.
Hello,
I might be a bit late, but I got this working on my machine @pcorreia89.
The most up-to-date Korge lib as of November of 2023 requires the following implementation:
blocks[id1]?.let { moveTo(it.bview, columnX(pos.x), rowY(pos.y), 0.15.seconds, Easing.LINEAR) }
The newest moveTo implementation requires a view.
Since blocks is a Block : Container array, we can get the base view from it with the bview method from the View class.
@RezMike, I am finishing the tutorial and might open a PR with some fixes that were required to run the project with the most recently Korge lib.
@g-marcondes thank you for your help, any PR will be welcome!
I noticed that your 2048 implementation is based on a different set of imports from the korge lib. They use the working libs from 2021. In that case, I am just going to leave it as it is and leave the fixes here that worked for me using the version from November 2023 (the first one is the same from the previous comment - just placing it all together for future reference):
Old
blocks[id]!!.moveTo(columnX(pos.x), rowY(pos.y), 0.15.seconds, Easing.LINEAR)
New
blocks[id1]?.let { moveTo(it.bview, columnX(pos.x), rowY(pos.y), 0.15.seconds, Easing.LINEAR) }
Old
animateSequence {
New
animate {
Old The set bounds was messing up the UI. I removed it, tried the game for more than 1024 and had no problems.
\\setTextBounds(Rectangle(0.0, 0.0, bgScore.width, cellSize - 24.0))
New
\\setTextBounds(Rectangle(0.0, 0.0, bgScore.width, cellSize - 24.0))