0 Members and 2 Guests are viewing this topic.
:ClrHome //:Disp "1=CONVERT","2=DISPLAY","3=MAPEDIT","0=QUIT //menu:Input "□",A //:A:If Ans=3:Then //if map edit:DelVar K:ClrDraw:Disp "1=NEW","0=KEEP //map menu:Input "□",S //:If S:Then //if new map:{16,22→dim([A] //reset map:Fill 5,[A] //fill it with the default background tile:End:For(A,0,33) //start loading map:Pxl-On(A,45 //draw map outline:Pxl-On(A,0 //:End //:For(B,0,44) //draw map outline:Pxl-On(33,B //:Pxl-On(0,B //:End //:For(A,‾1,1) //:Pxl-On(38+A,0 //draw loading bar left edge:End //:For(A,‾1,1) //:Pxl-On(38+A,17 //draw loading bar right edge:End //:For(B,1,17) //:Pxl-On(39,B //draw loading bar:Pxl-On(37,B //:End //:For(A,1,16) //start loading map:Pxl-On(38,A //:For(B,1,22) //:[A](A,B→S //:If 3=S //display default hard tile:Then //:Pxl-On(A+40,B //display on minimap:For(θ,0,1) //:For(Z,0,1) //:Pxl-On(2A-Z,2B-θ //display on building map:End:End //:Else //:If 6=S //display spike tile:Then //:Pxl-On(2A,2B //display on building map:Else //:If 10=S //display ladder tile:Then //display on building map:Pxl-On(A2,B2 //:Pxl-On(A2,B2-1 //:Else //:If 11=S:Then //display water tile:Pxl-On(A2-1,B2 //display on building map:Pxl-On(A2,2B-1 //:End:End:End:End:End:End //:For(B,0,17) //:For(A,‾1,1) //clear loading bar:Pxl-Off(38+A,B //:End:End //end loading map:1→A:1→B:While K≠105 //loop until user presses enter:DelVar K //clear keyvalue:Repeat K //loop until keyvalue:For(Z,0,1) //:For(θ,0,1) //change the current tile to negative:Pxl-Change(2A-θ,2B-Z //:End:End //:getKey→K //getkey to keyvalue:For(θ,0,1) //:For(Z,0,1) //change current tile back:Pxl-Change(2A-θ,2B-Z //:End:End //:End:A-(K=25 and A≠1)+(K=34 and A≠16→A //change Y of current tile:B-(K=24 and B≠1)+(K=26 and B≠22→B //change X of current tile:If K=31:Then //if keyvalue is Alpha:Pxl-On(A2,B2 //change pixels to spike tile:Pxl-Off(A2-1,B2-1 //:Pxl-Off(A2,2B-1 //:Pxl-Off(A2-1,B2 //change matrix value to spike tile:6→[A](A,B:Else:If K=22:Then //if keyvalue is mode:Pxl-On(2A,2B-1 //change pixels to ladder tile:Pxl-On(A2,B2 //:Pxl-Off(2A-1,2B-1 //:Pxl-Off(2A-1,2B //:10→[A](A,B //change matrix value to ladder tile:Else:If K=32:Then //if keyvalue is X,T,theta,n:Pxl-On(2A-1,B2 //change pixels to water tile:Pxl-On(A2,2B-1 //:Pxl-Off(A2,B2 //:Pxl-Off(A2-1,B2-1 //:11→[A](A,B //change matrix to water tile:Else:If K=21:Then //if keyvalue is 2nd:[A](A,B→S //get matrix value:If S≠3 and S≠4 and S≠9:Then //if matrix value is not a solid tile:Pxl-On(A+40,B //turn on pixel on minimap:Else:Pxl-Off(A+40,B //else turn it off:End:For(θ,0,1) //:For(Z,0,1) //:If S=5:Then //display tile on buildermap:Pxl-On(2A-θ,2B-Z //:Else //:Pxl-Off(2A-θ,2B-Z //:End:End:End //:If S≠5:Then //if not solid:5→T //make solid:Else:3→T //otherwise make it the default solid:End:T→[A](A,B //insert value to matrix:End:End:End:End:End:Else:ClrDraw //this is the converter portion of the program:If Ans=1:Then:"0000000000000000000000000000000000000000000000→Str1 //this is the initial setup of the String:For(A,1,16):For(B,1,22):1+[A](A,B→S //grabs teh tile value+1 from the matrix:Str1+"0"+sub("0123456789ABCDEF",S,1→Str1 //inserts a "0" and the right value into the string:If S=3 or S=4 or S=9 //if tile is solid:Pxl-On(A-1,B-1 //turn on the pixel for the minimap:End:End:det(17,Str1→Str1 //convert string to bin:Else:If Ans=2:Then //this is the display minimap:For(A,1,16) //it requires a hex string (0h not 00h format):For(B,1,22):If inString("349",sub(Str1,22A-22+B,1 //if solid tile:Pxl-On(A-1,B-1 //turn on minimap:End:End:End:ClrHome
hmm? how so?
Some For( like this one::For(A,1,16) //it requires a hex string (0h not 00h format):For(B,1,22):If inString("349",sub(Str1,22A-22+B,1 //if solid tile:Pxl-On(A-1,B-1 //turn on minimap:End:EndSee if changes in step and values can optimize things. Sort of this: (not tested and was rushed):For(A,22,352,22) //nah this one actually increases size.:For(B,-21,0):If inString("349",sub(Str1,A+B,1 //if solid tile:Pxl-On(A/22-1,B+21 //this seems to kill the optimization in above lines even if A/22 is always integer:End:End
:DelVar K //clear keyvalueAre you sure this line is needed?
:DelVar K //clear keyvalue:Repeat K //loop until keyvalue:For(Z,0,1) //:For(θ,0,1) //change the current tile to negative:Pxl-Change(2A-θ,2B-Z //:End:End //:getKey→K //getkey to keyvalue:For(θ,0,1) //:For(Z,0,1) //change current tile back:Pxl-Change(2A-θ,2B-Z //:End:End //:End
:For(θ,0,1) //:For(Z,0,1) //:If S=5:Then //display tile on buildermap:Pxl-On(2A-θ,2B-Z //:Else //:Pxl-Off(2A-θ,2B-Z //:End:EndThere you can use Line( ?Like this:Line(2B,2A-1,2B-1,2A,S=5 // don't forget pixels change in arguments (row and column to x and y)the last argument if is 1 (true) then it is a black line, otherwise (false) a white line.
:For(B,0,44) //draw map outline:Pxl-On(33,B //:Pxl-On(0,B //:EndI think this is not a loading bar. So you could optimize by speed and see if size into Line( ?