Results 1 to 5 of 5

Thread: vb; Get screen x/y by isometric tile x/y

Threaded View

  1. #4
    Addicted Member
    Join Date
    Jun 2004
    Location
    USA
    Posts
    172

    Re: vb; Get screen x/y by isometric tile x/y

    And if you want to get the coordinates of where to draw an ISO tile onto the screen by the X and Y of the ISO tile, heres how to do that:


    Code:
    This will give you the coordinates of this point where the X is:
    
    X#########################################
    #                   0                    #
    #             0           0              #
    #      0                         0       #
    # 0                                    0 #
    #      0                         0       #
    #             0           0              #
    #                   0                    #
    ##########################################
    
    The #'s make up the box around the iso tile, and the 0's make up the iso tile.
    The X is where the coordinates to draw are.
    VB Code:
    1. 'TileX and TileY is the iso tile coords,
    2. 'for example, 0,0, 0,1, 3,3, etc.
    3. 'Usually goes to about 16,16.
    4.  
    5. 'NewX and NewY are the X and Y coords
    6. 'On the screen, of the top left of an iso
    7. 'tile, which is where you would draw the tile
    8.  
    9.  
    10. 'Set the new X to the middle of the screen
    11. NewX = SCREENW / 2
    12. 'Move the new X to the left, by half the width of a tile
    13. NewX -= TILEW / 2
    14. 'Set the new Y to 0 (top of the screen)
    15. NewY = 0
    16.  
    17. 'Increase the newX by half the tile width multiplied by the ISO tile X
    18. NewX += TileX * (TILEW/2)
    19. 'Increase the newY by half the tile height multiplied by the ISO tile X
    20. NewY += TileX * (TILEH/2)
    21. 'Increase the newX by half the tile width multiplied by the ISO tile y
    22. NewX -= TileY * (TILEW/2)
    23. 'Increase the newY by the tile height multiplied by the ISO tile y
    24. NewY += TileY * TileH
    25.  
    26.  
    27. 'Optional: If your sprites vary in Height:
    28. 'Decrease the newY by any height past the regular tile height
    29. NewY -= Sprites(SpriteID).SurfaceDescription.Height - TILEH
    Last edited by xjake88x; Jan 16th, 2005 at 11:48 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width