0 Members and 1 Guest are viewing this topic.
.A#Icon(FFFF8001BC3DA5E5A525BD2581E59C3D95C19D7981C9BE89A289BEF98001FFFF)[E0E0808000000000]->Pic1ClrDraw^^rFix 51280->X10240->Y0->A->B24->C20->ERepeat getKey(15) .CHECK IF USER IS TOUCHING FLAG If (X/256-C+4<=8) and (Y/256-E+4<=8) Return End .CHECK IF ENEMY ON THE LEFT 0->J For(I,0,3) If (pxl-Test(X/256-1,Y/256+I)^^r) 1->J End End .CHECK IF ENEMY ON THE RIGHT 0->K For(I,0,3) If (pxl-Test(X/256+4,Y/256+I)^^r) 1->K End End .CHECK IF ENEMY ON TOP 0->M For(I,0,3) If (pxl-Test(X/256+I,Y/256-1)^^r) 1->M End End .CHECK IF ENEMY BELOW THE PLAYER 0->N For(I,0,3) If (pxl-Test(X/256+I,Y/256+4)^^r) 1->N End End .IF AN ENEMY IS TOUCHING THE PLAYER If (N) or (M) or (J) or (K) Return End .CHECK IF WALL ON THE LEFT 0->L For(I,0,3) If (pxl-Test(X/256-1,Y/256+I)) 1->L End End .CHECK IF WALL ON THE RIGHT 0->R For(I,0,3) If (pxl-Test(X/256+4,Y/256+I)) 1->R End End .IF ANYTHING ON THE RIGHT OR ON THE LEFT, STOP If L or (R) 0->A End .CHECK IF ANYTHING UNDER THE PLAYER 0->D For(I,0,3) If (pxl-Test(X/256+I,Y/256+4)) 1->D End End .GRAVITY B+5->B For(I,0,3) If pxl-Test(X/256+I,Y/256-1+(B>>0*5)) 0->B End End .GO LEFT If getKey(2) and (A>>~255) and (L=0) A-32->A End .GO RIGHT If getKey(3) and (A<<256) and (R=0) A+32->A End .JUMP WHEN USER PRESSES UP If getKey(4) and (D) ~256->B End .WALL JUMP ON THE LEFT If (R) and (D=0) and (getKey(2)) and (getKey(4)) ~100->B A-40->A End .WALL JUMP ON THE RIGHT If (L) and (D=0) and (getKey(3)) and (getKey(4)) ~100->B A+40->A End .LIMIT SPEED AT 1 PIXEL If (B>>256) 256->B End .FRICTION If A-1=>=>0 A-2->A End .FRICTION If A//32768 A+2->A End .UPDATE POSITIONS X+A->X Y+B->Y .DRAW THE MAP Rect(0,0,96,64) RectI(4,4,88,56) Rect(20,24,12,4) .DRAW THE PLAYER Rect(X/256,Y/256,4,4) .DRAW THE FLAG Pt-On(C,E,Pic1) DispGraph^^rEnd
Why not draw the tilemap once, save the screen to a buffer, and recall that buffer at the beginning of each render loop? That's what I do whenever possible, and why TaNF/UCTI both ran at well over 45 FPS.
.DRAW MAP USING TILEMAPPING CODE HEREStorePicRepeat getKey(15)RecallPicDispGraph^^rEnd
GetCalc("appvTEMP01",2*768) -> BTilemapDrawingRoutine()Copy(L6,B,768):Copy(L3,B+768,768)...code...Lbl REDR .Redraw Routine Copy(B,L6,768):Copy(B+768,L3,768)Return