Hi all, joined this channel some minutes ago and d...
# korge
t
Hi all, joined this channel some minutes ago and directly have a question. Some days ago I started with the 2048 Tutorial. The tutorial is not quite up to date but i could figure out the most changes that I need to do until step 3. In Step 1 the usage of the "graphics" method is shown and the documentation say "...position relative to its Graphics container...". But for me its not working and the position is not relative This is my graphics method.
Copy code
graphics {
        position(leftIndent, leftIndent)
        fill(Colors["#cec0b2"]) {
            roundRect(cellSize, cellSize, 3.0) {
                position(10, 10)
            }
        }
    }
It seems that the first position method with leftIndent and leftIndent as parameters is not working. For me that roundRect is positioned at 10, 10. I would expect that 10, 10 is added to leftIndent for x and y. I am sure that I misuse the parameters or have something configured wrongly. Any idea? Thx for help
r
I think, the first
position
call (with indents) is cleared by the second one (with 10, 10), since they both are called on the graphics instance
t
The second
position
call is called within the roundRect brackets. I would assume its called on the RoundRect instance and not on the Graphics instance.
r
If you want that behavior, you should call
roundRect(...) { position(...) }
without
graphics { ... }
in the latter case
roundRect
is a function with
Container
receiver, in your case it's a function with `Graphics`/`VectorBuilder` receiver, they work differently
t
I only tried to follow the 2048 Tutorial....
r
Well, some api there is outdated
Please check the latest version of 2048 game on GitHub, I updated it to KorGE 2.0.0.1 a few days ago https://github.com/RezMike/2048
t
Ok thx