0 Members and 1 Guest are viewing this topic.
mainprogram()begin makemat(prg(I,J),25,25);end;prg(x,y)begin // code that loops x from 1 to 25 and y from 1 to 25 goes here return(0);end;
mainprogram()begin makemat( // code that loops x from 1 to 25 and y from 1 to 25 goes here return(0); ,25,25);end;
Actually, couldn't you just doCode: [Select]mainprogram()begin makemat( // code that loops x from 1 to 25 and y from 1 to 25 goes here return(0); ,25,25);end;if the code was short enough?
FILLCIRCLE_P(cx, cy, r, color);EXPORT circles()BEGINDIMGROB_P(G1,320,240);DIMGROB_P(G2,320,240);DIMGROB_P(G3,320,240);BLIT_P(G1,G0);FOR A FROM 220 DOWNTO 0 DO RECT_P(G2,#000000); FILLCIRCLE_P(160, 120, A, #FF00FF);BLIT_P(G3,G1);BLIT_P(G3,0,0,320,240,G2,0,0,320,240,#FF00FF);BLIT_P(G3);END;END;EXPORT FILLCIRCLE_P(cx, cy, r, color)BEGIN LOCAL s, cl := {}, angle := HAngle; HAngle := 1; LOCAL cl := MAKELIST({EVAL(r * COS(S) + cx), EVAL(r * SIN(S) + cy)}, S, 0, 359, 10); HAngle := angle; FILLPOLY_P(G2,cl, #FF00FF,255);END;
Necrobump:Thanks to this routine, we can actually do circle-based fade-in/out animations, like in Zelda, in addition to stuff like dark cavern/dungeon effects! The edited code by MacBernick looks like this:Code: [Select]FILLCIRCLE_P(cx, cy, r, color);EXPORT circles()BEGINDIMGROB_P(G1,320,240);DIMGROB_P(G2,320,240);DIMGROB_P(G3,320,240);BLIT_P(G1,G0);FOR A FROM 220 DOWNTO 0 DO RECT_P(G2,#000000); FILLCIRCLE_P(160, 120, A, #FF00FF);BLIT_P(G3,G1);BLIT_P(G3,0,0,320,240,G2,0,0,320,240,#FF00FF);BLIT_P(G3);END;END;EXPORT FILLCIRCLE_P(cx, cy, r, color)BEGIN LOCAL s, cl := {}, angle := HAngle; HAngle := 1; LOCAL cl := MAKELIST({EVAL(r * COS(S) + cx), EVAL(r * SIN(S) + cy)}, S, 0, 359, 10); HAngle := angle; FILLPOLY_P(G2,cl, #FF00FF,255);END;You need multiple GROBs or at least a GROB large enough for each frame, because it involves transparency.