amiga.org
     
iconAll times are GMT -6. The time now is 10:33 PM. | Welcome to Forum, please register to access all of our features.

» Amiga.org » Blogs » Damiga » AMOS code, simple tile-based level routine for a game

Rate this Entry

AMOS code, simple tile-based level routine for a game

Submit "AMOS code, simple tile-based level routine for a game" to Digg Submit "AMOS code, simple tile-based level routine for a game" to del.icio.us Submit "AMOS code, simple tile-based level routine for a game" to StumbleUpon Submit "AMOS code, simple tile-based level routine for a game" to Google
Posted 05-10-2011 at 03:52 PM by Damiga

Ok so first is a procedure that contains the actual level data, for now it's just numbers that refers to what bob to paste, 1=wood or something that the player can't move into, 2=a safe location like a town, 3=road, 4=enemy

Procedure SHIREMAP
For Y=1 To MAPHEIGHT
For X=1 To MAPWIDTH
Read MAPLOCATION(X,Y)
Data 3,3,3,1,1,3,3,3,3,4
Data 1,1,3,1,1,3,1,1,1,2
Data 1,1,2,3,3,3,3,1,1,1
Data 1,1,1,1,1,1,3,1,1,1
Data 1,1,1,1,1,1,3,3,3,5
Data 1,1,1,1,1,1,1,1,1,1
Next X
Next Y
End Proc

Next procedure puts the level on screen, every tile is 16x16 pixels.

Procedure DISPLAYMAP
Screen 1
For Y=1 To MAPHEIGHT
For X=1 To MAPWIDTH
Paste Bob X*16,Y*16,MAPLOCATION(X,Y)
Next X
Next Y
End Proc


Very simple, but I aim to add more features, another array similar to MAPLOCATION that can contain events, items etc.
Posted in Uncategorized
Views 1470 Comments 1 Edit Tags Email Blog Entry
« Prev     Main     Next »
Total Comments 1

Comments

  1. Old Comment
    SamuraiCrow's Avatar
    Some tips: Change the Paste Bob command to Paste Icon and it will go faster since it doesn't need to mask the blit.

    Also, storing as data statements uses 4 bytes per cell. Since an Icon Bank can only hold 4096 images maximum, you'll only need 2 bytes per cell and still have 4 bits left over for flags. If you use Deek and Doke to read addresses from a work bank, it will use half the memory and be twice as fast on 16-bit Amigas.

    For an example of how to load a file into a work bank see the last example in this thread. It uses a Print$ command to print it as text but you can replace it with your tile printing loop.
    Posted 05-10-2011 at 06:30 PM by SamuraiCrow SamuraiCrow is offline