How to load tiles(as layers) for maps

BlitzPlus Forums/BlitzPlus Programming/How to load tiles(as layers) for maps

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

a bank is just a piece of memory..

bla=CreateBank(1000)

now you have 1000 bytes of memory for you to abuse.. (to store variables/large maps etc.)

A bank is the way to make your own commands that look like normal blitz commands, instead of types that look like types.

See the help for CreateBank, PokeByte, PeekByte, PokeShort, PeekShort, PokeInt, PeekInt, PokeFloat, PeekFloat, BankSize, ResizeBank and FreeBank.

for maps, instead of storing 1 byte per maptile in a 2d array like this: dim map(100,100)

you could use a bank, like this: map=CreateBank(100*100)

in this case:
memlocation 0..99 equals x:0..99 / y:0
memlocation 100..199 equals x:0..99 / y:1
memlocation 200..299 equals x:0..99 / y:2

etc.

however, only when you use bytes.. if you use shorts (=2 bytes) then you need a bank twice this size and then:

memlocation 0..199 step 2 equals x:0..99 / y:0
memlocation 200..399 step 2 equals x:0..99 / y:1

etc.