Kartat : funktiot

GETMAP


   KUVAUS

Käytä tätä funktiota lukeaksesi karttaa. Koordinaatit annetaan pelimaailman pikseleinä, joten (0,0) ei välttämättä ole kartan vasen yläkulma.

Jos haluat esittää koordinaatit tileinä, käytä mieluummin GetMap2:sta.

Palautettu luku on kokonaisluku, ja kahdessa ensimmäisessä kerroksessa se kertoo siinä kohdassa olevan tilen järjestysnumeron. Törmäyskerroksessa 1 (seinä) tai nolla (tyhjä).

   KÄYTTÖ
GETMAP (kerros, x, y)

  • kerros
    0 = taustakerros
    1 = päälliskerros
    2 = törmäyskerros
    3 = datakerros
  • x = Kokonaisluku. X-koordinatti pikseleinä.
  • y = Kokonaisluku. Y-koordinatti pikseleinä.

  • Katso myös: GETMAP2

       ESIMERKKI
    FrameLimit 40 'limit game performance

    'Load map and animate it
    map= LoadMap("Media\cdm2.til","Media\tileset.bmp")
    PlayObject map,0,0,0.5

    cursor=LoadImage("Media\cursor.bmp")
    ShowMouse cursor

    AddText "Arrows to scroll..."
    AddText "Pinpoint tiles with the mouse"

    Repeat

        'Move the camera
        If UpKey() Then MoveCamera 0,2
        If DownKey() Then MoveCamera 0, -2
        If LeftKey() Then MoveCamera-2
        If RightKey() Then MoveCamera 2
        
        'Otherwise we wouldn't be able to see the text
        DrawGame
        
        Color cbyellow
        'Calculate the tile under mouse
        '(200 is half the SCREENWIDTH, 150 is half the SCREENHEIGHT)
        tile=GetMap(0,MouseWX(), MouseWY())
        Text 60,60,"Tile under mouse: "+tile
        
        DrawScreen

    Forever

    <<TAKAISIN