0 Members and 2 Guests are viewing this topic.
.A./front frames[FFC1C3E7C33E23FB]→Pic0[C1C3E7C33E62F3FF][FFC1C3E7C37CC4DF][C1C3E7C37C46CFFF]./right frames[FFC1E1EBA13E22DB][C1E1EBE1DF9393E7][FFC1E1EBE19F93DB][C1E1EBE1BE2223E7]./left frames[FF8387D7857C44DB][8387D787FBC9C9E7][FF8387D787F9C9DB][8387D7877D44C4E7]./back frames[FF83C3FFA3223BF3][83C3FFA3227AF3FF][FF83C3FFC544DCCF][83C3FFC5445ECFFF]./slime frames[FFFFFFC7A3410183]→Pic2[FFFFC7A3A38383C7][FFFFFFC7A3410183][FFFFFFFF81600081]./wall tile, 00[45FF11FF45FF11FF]→Pic1./ground tile, 01[FFFFFFFFFFEFFFFF]./tile map[00000000000000000000000000000000000000000000000000000000000000000000000000]→GDB0[00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000010101010100000000000000000000000000000101010101000000000000][00000000000000010101010100000000000000000000000000000101010101000000000000][00000000000000010101010100000000000000000000000000000101010101000000000000][00000000000000010101010100000000000000000000000000000101010101000000000000][00000000000000010101010101010101010101010101010101010101010101000000000000][00000000000000000000000000000000000101010101010100000101010101000000000000][00000000000000000000000000000000000101010101010100000101010101000000000000][00000000000000000000000000000000000101010101010100000101010101000000000000][00000000000000000000000000000101010101010101010100000101010101000000000000][00000000000000000000000000000100000101010101010100000000010000000000000000][00000000000000000000000000000100000000000000000000000000010000000000000000][00000000000000000000000000000100000000000000000000000000010000000000000000][00000000000000000000000000000100000000000000000000000000010000000000000000][00000000000000000000000000000100000000000101010101010101010000000000000000][00000000000000000000000000000100000000000101010101010000000000000000000000][00000000000000000000000000000101010101010101010101010000000000000000000000][00000000000000000000000000000000000001000101010101010000000000000000000000][00000000000000000000000000000000000001000101010101010000000000000000000000][00000000000000000000000000000000000001000000000100000000000000000000000000][00000000000000000000000000000000000001000000000100000000000000000000000000][00000000000000000000000000000000000001000000000100000000000000000000000000][00000000000000000000000000000000000001000000000100000000000000000000000000][00000000000000000000000000000000000001000000000000000000000000000000000000][00000000000000010101010101010101000001000000000000000000000000000000000000][00000000000000010101010101010101010101000000000000000000000000000000000000][00000000000000010101010101010101000000000000000000000000000000000000000000][00000000000000010101010101010101000000000000000000000000000000000000000000][00000000000000010101010101010101010101010101010101010101010101000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000][00000000000000000000000000000000000000000000000000000000000000000000000000]0->Q->P→V->H→I→J→F→S→L->K->TFix 5AddMob(1,0)AddMob(2,2)AddMob(15,9)AddMob(2,26)ClrDrawRepeat getKey(15) ./192 is the offset from the beginning of GDB0 Q*37+P+192→Z If getKey(3) and (I=0) and (J=0) and ({Z+1+GDB0}=1) If Z+1≠M 1→I 32→S End End If getKey(2) and (I=0) and (J=0) and ({Z-1+GDB0}=1) If Z-1≠M 0-1→I 64→S End End If getKey(1) and (I=0) and (J=0) and ({Z+37+GDB0}=1) If Z+37≠M 1→J 0→S End End If getKey(4) and (I=0) and (J=0) and ({Z-37+GDB0}=1) If Z-37≠M 0-1→J 96→S End End F++ H+I+I→H V+J+J→V If (H-8=0) or (H+8=0) P+I→P 0→H→I End If (V-8=0) or (V+8=0) Q+J→Q 0→V→J End DrawMap() DrawMob() Pt-Off(44,28,Pic0+(F/3^4*8)+S) ...Text(0,0,Z►Dec) For(E,1,L) E*4+L₁-4→G Text(0,E*6,{G+2}ʳ►Dec) End ... DispGraphEndClrDrawFix 4Lbl AddMob ./r1 = x, r2 = y ./creates an array [x,y,y*37+x+192] If L<18 r₂*37+r₁+192→{r₂→{r₁→{L+1→L*4+L₁-4}+1}+1}ʳ EndReturnLbl DrawMob For(E,1,L) E*4+L₁-4→G {E*4+L₁-2}ʳ→M Text(0,0,M►Dec) ./If ((M-192≤Z) and (M+192≥Z)) ./Text(0,E*6,"Drawn") {G}-P*8→r₁ {G+1}-Q*8→r₂ ./Text(0,0,M►Dec) Pt-Off(44+r₁-H,28+r₂-V,Pic2+(F/3^4*8)) ./Else ./Text(0,E*6,"Not Drawn") ./End EndReturnLbl DrawMap Q*37+P→T ClrDraw For(B,0,10) For(A,0,14) A-1*8-4-H→C B-1*8-4-V→D Pt-On(C,D,{B*37+A+T+GDB0}*8+Pic1) End EndReturn
.ARRAYClrHome0→L193→AAddEntry(1156)AddEntry(193)AddEntry(208)AddEntry(447)Repeat getKey(15) CheckArray()EndClrHomeLbl AddEntry r₁→{L+1→L*2+L₁-2}ʳReturnLbl CheckArray For(I,1,L) {I*2+L₁-2}ʳ→B If A=B Output(0,0,"EQUAL") Pause 1800 ClrHome Else Output(0,0,"NOT EQUAL") Pause 1800 ClrHome End EndReturn
.ARRAYClrHome0→L193→AAddEntry(2,26)AddEntry(1,0)AddEntry(15,9)AddEntry(2,2)Repeat getKey(15) CheckArray()EndClrHomeLbl AddEntry r₂*37+[r1]+192→{[r2]->{[r1]->{L+1->L*4+L1-4}+1}+1}ʳReturnLbl CheckArray For(I,1,L) {I*4+L₁-2}ʳ→B If (B-192≤A) and (B+192≥A) Output(0,0,"IN BOUNDS") Pause 1800 ClrHome Else Output(0,0,"OUT OF BOUNDS") Pause 1800 ClrHome End EndReturn
AddMob(1,0)AddMob(2,2)AddMob(15,9)AddMob(2,26)AddMob(7,5)AddMob(8,5)Lbl DrawMob For(E,1,L) E*4+L₁-4→G {E*4+L₁-2}ʳ→M Text(0,0,M►Dec) Text(36,0,L►Dec) If (M-192≤Z) and (M+192≥Z) Text(0,E*6,"Drawn") {G}-P*8→r₁ {G+1}-Q*8→r₂ Pt-Off(44+r₁-H,28+r₂-V,Pic2+(F/3^4*8)) Else Text(0,E*6,"Not Drawn") End EndReturn
If ((M-155≤Z) and (M+155≥Z))
If (M-155≤Z) and (M+155≥Z)
{G+2}ʳ
If getKey(3) and (I=0) and (J=0) and ({Z+1+GDB0}=1) If CheckRight() 1→I 32→S End EndLbl CheckRight For(K,1,L) {K*4+L₁-2}ʳ→N Z+1≠N EndReturn
...Text(0,0,Z►Dec) For(E,1,L) E*4+L₁-4→G Text(0,E*6,{G+2}ʳ►Dec) End ...
If getKey(3) and (I=0) and (J=0) and ({Z+1+GDB0}=1) If CheckRight() 1→I 32→S End End If getKey(2) and (I=0) and (J=0) and ({Z-1+GDB0}=1) If CheckLeft() 0-1→I 64→S End End If getKey(1) and (I=0) and (J=0) and ({Z+37+GDB0}=1) If CheckDown() 1→J 0→S End End If getKey(4) and (I=0) and (J=0) and ({Z-37+GDB0}=1) If CheckUp() 0-1→J 96→S End EndLbl CheckRight For(K,1,L) {K*4+L₁-2}ʳ→N Return!If Z+1≠N EndReturnLbl CheckLeft For(K,1,L) {K*4+L₁-2}ʳ→N Return!If Z-1≠N EndReturnLbl CheckDown For(K,1,L) {K*4+L₁-2}ʳ→N Return!If Z+37≠N EndReturnLbl CheckUp For(K,1,L) {K*4+L₁-2}ʳ→N Return!If Z-37≠N EndReturn
.GL₄+12→→°XMinL₄+14→→°XMaxL₄+16→→°YMinL₄+18→→°YMaxL₄+20→→°RoomsL₄+22→→°RoomStartL₄+24→→°RoomWidthL₄+26→→°RoomHeightL₄+28→→°RoomXL₄+30→→°RoomYL₄+32→→°NewRoomXL₄+34→→°NewRoomYFill(L₁,36,0)0→Rooms→RoomX→RoomY→RoomHeight→RoomWidth→RClrDrawGenFloor()CheckFloor()Main()Lbl Main While 1 DispGraph Input() EndIf getKey(15)ReturnLbl CheckFloor For(R,0,Rooms-1) R+1*4+L₁-4→Z R+1*5-4→Y R+1*4+L₁-4→Z {Z}→XMin {Z+2}→XMax {Z+1}→YMin {Z+3}→YMax DrawText(1,Y,"(") DrawInt(4,Y,{Z}) DrawText(13,Y,",") DrawInt(16,Y,{Z+1}) DrawText(24,Y,")") DrawInt(29,Y,XMin) DrawInt(38,Y,XMax) DrawInt(47,Y,YMin) DrawInt(56,Y,YMax) EndReturnLbl GenFloor While Rooms<9 GenRoom() PlaceRoom() 0→R EndReturnLbl GenRoom !If Rooms GetRoomStart() While 1 GetRoomSide()→RoomWidth End!If ChkRoomWidth() While 1 GetRoomSide()→RoomHeight End!If ChkRoomHeight() Else GetRoomStart() While R<Rooms-1 R+1*4+L₁-4→Z {Z}→XMin {Z+2}→XMax {Z+1}→YMin {Z+3}→YMax If (RoomX≥XMin and RoomX≤XMax) and (RoomY≥YMin and RoomY≤YMax) 0→R GetRoomStart() End !If (RoomX≥XMin and RoomX≤XMax) and (RoomY≥YMin and RoomY≤YMax) R++ End End While 1 GetRoomSide()→RoomWidth End!If ChkRoomWidth() While 1 GetRoomSide()→RoomHeight End!If ChkRoomHeight() EndReturnLbl PlaceRoom If Rooms<9 RoomY+RoomHeight-1→{RoomX+RoomWidth-1→{RoomY→{RoomX→{Rooms+1→Rooms*4+L₁-4}+1}+1}+1} EndReturnLbl GetRoomStart 6+(rand^33)→RoomX 4+(rand^37)→RoomYReturnLbl GetRoomSide 4+(rand^9)ReturnLbl ChkRoomWidth (RoomX+RoomWidth-1>41)ReturnLbl ChkRoomHeight (RoomY+RoomHeight-1>43)ReturnLbl DrawText For(I,0,length(r₃)-1) Copy({r₃+I}-32*4+°CharSprites,L₄+50,4) Fill(L₄+54,4,0) DrawChar() EndReturnLbl DrawInt r₃/10+16→{L₅} r₃^10+16→{L₅+1} For(I,0,1) Copy({L₅+I}*4+°CharSprites,L₄+50,4) Fill(L₄+54,4,0) DrawChar() EndReturnLbl DrawChar Pt-On(r₁+(I*((I>0)*4)),r₂,L₄+50)ReturnLbl Input If getKey(9) ClrDraw 0→Rooms GenFloor() CheckFloor() EndReturn[]→°CharSprites[0000000080800080][A0A00000A0E0E0A0][60C060C0A060C0A0][40A060E040400000][4080804040202040][A040A0000040E040][000040800000E000][0000008000204080][E0A0A0E0C04040E0][E020C0E0E06020E0][A0A0E020E08060E0][E080E0E0E0204040][E0A0E0E0E0A0E020][4000400040004080][0020402000E000E0][00804080E0200040][40A0E04060A0E0A0][C0E0A0E0E08080E0][C0A0A0E0E0C080E0][E0C08080E080A0C0][A0E0A0A0E04040E0][6020A040A0C0A0A0][808080E0E0E0A0A0][C0A0A0A0C0A0A060][C0A0E080E0A0E040][C0A0C0A0E08020E0][E0404040A0A0A060][A0A0A040A0A0E0E0][A040A0A0A0A04040][E02080E000000000]
If (RoomX≥XMin and RoomX≤XMax) and (RoomY≥YMin and RoomY≤YMax) 0→R GetRoomStart() End !If (RoomX≥XMin and RoomX≤XMax) and (RoomY≥YMin and RoomY≤YMax) R++ End
If (RoomX≥XMin) and (RoomX≤XMax) and (RoomY≥YMin) and (RoomY≤YMax) 0→R GetRoomStart() Else R++ End
If (RoomX≥XMin and RoomX≤XMax) and (RoomY≥YMin and RoomY≤YMax)
If RoomX≥XMin ? (RoomX≤XMax) ? (RoomY≥YMin) ? (RoomY≤YMax) .I omitted the first pair of parenthesis because of order of operations. You can add it in if you want, it will be compiled out
L₄+12→→°XMinL₄+14→→°XMaxL₄+16→→°YMinL₄+18→→°YMaxL₄+20→→°Rooms
L₄+12→°XMin+2→°XMax+2→°YMin+2→°YMax+2→°Rooms
Lbl Intersect...Since each rectangle is made of 4 points and we only have 6 parameters max, I will use A, B, C, D for the second rectangle. Change them to whatever you want r1, r2, r3, r4 = the first rectangleA, B, C, D = the second rectanglereturns 1 if the 2 intersect anywhere...max(r1, A) < min(r1 + r3, A + C) ? (max(r2, B) < min(r2 + r4, B + D))Return
Data(31,31,3,31,31,3,1,1)->°RegionCheckLbl ConnectRooms For(I,0,7) If {°RegionArray+I} {°RegionCheck+I}^10->AdjacentRoom If {°RegionArray+I+AdjacentRoom} GetAdjRoom() °RoomArray+(I*4)->Room ConnectTo(AdjacentRoom) End If {°RegionCheck+I}/10->AdjacentRoom GetAdjRoom() °RoomArray+(I*4)->Room ConnectTo(AdjacentRoom) End End EndReturnLbl GetAdjRoom °RoomArray+(I+AdjacentRoom*4)->Room {°RoomX+Room}->AdjacentRoomX {°RoomY+Room}->AdjacentRoomY {°RoomWidth+Room}->AdjRoomWidth {°RoomHeight+Room}->AdjRoomHeightReturnLbl ConnectTo .../Args ConnectTo(AdjacentRoom) ... If [r1]=°Below {°RoomX+Room}+1+(Rand()^({°RoomWidth+Room}-2))->PathFromX AdjacentRoomX+1+(Rand()^(AdjRoomWidth-2))->PathToX If PathFromX=PathToX Connect(PathFromX,{°RoomY+Room}+{°RoomHeight+Room},PathToX,AdjacentRoomY-1) Else If AdjacentRoomY-1-{°RoomY+Room}+{°RoomHeight+Room}>4 {°RoomY+Room}+{°RoomHeight+Room}+1+(Rand()^(AdjacentRoomY-({°RoomY+Room}+{°RoomHeight+Room}-1)))->CorridorY Connect(min(PathFromX,PathToX),CorridorY,max(PathToX,PathFromX),CorridorY) Connect(PathFromX,{°RoomY+Room}+{°RoomHeight+Room},PathFromX,CorridorY) Connect(PathToX,CorridorY,PathToX,AdjacentRoomY-1) Else Rand()^1->P If P Connect(PathFromX,{°RoomY+Room}+{°RoomHeight+Room},PathFromX,AdjacentRoomY-1) Else Connect(PathToX,{°RoomY+Room}+{°RoomHeight+Room},PathToX,AdjacentRoomY-1) End End End End If [r1]=°Right {°RoomY+Room}+1+(Rand()^({°RoomHeight+Room}-2))->PathFromY AdjacentRoomY+1+(Rand()^(AdjRoomHeight-2))->PathToY If PathFromY=PathToY Connect({°RoomX+Room}+{°RoomWidth+Room},PathFromY,AdjacentRoomX-1,PathToY) Else If AdjacentRoomX-1-{°RoomX+Room}+{°RoomWidth+Room}>4 {°RoomX+Room}+{°RoomWidth+Room}+1+(Rand()^(AdjacentRoomX-({°RoomX+Room}+{°RoomWidth+Room}-1)))->CorridorX Connect(CorridorX,min(PathFromY,PathToY),CorridorX,max(PathToY,PathFromY)) Connect({°RoomX+Room}+{°RoomWidth+Room},PathFromY,CorridorX,PathFromY) Connect(CorridorX,PathToY,AdjacentRoomX-1,PathToY) Else Rand()^1->P If P Connect({°RoomX+Room}+{°RoomWidth+Room},PathFromY,AdjacentRoomX-1,PathFromY) Else Connect({°RoomX+Room}+{°RoomWidth+Room},PathToY,AdjacentRoomX-1,PathToY) End End End EndReturnLbl Connect .../Args Connect(X1,Y1,X2,Y2) ... If [r1]=[r3] For(J,0,[r4]-[r2]) 0->{[r2]*°FloorWidth+[r1]+Floor+(J*48)} End End If [r2]=[r4] Fill([r2]*°FloorWidth+[r1]+Floor,[r3]-[r1]+1,0) EndReturn
For(I,0,7)
For(I,0,1)
:If [r1]=°Below:...:Stuff:...:End:If [r1]=°Right:...:Other stuff:...:End
For(I,0,7) If ({°RegionArray+I}=1) If I^3<2 {°RoomArray+I}->Room {°RoomY+Room}+1+(rand^({°RoomY+Room}+{°RoomHeight+Room}-{°RoomY+Room}+1))->{°CorridorArray+I} End End End
If ({°RegionArray+I}=1)