Games XUI2D - How is the tilemap drawn?

Discussion in 'Game Development' started by ilan, Sep 27, 2018.

  1. ilan

    ilan Expert Licensed User

    hi "erel"

    i am pointing this question to erel since he is the creator of xui2d.

    i would like to understand how you add the tilemap the panel. and how it is positioning according to the world.

    so if my world is 25 meters width and 15 meter height i have from the center of the world 12.5 meters to the right and 12.5 meters to the left and 7.5 meters to the top and 7.5 meters to the bottom.

    now when i draw my tilemap is it also draw in the middle of the world?


    screenxui2d.jpg
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    (0,0) = map bottom-left corner.

    The correct way to set the world center is:
    Code:
    Dim WorldWidth As Float = 25 'meters
    Dim WorldHeight As Float = WorldWidth / RatioSetInDesignerScript 'same ratio as in the designer script
    X2.ConfigureDimensions(world.CreateVec2(WorldWidth / 2, WorldHeight / 2), WorldWidth)
    The result should look like:

    [​IMG]

    Above image is from the joints example (where the width is 6 meters).

    ScreenAABB shows the bottom-left corner and the top-right corner coordinates.
     
    ilan likes this.
  3. ilan

    ilan Expert Licensed User

    so something like this?

    screenxui2d2..jpg
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Not exactly. If the world center is set to 0, 0 then the map will only appear in the top right quarter.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice