Author Topic: Converter and Loader for tmx files from Tiled v 0.6.1  (Read 3710 times)

Offline D2O

  • Prof. Inline
  • *****
  • Posts: 1063
    • View Profile
    • http://www.deuteriumoxid.com
Quote
Edit:
New version, now writes 2 bytes, that should, for maps is enough.
Internally something altered, it is listed everything in Array's and is sorted.
http://www.glbasic.com/showroom.php?game=tmx_2_d2ma_v3&lang=de
Hi all,
downloadfiles are here, http://www.deuteriumoxid.com/glbasic/testfile.zip
Include a little Tutorial as DIVX Movi without sound.

Info: Tiled is a Java Program, more here, http://mapeditor.org

Please Feedback.
Cya


Oops, i forget the loader file ;)

Loaderfile :

Code: GLBasic [Select]
// --------------------------------- //
// Project: D2MA_Loader
// Start: Wednesday, January 30, 2008
// IDE Version: 5.154
// (c)Fabbio Soddu
// d2o@deuteriumoxid.com
//

//  +.d2ma Loader

comein$ = FILEREQUEST$(TRUE, "D2MA|*.d2ma|All|*.*")

byte = GETFILESIZE(comein$)
map = OPENFILE(0,comein$,TRUE)


        READBYTE 0,lx           //Width
        READBYTE 0,ly           //Higth
        READBYTE 0,tilex
        READBYTE 0,tiley
        READBYTE 0,layer

DIM field[lx][ly][layer]


        FOR la = 0 TO layer - 1
                        FOR iy = 0 TO ly - 1
                                FOR ix = 0 TO  lx - 1
                                         READBYTE 0,a
                                        field[ix][iy][la] = a
                                NEXT
                        NEXT
        NEXT
CLOSEFILE 0
///              End Loader

WHILE TRUE

        FOR la = 0 TO layer - 1
                        FOR iy = 0 TO ly - 1
                                FOR ix = 0 TO  lx - 1

                                                a = field[ix][iy][la]
                                                        IF a <> 0 AND la = 0
                                                                        DRAWRECT 0+(tilex*ix),0+(tiley*iy),tilex,tiley,RGB(0x00, 0x80, 0xff)
                                                        ENDIF



                                                        IF a <> 0 AND la = 1
                                                                        DRAWRECT 0+(tilex*ix),0+(tiley*iy),tilex,tiley,RGB(0xff, 0x00, 0x00)
                                                        ENDIF
                                NEXT
                        NEXT
        NEXT


SHOWSCREEN

SLEEP 200
WEND
I7 2600K; 8 GB RAM ; Win10 Pro x64 | NVidia GTX 750 TI 2048MB ; Realtec OnBoard Sound;
Lenovo ThinkPad T400: XP Pro
GLB Premium-immer Aktuell

Offline PeeJay

  • Mr. Polyvector
  • ***
  • Posts: 244
    • View Profile
    • PeeJays Remakes
Excellent - certainly might come in handy! :)
www.peejays-remakes.co.uk
For games, remakes, and GL Basic Tutorials
Artificial Intelligence is no match for Natural Stupidity

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10714
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Awesome!