Results 1 to 4 of 4

Thread: DxDraw Surface and DXSpriteEngine

  1. #1

    DxDraw Surface and DXSpriteEngine

    i am trying to create a code in which when a unit (in turn based strategy) is attacked and when from his life is drained the drained amount to be displayed above it for a couple a seconds.

    so my idea was after the damage calculations to display a text using the DxDraw Canvas above the unit but i couldnt do it because i cant get the coordinates of the unit on the screen the only coordinates i have are his place in the map which arent any good right about now cous the canvas displays the text only in the visible part of the screen and coordinates like 1000 5000 arent in the visible part of the screen. (i know the explanation isnt very good but i cant do it better hope you understand what i mean).

    so thats my problem right about now

  2. #2

    DxDraw Surface and DXSpriteEngine

    If your units are actually tiles (or something alike) then you need to take the tile coordinates and multiply them with the tileheight and -width. Then substract this value from the scrolling offset and you're set.

    For example,
    Your tiles are 32x32
    The target tile = at 142,227
    your scrolloffset = 4112, 6930

    32*142= 4544
    32*227= 7264

    4544 - 4112 = 432
    7264 - 6930 = 334


    If this is not correct then show us of code, it might explain better what you have and how to deal with it.

  3. #3

    DxDraw Surface and DXSpriteEngine

    omg i cant believe that the solution is soo simple i think i need a rest .....
    anyway thanks Traveler your idea worked perfectly

  4. #4

    DxDraw Surface and DXSpriteEngine

    No problem at all.

Bookmarks

Posting Permissions

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