0 Members and 2 Guests are viewing this topic.
:.TILEMAP:[0000000000000000]->Pic0:[FFFFFFFFFFFFFFFF]::[010101010101010101010101010101010101010101010101]→GDB1:[010101010101010101010101010101010101010101010101]:[010101010101010101010101010101010101010101010101]:[010101010101010101010101010101010101010101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010100000000000000000000000000000101010101]:[010101010101010101010101010101010101010101010101]:[010101010101010101010101010101010101010101010101]:[010101010101010101010101010101010101010101010101]::0->P->Q \\P and Q are the coordinates of the corner of the screen relative to the entire chunk of level data::Repeat getKey(15)::getKey(3)-getKey(2)+P->P:getKey(1)-getKey(4)+Q->Q \\I didn't code in collision detection, if you need that too, tell me::sub(MAP)::Pt-On(40,24,(your sprite here)::DispGraph::End::Lbl MAP:ClrDraw:For(B,0,7):For(A,0,11):Pt-On(8*A,8*B,{Q+B*24+P+A+GDB1}*8+Pic0:End:End
Thanks, that is exactly what I need to get started.for the map drawing .sub(map. is it A*8 because of 8x8 tiles? Also what is {Q+B*24+P+A+GDB1} can you give me answer in depth?
What he said.
also, if it clarifies anything, given an array GDB1 with n number of columns, you can access the yth element down and the xth element over via the following formula:{y*n+x+GDB1}keep in mind this returns one byte, a value between 0 and 255. to do other things like access nibbles and two-byte integers (between 0 and 65,535) it gets slightly more complicated, but retains the same idea.
What he said.the A*8 is indeed because of the 8x8 tiles, and in {Q+B*24+P+A+GDB1}, Q+B*24 is interpreted as (Q+B)*24 because of left to right order of operations. The width of the map is 24, so to get to the next row, you add 24, in this case, you add Q+B number of rows. Add one to go one byte to the right, so P and A are added, plus the original pointer, GDB1.
Quote from: yunhua98 on August 02, 2011, 04:03:12 pmWhat he said.the A*8 is indeed because of the 8x8 tiles, and in {Q+B*24+P+A+GDB1}, Q+B*24 is interpreted as (Q+B)*24 because of left to right order of operations. The width of the map is 24, so to get to the next row, you add 24, in this case, you add Q+B number of rows. Add one to go one byte to the right, so P and A are added, plus the original pointer, GDB1.Hem... Is it normal? IRL, or in C, the * operaotr has more priotiy than +...