Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View.moveTo deprecated #8

Open
pcorreia89 opened this issue Feb 4, 2023 · 4 comments
Open

View.moveTo deprecated #8

pcorreia89 opened this issue Feb 4, 2023 · 4 comments

Comments

@pcorreia89
Copy link

pcorreia89 commented Feb 4, 2023

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!

@RezMike
Copy link
Owner

RezMike commented Feb 4, 2023

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.

@g-marcondes
Copy link

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.

@RezMike
Copy link
Owner

RezMike commented Nov 14, 2023

@g-marcondes thank you for your help, any PR will be welcome!

@g-marcondes
Copy link

g-marcondes commented Nov 15, 2023

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))
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants