Menu

#173 MapToScreen() dosn't work on a repeating map.

open
nobody
engine (73)
5
2003-12-24
2003-12-24
Anonymous
No

I created a map that repeats. Using MapToScreenX()
and MapToScreenY() does weird things once you get
near or pass the edge of the map once.

I'm using 1.108

Discussion

  • Justin White

    Justin White - 2003-12-24

    Logged In: YES
    user_id=937308

    If it matters I'm also using 800x600 resoloution?

     
  • Nobody/Anonymous

    Logged In: NO

    Doing some more work trying to find a 'workaround', I
    discovered the problem isn't entirely with MapToScreen() but
    more with GetPersonY() and GetPersonX().

    When a person goes off the bottom of the screen, it keeps
    adding or subtracting to the value.

    For example, if my map is 1200 pixels tall (75 tiles x 24 pixels
    per tile) a character could go off the bottom and technically
    be at Y=100, but the engine will return 1300 which confuses
    MapToScreenY().

     
  • Nobody/Anonymous

    Logged In: NO

    Doing some more work trying to find a 'workaround', I
    discovered the problem isn't entirely with MapToScreen() but
    more with GetPersonY() and GetPersonX().

    When a person goes off the bottom of the screen, it keeps
    adding or subtracting to the value.

    For example, if my map is 1200 pixels tall (75 tiles x 24 pixels
    per tile) a character could go off the bottom and technically
    be at Y=100, but the engine will return 1300 which confuses
    MapToScreenY().

     
  • Justin White

    Justin White - 2003-12-24

    Logged In: YES
    user_id=937308

    Doing some more work trying to find a 'workaround', I
    discovered the problem isn't entirely with MapToScreen() but
    more with GetPersonY() and GetPersonX().

    When a person goes off the bottom of the screen, it keeps
    adding or subtracting to the value.

    For example, if my map is 1200 pixels tall (75 tiles x 24 pixels
    per tile) a character could go off the bottom and technically
    be at Y=100, but the engine will return 1300 which confuses
    MapToScreenY().

     
  • Justin White

    Justin White - 2003-12-24

    Logged In: YES
    user_id=937308

    oops sorry for the triple post, was having trouble getting it to
    work I figured 'cause I wasn't logged in =Z.

     
  • Justin White

    Justin White - 2003-12-24

    Logged In: YES
    user_id=937308

    I made a simple work around. Since I already was storing the
    camera's X and Y into a variable because of some dynamic
    camera moving scripts I was working on, I used that.

    [code]

    function myMapToScreenY(loc)
    {
    loc -= system.cameraY
    loc += GetScreenHeight()/2
    return loc;
    }

    function myMapToScreenX(loc)
    {

    loc -= system.cameraX
    loc += GetScreenWidth()/2
    return loc;
    }
    [/code]

     
  • Nobody/Anonymous

    Logged In: NO

    if the values keep adding, use modulus to restore the x & y

     

Log in to post a comment.