0 Members and 1 Guest are viewing this topic.
Id noone has solves it , i'll answer tommorow, now i can't do all of it out of my head (i actually can but it would take a long time to type on ipod + i can't see your source)
Or if you could post the source in CODE block, then i could help now... I'm bored anyway xp
Lbl getTile{r2/8*tileMapWidth+(r1/8)+pointer}Return
getTile(X,Y)+getTile(X+7,Y+7)+getTile(X,Y+7)+getTile(X+7,Y)
For(row,0,8)For(column,0,12)Pt-On(column*8-xOffset,row*8-yOffset,{yTile+column*tileMapWidth+xTile+pointer}*8+tileSprites})EndEnd
.smtscrll.tiles (black and white)[0000000000000000]-> pic0[FFFFFFFFFFFFFFFF].sprite 8*8 stored in pic1.map (15*10)[010101010101010101010101010101]->GDB0[010000000000000000000000000001] .this one 8 times[010101010101010101010101010101].initialize vars (x=x-pos , y=y-pos , c=horizontal scroll, d= vertical scroll)0->C->D+8->X->Y.till [clear] is pressedRepeat Getkey(15)MOVE()MAP().2 subroutines are calledPt-on(X,Y,pic1)DispGraphEndLbl MOVEX+(Getkey(3) and (X<88))-(Getkey(2) and (X>0))->XC+(Getkey(3) and (X=88))-(Getkey(2) and (X=0))->C.only change X when it's on screen If it's on border of screen the change the scroll var (same for Y)Y+(Getkey(1) and (Y<56))-(Getkey(4) and (Y>0))->YD+(Getkey(1) and (Y=56))-(Getkey(4) and (Y=0))->DReturnLbl MAPFor(A,C/8,C/8+12)For(B,D/8,D/8+8)Pt-on(A*8-C,B*8-C,{15*B+A+GDB0}*8+pic0).so this says: draw the map, where 15=the length of the mapEndEndReturn.end of program, no collision detection yet but easy to implement... Question? Ask me...
And this doesn't include collision detection yet, but it's easy to implement...
...0->C->D+8->X->Y.till [clear] is pressedWhile 1MOVE()MAP().2 subroutines are calledPt-on(X,Y,pic1)DispGraphClrDrawEndIf getKey(15)Lbl MOVEgetKey(3)-getKey(2)+X!If +1 //if x = -1->x //make x = 0, since the !If +1 statement left a 0 in hlC-- //decrement CElse!If -89 //otherwise, check if x is 88 (actually, we're checking if x+1-89=0, but it's the same thing right?)C++88->XEndgetKey(1)-getKey(4)+Y!If +1->YD--Else!If -57D++56->YEnd //and same stuff for Y. Halved the number of getKeys here.ReturnLbl MAP.Okay, so the main driving force behind the optimization logic here is that we want to move as much stuff as we can outside of loops..So for example, C and D will never change while we're in the loop so....I made up some variable names but you can use whatever you want.D/8->tileY*15+GDB0->tilePointerC/8->tileX-(C^8)-8->offX-(D^8)->screenYFor(9) //for the 9 rows to be drawntileX->tileX0 offX->screenXFor(A,0,12)Pt-on(screenX+8->screenX,screenY,{tilePointer+A}*8+pic0)EndscreenY+8->screenY //move the Y "pen position" down a rowtilePointer+15->tilePointer //next row of tilesEndReturn