0 Members and 2 Guests are viewing this topic.
.SCROLLClrDraw[003C7E7E7E7E3C00]->Pic1[FF818181818181FF]->Pic2Pt-On(40,40,Pic2Repeat getKey(15)Pt-On(X,Y,Pic1If getKey(1)Y+1->YVertical -EndIf getKey(2)X-1->XHorizontal +EndIf getKey(3)X+1->XHorizontal -EndIf getKey(4)Y-1->YVertical +EndDispGraphEnd
I've been trying to make a scrolling engine but I'm not having much luck :SCode: [Select].SCROLLClrDraw[003C7E7E7E7E3C00]->Pic1[FF818181818181FF]->Pic2Pt-On(40,40,Pic2Repeat getKey(15)Pt-On(X,Y,Pic1If getKey(1)Y+1->YVertical -EndIf getKey(2)X-1->XHorizontal +EndIf getKey(3)X+1->XHorizontal -EndIf getKey(4)Y-1->YVertical +EndDispGraphEndThat is my code and what is happening, attached is the source code.My problem is that the scrolling is not working like, for example, in a RPG, and I want it for each time the ball moves 1 pxl, that little square moves one pxl too in a controlled way, isntead of what is happening (everything is crazy)
Michael, your code isn't showing up...
Quote from: yunhua98 on January 14, 2011, 05:43:23 pmMichael, your code isn't showing up...Yeah it isn't :S
.SCROLL[003C7E7E7E7E3C00]->Pic1[FF818181818181FF]->Pic210->X->YRepeat getKey(15) ClrDraw Pt-On(35,35,Pic1) Pt-On(X,Y,Pic2) DispGraph If getKey(1) Y-1->Y End If getKey(2) X+1->X End If getKey(3) X-1->X End If getKey(4) Y+1->Y EndEnd
:.RPG::0→A→B:.Position of tilemap::4→V+1→U:.V and U are position of cross::Repeat getKey(15):If getKey(3) and (sub(ZIP,A+U+1,B+V)=0: If A<24 and (U=5): +A→A: ElseIf U<11: +U→U: End:ElseIf getKey(2) and (sub(ZIP,A+U-1,B+V)=0: If (U=5) and (A>0): A-1→A: ElseIf U>0: U-1→U: End:End:If getKey(1) and (sub(ZIP,A+U,B+V+1)=0: If B<8 and (V=4): +B→B: ElseIf V<7: +V→V: End:ElseIf getKey(4) and (sub(ZIP,A+U,B+V-1)=0: If B>0 and (V=4): B-1→B: ElseIf V>0: V-1→V: End:End:DispGraphClrDraw:sub(TLM):Pt-On(U*8,V*8,[181818FFFF181818]:End:Return::.Subroutine to wait no key pressed:Lbl NOG:While getKey(0): Pause 5:End:Return::.Tile:[0000000000000000]→Pic1:.Tile n°0:[FFFFFFFFFFFFFFFF]:.Tile n°1:[55AA55AA55AA55AA]:.Tile n°2:[7FBFDFEFF7FBFDFE]:.Tile n°3::.You can up to 16 tiles::.Map:[111111111111111111111111111111111111]→GDB1:.Line 1:[100000000000000000000000000000000001]:.Line 2:[100000000000000000333333000000000001]:.Line 3:[100000000000000000333333000000000001]:.Line 4:[100000000000000000333333000000000001]:.Line 5:[100000000000000000330033000000000001]:.Line 6:[100000000000000000330033000000000001]:.Line 7:[100000000000000000333033000000000001]:.Line 8:[100000000000000000330033000000000001]:.Line 9:[100000000000000000330333000000000001]:.Line 10:[100000000000000000330333000000000001]:.Line 11:[100000000000000000000000000000000001]:.Line 12:[100000000000000000000000000000002221]:.Line 13:[100000000000000000000000000000002221]:.Line 14:[100000000000000000000000000000002221]:.Line 15:[111111111111111111111111111111111111]:.Line 16::.Subroutine to display each tile on screen:Lbl TLM:For(Y,0,7): For(X,0,11): sub(ZIP,X+A,Y+B)→r1: Pt-On(X*8,Y*8,r1*8+Pic1: End:End:Return::.Subroutine to extract byte from map (GDB1):Lbl ZIP:r2*36+r1→r1:{r1/2+GDB1}→r2:If r1^2: r2^16:Else: r2/16:End