SB_Fileset> Start>XBG620.sb< ' The following line could be harmful and has been automatically commented. ' ff=File.GetFiles("E:\clls") cr=Text.GetCharacter(13) ds=Text.GetCharacter(10) tb=Text.GetCharacter(9) nln=cr+ds GraphicsWindow.BackgroundColor="tan bb=LDShapes.BrushGradient("1=brown;2=black" "DD") qa=LDFastArray.Add() For fx=1 To Array.GetItemCount(ff) GraphicsWindow.BrushColor="brown GraphicsWindow.FontBold="false ' The following line could be harmful and has been automatically commented. ' cc=File.ReadContents(ff[fx]) aa=LDText.Split(cc nln) GraphicsWindow.FontName="noto mono GraphicsWindow.FontSize=18 For qx=1 To 100 For qy=1 To 50 LDFastArray.Set2D( qa qx qy 0) EndFor EndFor For y=1 To Array.GetItemCount(aa) If Text.StartsWith(aa[y] "!") Then GraphicsWindow.DrawText(10 y*20 text.GetSubTextToEnd( aa[y] 2)) hh="true Else tt=aa[y] tt=LDText.Replace(tt "." " ") zz=Text.GetLength(tt) If zz>100 Then zz=100 EndIf For z=1 To zz If Text.GetSubText(tt z 1)=" " Then ElseIf y<50 Then LDFastArray.Set2D( qa z y 1) 'qa[z][y]=1 'LDShapes.BrushRoundedRectangle(bb z*10 140+y*10 10 10 3) EndIf EndFor EndIf EndFor'------------------- GraphicsWindow.BrushColor="black aa1=LDFastArray.ToArray(qa) 'TextWindow.WriteLine(aa) For y=2 To 49 For x=2 To 99 If aa1[x][y]=0 Then Else LDShapes.BrushRoundedRectangle(bb x*10 140+y*10 10 10 3) ' Goto ttt If LDFastArray.Get2D (qa x-1 y-1)=1 or LDFastArray.Get2D (qa x-1 y)=1 or LDFastArray.Get2D (qa x y-1)=1 Then GraphicsWindow.FillRectangle(x*10 140+y*10 4 4) EndIf If LDFastArray.Get2D (qa x-1 y+1)=1 or LDFastArray.Get2D (qa x-1 y)=1 or LDFastArray.Get2D (qa x y+1)=1 Then GraphicsWindow.FillRectangle(x*10 140+y*10+6 4 4) EndIf If LDFastArray.Get2D (qa x+1 y-1)=1 or LDFastArray.Get2D (qa x+1 y)=1 or LDFastArray.Get2D (qa x y-1)=1 Then GraphicsWindow.FillRectangle(x*10+6 140+y*10 4 4) EndIf If LDFastArray.Get2D (qa x+1 y+1)=1 or LDFastArray.Get2D (qa x+1 y)=1 or LDFastArray.Get2D (qa x y+1)=1 Then GraphicsWindow.FillRectangle(x*10+6 140+y*10+6 4 4) EndIf EndIf EndFor EndFor Program.Delay(4444) GraphicsWindow.Clear() EndFor End>XBG620.sb< Start>XBJ496.sb< GraphicsWindow.BackgroundColor="green ff=1.5 eng="false"'"True for leftside drive GraphicsWindow.BrushColor="gray GraphicsWindow.FillRectangle(200+60*ff 0 80*ff 800) GraphicsWindow.FillRectangle(0 200+30*ff 800 40*ff) GraphicsWindow.Title="Roundabout Demo GraphicsWindow.BrushColor="lightgray GraphicsWindow.FillRectangle(255+60*ff 0 10 800) GraphicsWindow.BrushColor="gray GraphicsWindow.FillTriangle(198+140*ff 280+30*ff, 200+170*ff 280+30*ff, 198+140*ff 370+70*ff) GraphicsWindow.FillTriangle(88+140*ff 280+30*ff, -10+170*ff 280+30*ff, 88+140*ff 370+70*ff) GraphicsWindow.FillTriangle(198+140*ff 240+30*ff, 200+170*ff 240+30*ff, 200+140*ff 70+70*ff) GraphicsWindow.FillTriangle(88+140*ff 240+30*ff, -50+170*ff 240+30*ff, 88+140*ff 30+70*ff) GraphicsWindow.BrushColor="green GraphicsWindow.FillTriangle(200+60*ff 280+30*ff 200+140*ff 280+30*ff 200+100*ff 450+30*ff) GraphicsWindow.FillTriangle(200+60*ff 240+30*ff 200+140*ff 240+30*ff 200+100*ff 100) GraphicsWindow.BrushColor="gray GraphicsWindow.FillEllipse(200 200 200*ff 100*ff) GraphicsWindow.BrushColor="brown GraphicsWindow.Height=800 GraphicsWindow.Width=700 GraphicsWindow.Left=5 GraphicsWindow.Top=5 GraphicsWindow.FillEllipse(200+60*ff 200+30*ff 80*ff 40*ff) GraphicsWindow.BrushColor="orange GraphicsWindow.FillRectangle(252+60*ff 395+30*ff 15 60) GraphicsWindow.BrushColor="blue GraphicsWindow.FillEllipse(183+100*ff 380+30*ff 35 35) GraphicsWindow.BrushColor="white GraphicsWindow.FontSize=30 GraphicsWindow.FontBold="true tt=Shapes.AddText("→") ww=1 if eng Then ww=3 EndIf Shapes.Rotate(tt 45*ww) Shapes.Move(tt 190+100*ff 376+30*ff ) pp[1]="378.4:778.4;375.2:733.6;372:692;368:637.6;368.8:568;375.2:492.8;396:438.4;417.6:371.2;426.4:353.6;430.4:338.4;443.2:316;453.6:308;464.8:287.2;462.4:270.4;452:252.8;437.6:245.6;410.4:237.6;379.2:232.8;351.2:230.4;318.4:232.8;289.6:248;268.8:263.2;240.8:268;200:270.4;143.2:272.8;78.4:273.6;6.4:270.4 pp[2]="8.8:270.4;51.2:270.4;100.8:268;155.2:268.8;210.4:273.6;239.2:290.4;265.6:310.4;314.4:320;356.8:320;398.4:320;436.8:298.4;448.8:262.4;419.2:236.8;381.6:215.2;377.6:164;381.6:97.6;383.2:38.4;382.4:8; pp[3]="316:4.8;316.8:34.4;319.2:68;318.4:116;312:164.8;307.2:202.4;283.2:226.4;256:252.8;250.4:277.6;270.4:297.6;303.2:316;343.2:325.6;380.8:322.4;418.4:306.4;447.2:280.8;484:272;524:269.6;587.2:265.6;648:265.6;692:264; pp[4]="690.4:272.8;637.6:274.4;565.6:276.8;511.2:276.8;469.6:268;429.6:236;386.4:225.6;334.4:224;292.8:232;256:252.8;244.8:291.2;261.6:325.6;280.8:356;287.2:396;304.8:436.8;305.6:491.2;306.4:573.6;313.6:643.2;308.8:692;312.8:752;312:788; GraphicsWindow.PenWidth=0 GraphicsWindow.BrushColor="lime ee=Shapes.AddEllipse(18 18) LDEffect.DropShadow(ee "") not="true=false;false=true While 1=1 nn=Math.GetRandomNumber(4) pt=LDText.Split(pp[nn] ";") LDShapes.BrushColour(ee LDColours.HSLtoRGB(Math.GetRandomNumber(330) 1 .7)) s1=1 s2=Array.GetItemCount(pt) s3=1 if eng Then s3=-1 s1=s2 s2=1 EndIf For f=s1 To s2 step s3 qq=LDText.Split(pt[f] ":") If f=1 Then Shapes.Move(ee qq[1] qq[2]) Else Shapes.Animate(ee qq[1]-10 qq[2]-15 50) EndIf Program.Delay(55) EndFor if nn=1 and not[eng] then Shapes.Animate(ee, -15 Shapes.GetTop(ee) 50) EndIf Program.Delay(222) EndWhile GraphicsWindow.MouseDown=mmm Sub mmm If Mouse.IsRightButtonDown Then TextWindow.WriteLine(dd) Else dd=dd+GraphicsWindow.MouseX+":"+GraphicsWindow.MouseY+";" GraphicsWindow.BrushColor="red GraphicsWindow.fillEllipse(GraphicsWindow.MouseX GraphicsWindow.MouseY 6 6) EndIf EndSub End>XBJ496.sb< Start>XBN618.sb< 'Solution to Euler Problems 18 and 67; http://projecteuler.net 'Find the largest sum of nodes traveing from the root to the leaves (tip to base) 'author: Matthew L. Parets 'Project 18 - Triangle height of 15 tri = "75 95 64 17 47 82 18 35 87 10 20 04 82 47 65 19 01 23 75 03 34 88 02 77 73 07 63 67 99 65 04 28 06 16 70 92 41 41 26 56 83 40 80 70 33 41 48 72 33 47 32 37 16 94 29 53 71 44 65 25 43 91 52 97 51 14 70 11 33 28 77 73 17 78 39 68 17 57 91 71 52 38 17 14 91 43 58 50 27 29 48 63 66 04 68 89 53 67 30 73 16 69 87 40 31 04 62 98 27 23 09 70 98 73 93 38 53 60 04 23" 'project 67 - Trangle height of 100 'tri = "59 73 41 52 40 09 26 53 06 34 10 51 87 86 81 61 95 66 57 25 68 90 81 80 38 92 67 73 30 28 51 76 81 18 75 44 84 14 95 87 62 81 17 78 58 21 46 71 58 02 79 62 39 31 09 56 34 35 53 78 31 81 18 90 93 15 78 53 04 21 84 93 32 13 97 11 37 51 45 03 81 79 05 18 78 86 13 30 63 99 95 39 87 96 28 03 38 42 17 82 87 58 07 22 57 06 17 51 17 07 93 09 07 75 97 95 78 87 08 53 67 66 59 60 88 99 94 65 55 77 55 34 27 53 78 28 76 40 41 04 87 16 09 42 75 69 23 97 30 60 10 79 87 12 10 44 26 21 36 32 84 98 60 13 12 36 16 63 31 91 35 70 39 06 05 55 27 38 48 28 22 34 35 62 62 15 14 94 89 86 66 56 68 84 96 21 34 34 34 81 62 40 65 54 62 05 98 03 02 60 38 89 46 37 99 54 34 53 36 14 70 26 02 90 45 13 31 61 83 73 47 36 10 63 96 60 49 41 05 37 42 14 58 84 93 96 17 09 43 05 43 06 59 66 57 87 57 61 28 37 51 84 73 79 15 39 95 88 87 43 39 11 86 77 74 18 54 42 05 79 30 49 99 73 46 37 50 02 45 09 54 52 27 95 27 65 19 45 26 45 71 39 17 78 76 29 52 90 18 99 78 19 35 62 71 19 23 65 93 85 49 33 75 09 02 33 24 47 61 60 55 32 88 57 55 91 54 46 57 07 77 98 52 80 99 24 25 46 78 79 05 92 09 13 55 10 67 26 78 76 82 63 49 51 31 24 68 05 57 07 54 69 21 67 43 17 63 12 24 59 06 08 98 74 66 26 61 60 13 03 09 09 24 30 71 08 88 70 72 70 29 90 11 82 41 34 66 82 67 04 36 60 92 77 91 85 62 49 59 61 30 90 29 94 26 41 89 04 53 22 83 41 09 74 90 48 28 26 37 28 52 77 26 51 32 18 98 79 36 62 13 17 08 19 54 89 29 73 68 42 14 08 16 70 37 37 60 69 70 72 71 09 59 13 60 38 13 57 36 09 30 43 89 30 39 15 02 44 73 05 73 26 63 56 86 12 55 55 85 50 62 99 84 77 28 85 03 21 27 22 19 26 82 69 54 04 13 07 85 14 01 15 70 59 89 95 10 19 04 09 31 92 91 38 92 86 98 75 21 05 64 42 62 84 36 20 73 42 21 23 22 51 51 79 25 45 85 53 03 43 22 75 63 02 49 14 12 89 14 60 78 92 16 44 82 38 30 72 11 46 52 90 27 08 65 78 03 85 41 57 79 39 52 33 48 78 27 56 56 39 13 19 43 86 72 58 95 39 07 04 34 21 98 39 15 39 84 89 69 84 46 37 57 59 35 59 50 26 15 93 42 89 36 27 78 91 24 11 17 41 05 94 07 69 51 96 03 96 47 90 90 45 91 20 50 56 10 32 36 49 04 53 85 92 25 65 52 09 61 30 61 97 66 21 96 92 98 90 06 34 96 60 32 69 68 33 75 84 18 31 71 50 84 63 03 03 19 11 28 42 75 45 45 61 31 61 68 96 34 49 39 05 71 76 59 62 67 06 47 96 99 34 21 32 47 52 07 71 60 42 72 94 56 82 83 84 40 94 87 82 46 01 20 60 14 17 38 26 78 66 81 45 95 18 51 98 81 48 16 53 88 37 52 69 95 72 93 22 34 98 20 54 27 73 61 56 63 60 34 63 93 42 94 83 47 61 27 51 79 79 45 01 44 73 31 70 83 42 88 25 53 51 30 15 65 94 80 44 61 84 12 77 02 62 02 65 94 42 14 94 32 73 09 67 68 29 74 98 10 19 85 48 38 31 85 67 53 93 93 77 47 67 39 72 94 53 18 43 77 40 78 32 29 59 24 06 02 83 50 60 66 32 01 44 30 16 51 15 81 98 15 10 62 86 79 50 62 45 60 70 38 31 85 65 61 64 06 69 84 14 22 56 43 09 48 66 69 83 91 60 40 36 61 92 48 22 99 15 95 64 43 01 16 94 02 99 19 17 69 11 58 97 56 89 31 77 45 67 96 12 73 08 20 36 47 81 44 50 64 68 85 40 81 85 52 09 91 35 92 45 32 84 62 15 19 64 21 66 06 01 52 80 62 59 12 25 88 28 91 50 40 16 22 99 92 79 87 51 21 77 74 77 07 42 38 42 74 83 02 05 46 19 77 66 24 18 05 32 02 84 31 99 92 58 96 72 91 36 62 99 55 29 53 42 12 37 26 58 89 50 66 19 82 75 12 48 24 87 91 85 02 07 03 76 86 99 98 84 93 07 17 33 61 92 20 66 60 24 66 40 30 67 05 37 29 24 96 03 27 70 62 13 04 45 47 59 88 43 20 66 15 46 92 30 04 71 66 78 70 53 99 67 60 38 06 88 04 17 72 10 99 71 07 42 25 54 05 26 64 91 50 45 71 06 30 67 48 69 82 08 56 80 67 18 46 66 63 01 20 08 80 47 07 91 16 03 79 87 18 54 78 49 80 48 77 40 68 23 60 88 58 80 33 57 11 69 55 53 64 02 94 49 60 92 16 35 81 21 82 96 25 24 96 18 02 05 49 03 50 77 06 32 84 27 18 38 68 01 50 04 03 21 42 94 53 24 89 05 92 26 52 36 68 11 85 01 04 42 02 45 15 06 50 04 53 73 25 74 81 88 98 21 67 84 79 97 99 20 95 04 40 46 02 58 87 94 10 02 78 88 52 21 03 88 60 06 53 49 71 20 91 12 65 07 49 21 22 11 41 58 99 36 16 09 48 17 24 52 36 23 15 72 16 84 56 02 99 43 76 81 71 29 39 49 17 64 39 59 84 86 16 17 66 03 09 43 06 64 18 63 29 68 06 23 07 87 14 26 35 17 12 98 41 53 64 78 18 98 27 28 84 80 67 75 62 10 11 76 90 54 10 05 54 41 39 66 43 83 18 37 32 31 52 29 95 47 08 76 35 11 04 53 35 43 34 10 52 57 12 36 20 39 40 55 78 44 07 31 38 26 08 15 56 88 86 01 52 62 10 24 32 05 60 65 53 28 57 99 03 50 03 52 07 73 49 92 66 80 01 46 08 67 25 36 73 93 07 42 25 53 13 96 76 83 87 90 54 89 78 22 78 91 73 51 69 09 79 94 83 53 09 40 69 62 10 79 49 47 03 81 30 71 54 73 33 51 76 59 54 79 37 56 45 84 17 62 21 98 69 41 95 65 24 39 37 62 03 24 48 54 64 46 82 71 78 33 67 09 16 96 68 52 74 79 68 32 21 13 78 96 60 09 69 20 36 73 26 21 44 46 38 17 83 65 98 07 23 52 46 61 97 33 13 60 31 70 15 36 77 31 58 56 93 75 68 21 36 69 53 90 75 25 82 39 50 65 94 29 30 11 33 11 13 96 02 56 47 07 49 02 76 46 73 30 10 20 60 70 14 56 34 26 37 39 48 24 55 76 84 91 39 86 95 61 50 14 53 93 64 67 37 31 10 84 42 70 48 20 10 72 60 61 84 79 69 65 99 73 89 25 85 48 92 56 97 16 03 14 80 27 22 30 44 27 67 75 79 32 51 54 81 29 65 14 19 04 13 82 04 91 43 40 12 52 29 99 07 76 60 25 01 07 61 71 37 92 40 47 99 66 57 01 43 44 22 40 53 53 09 69 26 81 07 49 80 56 90 93 87 47 13 75 28 87 23 72 79 32 18 27 20 28 10 37 59 21 18 70 04 79 96 03 31 45 71 81 06 14 18 17 05 31 50 92 79 23 47 09 39 47 91 43 54 69 47 42 95 62 46 32 85 37 18 62 85 87 28 64 05 77 51 47 26 30 65 05 70 65 75 59 80 42 52 25 20 44 10 92 17 71 95 52 14 77 13 24 55 11 65 26 91 01 30 63 15 49 48 41 17 67 47 03 68 20 90 98 32 04 40 68 90 51 58 60 06 55 23 68 05 19 76 94 82 36 96 43 38 90 87 28 33 83 05 17 70 83 96 93 06 04 78 47 80 06 23 84 75 23 87 72 99 14 50 98 92 38 90 64 61 58 76 94 36 66 87 80 51 35 61 38 57 95 64 06 53 36 82 51 40 33 47 14 07 98 78 65 39 58 53 06 50 53 04 69 40 68 36 69 75 78 75 60 03 32 39 24 74 47 26 90 13 40 44 71 90 76 51 24 36 50 25 45 70 80 61 80 61 43 90 64 11 18 29 86 56 68 42 79 10 42 44 30 12 96 18 23 18 52 59 02 99 67 46 60 86 43 38 55 17 44 93 42 21 55 14 47 34 55 16 49 24 23 29 96 51 55 10 46 53 27 92 27 46 63 57 30 65 43 27 21 20 24 83 81 72 93 19 69 52 48 01 13 83 92 69 20 48 69 59 20 62 05 42 28 89 90 99 32 72 84 17 08 87 36 03 60 31 36 36 81 26 97 36 48 54 56 56 27 16 91 08 23 11 87 99 33 47 02 14 44 73 70 99 43 35 33 90 56 61 86 56 12 70 59 63 32 01 15 81 47 71 76 95 32 65 80 54 70 34 51 40 45 33 04 64 55 78 68 88 47 31 47 68 87 03 84 23 44 89 72 35 08 31 76 63 26 90 85 96 67 65 91 19 14 17 86 04 71 32 95 37 13 04 22 64 37 37 28 56 62 86 33 07 37 10 44 52 82 52 06 19 52 57 75 90 26 91 24 06 21 14 67 76 30 46 14 35 89 89 41 03 64 56 97 87 63 22 34 03 79 17 45 11 53 25 56 96 61 23 18 63 31 37 37 47 77 23 26 70 72 76 77 04 28 64 71 69 14 85 96 54 95 48 06 62 99 83 86 77 97 75 71 66 30 19 57 90 33 01 60 61 14 12 90 99 32 77 56 41 18 14 87 49 10 14 90 64 18 50 21 74 14 16 88 05 45 73 82 47 74 44 22 97 41 13 34 31 54 61 56 94 03 24 59 27 98 77 04 09 37 40 12 26 87 09 71 70 07 18 64 57 80 21 12 71 83 94 60 39 73 79 73 19 97 32 64 29 41 07 48 84 85 67 12 74 95 20 24 52 41 67 56 61 29 93 35 72 69 72 23 63 66 01 11 07 30 52 56 95 16 65 26 83 90 50 74 60 18 16 48 43 77 37 11 99 98 30 94 91 26 62 73 45 12 87 73 47 27 01 88 66 99 21 41 95 80 02 53 23 32 61 48 32 43 43 83 14 66 95 91 19 81 80 67 25 88 08 62 32 18 92 14 83 71 37 96 11 83 39 99 05 16 23 27 10 67 02 25 44 11 55 31 46 64 41 56 44 74 26 81 51 31 45 85 87 09 81 95 22 28 76 69 46 48 64 87 67 76 27 89 31 11 74 16 62 03 60 94 42 47 09 34 94 93 72 56 18 90 18 42 17 42 32 14 86 06 53 33 95 99 35 29 15 44 20 49 59 25 54 34 59 84 21 23 54 35 90 78 16 93 13 37 88 54 19 86 67 68 55 66 84 65 42 98 37 87 56 33 28 58 38 28 38 66 27 52 21 81 15 08 22 97 32 85 27 91 53 40 28 13 34 91 25 01 63 50 37 22 49 71 58 32 28 30 18 68 94 23 83 63 62 94 76 80 41 90 22 82 52 29 12 18 56 10 08 35 14 37 57 23 65 67 40 72 39 93 39 70 89 40 34 07 46 94 22 20 05 53 64 56 30 05 56 61 88 27 23 95 11 12 37 69 68 24 66 10 87 70 43 50 75 07 62 41 83 58 95 93 89 79 45 39 02 22 05 22 95 43 62 11 68 29 17 40 26 44 25 71 87 16 70 85 19 25 59 94 90 41 41 80 61 70 55 60 84 33 95 76 42 63 15 09 03 40 38 12 03 32 09 84 56 80 61 55 85 97 16 94 82 94 98 57 84 30 84 48 93 90 71 05 95 90 73 17 30 98 40 64 65 89 07 79 09 19 56 36 42 30 23 69 73 72 07 05 27 61 24 31 43 48 71 84 21 28 26 65 65 59 65 74 77 20 10 81 61 84 95 08 52 23 70 47 81 28 09 98 51 67 64 35 51 59 36 92 82 77 65 80 24 72 53 22 07 27 10 21 28 30 22 48 82 80 48 56 20 14 43 18 25 50 95 90 31 77 08 09 48 44 80 90 22 93 45 82 17 13 96 25 26 08 73 34 99 06 49 24 06 83 51 40 14 15 10 25 01 54 25 10 81 30 64 24 74 75 80 36 75 82 60 22 69 72 91 45 67 03 62 79 54 89 74 44 83 64 96 66 73 44 30 74 50 37 05 09 97 70 01 60 46 37 91 39 75 75 18 58 52 72 78 51 81 86 52 08 97 01 46 43 66 98 62 81 18 70 93 73 08 32 46 34 96 80 82 07 59 71 92 53 19 20 88 66 03 26 26 10 24 27 50 82 94 73 63 08 51 33 22 45 19 13 58 33 90 15 22 50 36 13 55 06 35 47 82 52 33 61 36 27 28 46 98 14 73 20 73 32 16 26 80 53 47 66 76 38 94 45 02 01 22 52 47 96 64 58 52 39 88 46 23 39 74 63 81 64 20 90 33 33 76 55 58 26 10 46 42 26 74 74 12 83 32 43 09 02 73 55 86 54 85 34 28 23 29 79 91 62 47 41 82 87 99 22 48 90 20 05 96 75 95 04 43 28 81 39 81 01 28 42 78 25 39 77 90 57 58 98 17 36 73 22 63 74 51 29 39 74 94 95 78 64 24 38 86 63 87 93 06 70 92 22 16 80 64 29 52 20 27 23 50 14 13 87 15 72 96 81 22 08 49 72 30 70 24 79 31 16 64 59 21 89 34 96 91 48 76 43 53 88 01 57 80 23 81 90 79 58 01 80 87 17 99 86 90 72 63 32 69 14 28 88 69 37 17 71 95 56 93 71 35 43 45 04 98 92 94 84 96 11 30 31 27 31 60 92 03 48 05 98 91 86 94 35 90 90 08 48 19 33 28 68 37 59 26 65 96 50 68 22 07 09 49 34 31 77 49 43 06 75 17 81 87 61 79 52 26 27 72 29 50 07 98 86 01 17 10 46 64 24 18 56 51 30 25 94 88 85 79 91 40 33 63 84 49 67 98 92 15 26 75 19 82 05 18 78 65 93 61 48 91 43 59 41 70 51 22 15 92 81 67 91 46 98 11 11 65 31 66 10 98 65 83 21 05 56 05 98 73 67 46 74 69 34 08 30 05 52 07 98 32 95 30 94 65 50 24 63 28 81 99 57 19 23 61 36 09 89 71 98 65 17 30 29 89 26 79 74 94 11 44 48 97 54 81 55 39 66 69 45 28 47 13 86 15 76 74 70 84 32 36 33 79 20 78 14 41 47 89 28 81 05 99 66 81 86 38 26 06 25 13 60 54 55 23 53 27 05 89 25 23 11 13 54 59 54 56 34 16 24 53 44 06 13 40 57 72 21 15 60 08 04 19 11 98 34 45 09 97 86 71 03 15 56 19 15 44 97 31 90 04 87 87 76 08 12 30 24 62 84 28 12 85 82 53 99 52 13 94 06 65 97 86 09 50 94 68 69 74 30 67 87 94 63 07 78 27 80 36 69 41 06 92 32 78 37 82 30 05 18 87 99 72 19 99 44 20 55 77 69 91 27 31 28 81 80 27 02 07 97 23 95 98 12 25 75 29 47 71 07 47 78 39 41 59 27 76 13 15 66 61 68 35 69 86 16 53 67 63 99 85 41 56 08 28 33 40 94 76 90 85 31 70 24 65 84 65 99 82 19 25 54 37 21 46 33 02 52 99 51 33 26 04 87 02 08 18 96 54 42 61 45 91 06 64 79 80 82 32 16 83 63 42 49 19 78 65 97 40 42 14 61 49 34 04 18 25 98 59 30 82 72 26 88 54 36 21 75 03 88 99 53 46 51 55 78 22 94 34 40 68 87 84 25 30 76 25 08 92 84 42 61 40 38 09 99 40 23 29 39 46 55 10 90 35 84 56 70 63 23 91 39 52 92 03 71 89 07 09 37 68 66 58 20 44 92 51 56 13 71 79 99 26 37 02 06 16 67 36 52 58 16 79 73 56 60 59 27 44 77 94 82 20 50 98 33 09 87 94 37 40 83 64 83 58 85 17 76 53 02 83 52 22 27 39 20 48 92 45 21 09 42 24 23 12 37 52 28 50 78 79 20 86 62 73 20 59 54 96 80 15 91 90 99 70 10 09 58 90 93 50 81 99 54 38 36 10 30 11 35 84 16 45 82 18 11 97 36 43 96 79 97 65 40 48 23 19 17 31 64 52 65 65 37 32 65 76 99 79 34 65 79 27 55 33 03 01 33 27 61 28 66 08 04 70 49 46 48 83 01 45 19 96 13 81 14 21 31 79 93 85 50 05 92 92 48 84 59 98 31 53 23 27 15 22 79 95 24 76 05 79 16 93 97 89 38 89 42 83 02 88 94 95 82 21 01 97 48 39 31 78 09 65 50 56 97 61 01 07 65 27 21 23 14 15 80 97 44 78 49 35 33 45 81 74 34 05 31 57 09 38 94 07 69 54 69 32 65 68 46 68 78 90 24 28 49 51 45 86 35 41 63 89 76 87 31 86 09 46 14 87 82 22 29 47 16 13 10 70 72 82 95 48 64 58 43 13 75 42 69 21 12 67 13 64 85 58 23 98 09 37 76 05 22 31 12 66 50 29 99 86 72 45 25 10 28 19 06 90 43 29 31 67 79 46 25 74 14 97 35 76 37 65 46 23 82 06 22 30 76 93 66 94 17 96 13 20 72 63 40 78 08 52 09 90 41 70 28 36 14 46 44 85 96 24 52 58 15 87 37 05 98 99 39 13 61 76 38 44 99 83 74 90 22 53 80 56 98 30 51 63 39 44 30 91 91 04 22 27 73 17 35 53 18 35 45 54 56 27 78 48 13 69 36 44 38 71 25 30 56 15 22 73 43 32 69 59 25 93 83 45 11 34 94 44 39 92 12 36 56 88 13 96 16 12 55 54 11 47 19 78 17 17 68 81 77 51 42 55 99 85 66 27 81 79 93 42 65 61 69 74 14 01 18 56 12 01 58 37 91 22 42 66 83 25 19 04 96 41 25 45 18 69 96 88 36 93 10 12 98 32 44 83 83 04 72 91 04 27 73 07 34 37 71 60 59 31 01 54 54 44 96 93 83 36 04 45 30 18 22 20 42 96 65 79 17 41 55 69 94 81 29 80 91 31 85 25 47 26 43 49 02 99 34 67 99 76 16 14 15 93 08 32 99 44 61 77 67 50 43 55 87 55 53 72 17 46 62 25 50 99 73 05 93 48 17 31 70 80 59 09 44 59 45 13 74 66 58 94 87 73 16 14 85 38 74 99 64 23 79 28 71 42 20 37 82 31 23 51 96 39 65 46 71 56 13 29 68 53 86 45 33 51 49 12 91 21 21 76 85 02 17 98 15 46 12 60 21 88 30 92 83 44 59 42 50 27 88 46 86 94 73 45 54 23 24 14 10 94 21 20 34 23 51 04 83 99 75 90 63 60 16 22 33 83 70 11 32 10 50 29 30 83 46 11 05 31 17 86 42 49 01 44 63 28 60 07 78 95 40 44 61 89 59 04 49 51 27 69 71 46 76 44 04 09 34 56 39 15 06 94 91 75 90 65 27 56 23 74 06 23 33 36 69 14 39 05 34 35 57 33 22 76 46 56 10 61 65 98 09 16 69 04 62 65 18 99 76 49 18 72 66 73 83 82 40 76 31 89 91 27 88 17 35 41 35 32 51 32 67 52 68 74 85 80 57 07 11 62 66 47 22 67 65 37 19 97 26 17 16 24 24 17 50 37 64 82 24 36 32 11 68 34 69 31 32 89 79 93 96 68 49 90 14 23 04 04 67 99 81 74 70 74 36 96 68 09 64 39 88 35 54 89 96 58 66 27 88 97 32 14 06 35 78 20 71 06 85 66 57 02 58 91 72 05 29 56 73 48 86 52 09 93 22 57 79 42 12 01 31 68 17 59 63 76 07 77 73 81 14 13 17 20 11 09 01 83 08 85 91 70 84 63 62 77 37 07 47 01 59 95 39 69 39 21 99 09 87 02 97 16 92 36 74 71 90 66 33 73 73 75 52 91 11 12 26 53 05 26 26 48 61 50 90 65 01 87 42 47 74 35 22 73 24 26 56 70 52 05 48 41 31 18 83 27 21 39 80 85 26 08 44 02 71 07 63 22 05 52 19 08 20 17 25 21 11 72 93 33 49 64 23 53 82 03 13 91 65 85 02 40 05 42 31 77 42 05 36 06 54 04 58 07 76 87 83 25 57 66 12 74 33 85 37 74 32 20 69 03 97 91 68 82 44 19 14 89 28 85 85 80 53 34 87 58 98 88 78 48 65 98 40 11 57 10 67 70 81 60 79 74 72 97 59 79 47 30 20 54 80 89 91 14 05 33 36 79 39 60 85 59 39 60 07 57 76 77 92 06 35 15 72 23 41 45 52 95 18 64 79 86 53 56 31 69 11 91 31 84 50 44 82 22 81 41 40 30 42 30 91 48 94 74 76 64 58 74 25 96 57 14 19 03 99 28 83 15 75 99 01 89 85 79 50 03 95 32 67 44 08 07 41 62 64 29 20 14 76 26 55 48 71 69 66 19 72 44 25 14 01 48 74 12 98 07 64 66 84 24 18 16 27 48 20 14 47 69 30 86 48 40 23 16 61 21 51 50 26 47 35 33 91 28 78 64 43 68 04 79 51 08 19 60 52 95 06 68 46 86 35 97 27 58 04 65 30 58 99 12 12 75 91 39 50 31 42 64 70 04 46 07 98 73 98 93 37 89 77 91 64 71 64 65 66 21 78 62 81 74 42 20 83 70 73 95 78 45 92 27 34 53 71 15 30 11 85 31 34 71 13 48 05 14 44 03 19 67 23 73 19 57 06 90 94 72 57 69 81 62 59 68 88 57 55 69 49 13 07 87 97 80 89 05 71 05 05 26 38 40 16 62 45 99 18 38 98 24 21 26 62 74 69 04 85 57 77 35 58 67 91 79 79 57 86 28 66 34 72 51 76 78 36 95 63 90 08 78 47 63 45 31 22 70 52 48 79 94 15 77 61 67 68 23 33 44 81 80 92 93 75 94 88 23 61 39 76 22 03 28 94 32 06 49 65 41 34 18 23 08 47 62 60 03 63 33 13 80 52 31 54 73 43 70 26 16 69 57 87 83 31 03 93 70 81 47 95 77 44 29 68 39 51 56 59 63 07 25 70 07 77 43 53 64 03 94 42 95 39 18 01 66 21 16 97 20 50 90 16 70 10 95 69 29 06 25 61 41 26 15 59 63 35" 'The Array/Map Structure used as a two-dimensional array Array.SetValue("Triangle", "0,0", "null") MaxRow = 15 'Project 18 'MaxRow = 100 'Project 67 start = 0 'Initialize the array/map For ii = 1 To MaxRow For jj = 1 To ii val = Text.GetSubText(tri,(start + (jj - 1)) * 3,2) pos = "" + ii + "," + jj + "" 'x,y position in the array as a string Array.SetValue("Triangle",pos,val) nsPos = "" + ii + "," + jj + ";ns" Array.SetValue("Triangle",nsPos,0) nlPos = "" + ii + "," + jj + ";nl" Array.SetValue("Triangle",nlPos,"null") EndFor start = start + ii EndFor 'Find the largest path in reverse (from the leaves to the root of the tree/triangle For ii = MaxRow To 1 Step - 1 For jj = 1 To ii CheckMax() EndFor TextWindow.WriteLine("") EndFor finSum = Array.GetValue("Triangle",1 + "," + 1 + ";ns") finLst = Array.GetValue("Triangle",1 + "," + 1 + ";nl") TextWindow.WriteLine("Solution:") TextWindow.WriteLine(" Max Value = " + finSum) TextWindow.WriteLine(" Max Path = " + finLst) Sub CheckMax nVal = Array.GetValue("Triangle",ii + "," + jj) If (ii + 1) > MaxRow Then 'If first time through (leaves/bottom) TextWindow.Write(".") 'The value at the leaves is the value of the leaves (list of one) Array.SetValue("Triangle","" + ii + "," + jj + ";ns",nval) Array.SetValue("Triangle","" + ii + "," + jj + ";nl",nval) Else 'Get the pieces; The left and right childern of the current node nSumD1 = Array.GetValue("Triangle",(ii+1) + "," + jj + ";ns") nLstD1 = Array.GetValue("Triangle",(ii+1) + "," + jj + ";nl") nSumD2 = Array.GetValue("Triangle",(ii+1) + "," + (jj+1) + ";ns") nLstD2 = Array.GetValue("Triangle",(ii+1) + "," + (jj+1) + ";nl") 'If the left child node is greater then the right child node If nSumD1 > nSumD2 Then nSum = nVal + nSumD1 nLstD1 = nVal + ", " + nLstD1 'TextWindow.Write("(" + nLstD1 + ")") Array.SetValue("Triangle","" + ii + "," + jj + ";ns",nSum) Array.SetValue("Triangle","" + ii + "," + jj + ";nl",nLstD1) TextWindow.Write("<") Else 'If the right child node is greater then the left child node nSum = nVal + nSumD2 nLstD2 = nVal + ", " + nLstD2 'TextWindow.Write("(" + nLstD2 + ")") Array.SetValue("Triangle","" + ii + "," + jj + ";ns",nSum) Array.SetValue("Triangle","" + ii + "," + jj + ";nl",nLstD2) TextWindow.Write(">") EndIf EndIf EndSub End>XBN618.sb< Start>XBP650.sb< 'Small Basic challenge of the month February 2019 'Make a button that moves randomly within the GraphicsWindow. 'Try to make the movement smooth and pop up a message when the user manages to click the button. 'CONFIG Width = 60 Height = 25 'INIT GRAPHICS WINDOW GraphicsWindow.Width = Desktop.Width * 0.9 GraphicsWindow.Height = Desktop.Height * 0.8 GraphicsWindow.Left = (Desktop.Width - GraphicsWindow.Width) / 2 GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height) / 3 GraphicsWindow.Title = "Click the button" GraphicsWindow.BackgroundColor = "SkyBlue" 'INIT EVENTS Controls.ButtonClicked = buttonClick 'INIT BUTTON getRandom() GraphicsWindow.BrushColor = "Black" button = Controls.AddButton("Click Me",x,y) Controls.SetSize(button,Width,Height) 'MAIN While "True" 'Animates the button within the graphics window getRandom() Shapes.Animate(button,x,y,1100) Program.Delay(1000) EndWhile 'EVENTS Sub buttonClick 'Displays a message if the user clicks the button. GraphicsWindow.ShowMessage("Congratulations, you clicked the button","Winner!") EndSub 'SUBROUTINES Sub getRandom 'Gets random coordinates within the graphics window x = Math.GetRandomNumber(GraphicsWindow.Width - Width) y = Math.GetRandomNumber(GraphicsWindow.Height - Height) EndSub End>XBP650.sb< Start>XBP837.sb< ndtt=108 '----------- number of axedots*2 GraphicsWindow.Width=750 GraphicsWindow.Height =750 GraphicsWindow.Left =10 GraphicsWindow.Top =10 LDUtilities.ShowNoShapeErrors="false LDUtilities.ShowErrors="false GraphicsWindow.BackgroundColor="Darkblue args=0 ccc=ldtext.Split("#00cc00 #00bb00 #00ee00"," ") cc1=ldtext.Split("Gold Yellow Pink"," ") gucktheta=math.GetRadians ( 85) th=85 guckphi=0 pi=Math.pi bw=700 bh=bw dd=25 GraphicsWindow.BrushColor=LDColours.HSLtoRGB (180,.8,.2) GraphicsWindow.FillEllipse( dd,dd,bw,bw) LDEvents.MouseWheel =mww s5=15 ndt2=ndtt/2 GraphicsWindow.Title = "Wait... " For f=0 to 5 for n=1 to ndt2+1 x1[f][n]=LDMath.Sin((n-1)*10)*140 y1[f][n]=n*s5 x1[f][n+ndt2]=LDMath.cos((n-1)*10+90)*140 y1[f][n+ndt2]=n*s5 x1[f][n+ndtt]=0 y1[f][n+ndtt]=n*s5 ir=math.GetRadians (x1[f][n]*10) jr=math.GetRadians ((y1[f][n]-100)/s5-70) r5=3+8*(ndt2-math.Abs(ndt2/2-n))/ndt2 ss[f][n]=shapes.AddEllipse (r5,r5) ss[f][n+ndt2]=shapes.AddEllipse (r5,r5) ss[f][n+ndtt]=shapes.AddEllipse (r5,r5) LDShapes.BrushColour (ss[f][n],ccc[Math.Remainder (n,3)+1]) LDShapes.BrushColour (ss[f][n+ndt2],ccc[Math.Remainder (n,3)+1]) LDShapes.BrushColour (ss[f][n+ndtt],cc1[Math.Remainder (n,3)+1]) LDShapes.PenWidth (ss[f][n],0) LDShapes.PenWidth (ss[f][n+ndt2],0) LDShapes.PenWidth (ss[f][n+ndtt],0) fss[f][n]=LDFastShapes.ShapeIndex (ss[f][n]) fss[f][n+ndtt/2]=LDFastShapes.ShapeIndex (ss[f][n+ndt2]) fss[f][n+ndtt]=LDFastShapes.ShapeIndex (ss[f][n+ndtt]) Endfor GraphicsWindow.Title = "Done "+(f+1)*16.6+"%" endfor GraphicsWindow.Title = "Spin the wheel..." While 1=1 For mm=0 to 360 step 3 For f=0 to 5 For n=1 to ndt2*3 ir=math.GetRadians (mm+x1[f][n]/5+f*60) jr=math.GetRadians((y1[f][n]-100)/5-70.7) LDFastShapes.Move (fss[f][n],ldcall.Function3 ("kx",1,jr,ir), ldcall.Function3 ("ky",1,jr,ir)+1) LDFastShapes.SetOpacity (fss[f][n],20+math.Abs(100-(f*40))*0.8) endfor endfor LDFastShapes.Update () Program.Delay (33) endfor endwhile sub kx'(r,theta,phi) qr=args[1] theta=args[2] phi=args[3] qx=qr*math.cos(theta)*math.cos(phi) qy=qr*math.cos(theta)*math.sin(phi) qz=qr*math.sin(theta) qx=math.sin(guckphi)*qx+math.cos(guckphi)*qy RETURN= bw/2+qx*bw/2+dd ENDsub sub ky'(r,theta,phi) qr=args[1] theta=args[2] phi=args[3] qx=qr*math.cos(theta)*math.cos(phi) qy=qr*math.cos(theta)*math.sin(phi) qz=qr*math.sin(theta) qy=math.cos(guckphi)*qx-math.sin(guckphi)*qy qz=math.cos(gucktheta)*qy-math.sin(gucktheta)*qz RETURN= bh/2-qz*bh/2+dd ENDsub Sub mww th=th+ LDEvents.LastMouseWheelDelta*3 gucktheta=math.GetRadians ( th) EndSub End>XBP837.sb< Start>XBR791-0.sb< 'Define event reaction GraphicsWindow.KeyDown = OnKeyDown ' Start Sub OnKeyDown if pressing a key GraphicsWindow.KeyUp = OnKeyUp ' Start Sub OnKeyUp by locking key Init() ' Initialisation objects and attribute ' Main While T ' Main loop (never ending) If Kd = 1 Then ' If Key down is pressing or was pressed then Ku = 0 ' Clear flag Key is locking ReactionKeyPressing() ' Reaction of Key Pressing EndIf If Ku = 1 Then ' If Key is locking or was locked then Kd = 0 ' Clear flag Key is pressing EndIf If mS2 = 1 Then ' if flag set to move shape 2 Shapes.Move(S2, S2x, S2y) ' move the shape on new position EndIf Collision() ' Check collision and reaction EndWhile Program.End() ' close the window '************************************************************************************************** Sub Collision If S1x + S1w >= S2x And S1x <= S2x + S2w And S1y + s1h >= s2y And S1y <= S2y + S2h Then 'The shapes must be a circle(not ellipse) (shape1) and an unrotated rectangle (shape2) 'Circle centre and radius Rad = S1w/2 CenX = S1x+Rad CenY = S1y+Rad Rad2 = Rad*Rad Intersect = "False" 'Check first corner inside circle - entire rectangle inside circle dist2 = (S2x-CenX)*(S2x-CenX) + (S2y-CenY)*(S2y-CenY) If (dist2 <= Rad2) Then Intersect = "True" Goto Found EndIf 'Equation of circle (X-CenX)^2+(Y-CenY)^2 = Rad^2 'We find the X or Y when the other is known - note 2 solutions to sqrt (+/-) - then check the found value is on the edge 'Square left face X=S2x => Y = CenY + sqrt(Rad^2 - (S2x-CenX)^2) sqr = Rad2 - (S2x-CenX)*(S2x-CenX) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenY + sqrt >= S2y And CenY + sqrt <= S2y+S2h) Or (CenY - sqrt >= S2y And CenY - sqrt <= S2y+S2h)) Then Intersect = "True" Goto Found EndIf EndIf 'Square right face X=S2x+S2w => Y = CenY + sqrt(Rad^2 - (S2x+S2w-CenX)^2) sqr = Rad2 - (S2x+S2w-CenX)*(S2x+S2w-CenX) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenY + sqrt >= S2y And CenY + sqrt <= S2y+S2h) Or (CenY - sqrt >= S2y And CenY - sqrt <= S2y+S2h)) Then Intersect = "True" Goto Found EndIf EndIf 'Square top face Y=S2y => X = CenX + sqrt(Rad^2 - (S2y-CenY)^2) sqr = Rad2 - (S2y-CenY)*(S2y-CenY) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenX + sqrt >= S2x And CenX + sqrt <= S2x+S2w) Or (CenX - sqrt >= S2x And CenX - sqrt <= S2x+S2w)) Then Intersect = "True" Goto Found EndIf EndIf 'Square bottom face Y=S2y+S2h => X = CenX + sqrt(Rad^2 - (S2y+S2h-CenY)^2) sqr = Rad2 - (S2y+S2h-CenY)*(S2y+S2h-CenY) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenX + sqrt >= S2x And CenX + sqrt <= S2x+S2w) Or (CenX - sqrt >= S2x And CenX - sqrt <= S2x+S2w)) Then Intersect = "True" Goto Found EndIf EndIf Found: If (Intersect) Then Sound.PlayBellRingAndWait() EndIf EndIf EndSub 'Collision Sub ReactionKeyPressing mS2 = 0 If Kd = 1 Then Kd = 0 LKD = GraphicsWindow.LastKey If LKD = "Up" Then S2y = S2y - S2s If S2y < 0 Then S2y = 0 Else mS2 = 1 EndIf ElseIf LKD = "Down" Then S2y = S2y + S2s If S2y > W1h - S2h Then S2y = W1h - S2h Else mS2 = 1 EndIf ElseIf LKD = "Left" Then S2x = S2x - S2s If S2x < 0 Then S2x = 0 Else mS2 = 1 EndIf ElseIf LKD = "Right" Then S2x = S2x + S2s If S2x > W1w - S2w Then S2x = W1w - S2w Else mS2 = 1 EndIf ElseIf LKD = "Escape" Then Program.End() EndIf EndIf LKD = "" EndSub 'ReactionKeyPressing Sub Init ' Define Constant T = "True" F = "False" S = "Succsess" FF = "Failed" ' Define Color W1bac = "Lightgreen" W1brc = "Black" S1c = "Red" S2c = "DarkBlue" Pc = "DarkGray" ' Define Pen GraphicsWindow.PenColor = Pc GraphicsWindow.PenWidth = 5 ' Define Window Wmw = Desktop.Width ' Window max. width Wmh = Desktop.Height ' Window max height W1w = Wmw / 1.25 ' Window 1 width (80% of maximal) W1h = Wmh / 1.25 ' Window 1 height (80% of maximal) W1x = (Wmw - W1w) / 2 ' Window 1 position x (horizontal center) W1y = (Wmh - W1h) / 2 ' Window 1 position y (vertical center) GraphicsWindow.BackgroundColor = W1bac GraphicsWindow.BrushColor = W1brc ' Define atributs of SHAPE 1 S1w = 100 ' Shape 1 width S1h = 100 ' Shape 1 height S1x = (W1w / 2) - (S1w / 2) ' Shape 1 position x (horizontal center) S1y = (W1h / 2) - (s1h / 2) ' Shape 1 position y (on top) ' Define atributs of SHAPE 2 S2w = 50 ' Shape 2 width S2h = 30 ' Shape 2 height S2x = W1w - S2w ' Shape 2 position x (horizontal max right) S2y = W1h - S2h ' Shape 2 position y (vertical max down) ' Show the Window on definition place GraphicsWindow.Left = W1x ' Set the window 1 position W1x on the desktop GraphicsWindow.Top = W1y -35 ' Set the window 1 potition W1y on the desktop GraphicsWindow.Width = W1w ' Set the window width GraphicsWindow.Height = W1h ' Set the window height GraphicsWindow.Show() ' Show the window GraphicsWindow.BrushColor = W1brc GraphicsWindow.BackgroundColor = W1bac 'Define Font Fon = "Arial" Fos = 18 Fob = T GraphicsWindow.FontName = Fon GraphicsWindow.FontSize = Fos GraphicsWindow.FontBold = Fob ' Write instruction GraphicsWindow.DrawText(5,5,"You controle the blue rectangle with the cursor keys.") GraphicsWindow.DrawText(5,30,"If it collide with the red circle a bell sonding.") GraphicsWindow.DrawText(5,55,"Press key Esc to exit the program.") ' Set Shape 1 on definition place GraphicsWindow.BrushColor = S1c S1 = Shapes.AddEllipse(S1w, S1h) GraphicsWindow.BrushColor = W1brc Shapes.HideShape(S1) Shapes.Move(S1,S1x,S1y) ' Set Shape 2 on definition place GraphicsWindow.BrushColor = S2c S2 = Shapes.AddRectangle(S2w,S2h) GraphicsWindow.BrushColor = W1brc Shapes.HideShape(S2) Shapes.Move(S2, S2x, S2y) 'Show Shapes Shapes.ShowShape(s1) Shapes.ShowShape(s2) S2s = 10 EndSub 'Init Sub OnKeyDown Kd = 1 ' Set flag key is pressing EndSub 'OnKeyDown Sub OnKeyUp Ku = 1 ' Set flag key is locking EndSub 'OnKeyUp End>XBR791-0.sb< Start>XBR791-1.sb< ' Test program for circle collision ' ID = XBR791-1 'Define event reaction GraphicsWindow.KeyDown = OnKeyDown ' Start Sub OnKeyDown if pressing a key GraphicsWindow.KeyUp = OnKeyUp ' Start Sub OnKeyUp by locking key Init() ' Initialisation objects and attribute ' Main While T ' Main loop (never ending) Move() Collision() ' Check collision and reaction EndWhile Program.End() ' Close the window and end program '************************************************************************************************** Sub Collision 'If Squsre is inside circles squere If S1x + S1w >= S2x And S1x <= S2x + S2w And S1y + s1h >= s2y And S1y <= S2y + S2h Then 'The shapes must be a circle(not ellipse) (shape1) and an unrotated rectangle (shape2) 'Circle centre and radius Rad = S1w/2 Rad2 = Rad*Rad CenX = S1x+Rad CenY = S1y+Rad 'Check first corner inside circle - entire rectangle inside circle dist2 = (S2x-CenX)*(S2x-CenX) + (S2y-CenY)*(S2y-CenY) If (dist2 <= Rad2) Then Intersect = 1 Goto Found EndIf 'Equation of circle (X-CenX)^2+(Y-CenY)^2 = Rad^2 'We find the X or Y when the other is known - note 2 solutions to sqrt (+/-) - then check the found value is on the edge 'Square left face X=S2x => Y = CenY + sqrt(Rad^2 - (S2x-CenX)^2) sqr = Rad2 - (S2x-CenX)*(S2x-CenX) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenY + sqrt >= S2y And CenY + sqrt <= S2y+S2h) Or (CenY - sqrt >= S2y And CenY - sqrt <= S2y+S2h)) Then Intersect = 1 Goto Found EndIf EndIf 'Square right face X=S2x+S2w => Y = CenY + sqrt(Rad^2 - (S2x+S2w-CenX)^2) sqr = Rad2 - (S2x+S2w-CenX)*(S2x+S2w-CenX) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenY + sqrt >= S2y And CenY + sqrt <= S2y+S2h) Or (CenY - sqrt >= S2y And CenY - sqrt <= S2y+S2h)) Then Intersect = 1 Goto Found EndIf EndIf 'Square top face Y=S2y => X = CenX + sqrt(Rad^2 - (S2y-CenY)^2) sqr = Rad2 - (S2y-CenY)*(S2y-CenY) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenX + sqrt >= S2x And CenX + sqrt <= S2x+S2w) Or (CenX - sqrt >= S2x And CenX - sqrt <= S2x+S2w)) Then Intersect = 1 Goto Found EndIf EndIf 'Square bottom face Y=S2y+S2h => X = CenX + sqrt(Rad^2 - (S2y+S2h-CenY)^2) sqr = Rad2 - (S2y+S2h-CenY)*(S2y+S2h-CenY) If (sqr >= 0) Then sqrt = Math.SquareRoot(sqr) If ((CenX + sqrt >= S2x And CenX + sqrt <= S2x+S2w) Or (CenX - sqrt >= S2x And CenX - sqrt <= S2x+S2w)) Then Intersect = 1 Goto Found EndIf EndIf Found: If (Intersect = 1) Then Intersect = 0 Sound.PlayChimesAndWait() GraphicsWindow.Clear() Init() EndIf EndIf EndSub 'Collision Sub Move If KUD = 1 Then S2y = Math.Max(S2y - Speed, 0) Moved = 1 EndIf If KDD = 1 Then S2y = Math.Min(S2y + Speed, W1h - S2h) Moved = 1 EndIf If KLD = 1 Then S2x = Math.Max(S2x - Speed, 0) Moved = 1 EndIf If KRD = 1 Then S2x = Math.Min(S2x + Speed ,W1w - S2w) Moved = 1 EndIf If Moved = 1 Then Moved = 0 Shapes.Move(S2, S2x, S2y) EndIf EndSub 'Move Sub Init ' Define Constant T = "True" F = "False" S = "Succsess" FF = "Failed" 'Key [name] Down KUD = 0 KDD = 0 KLD = 0 KRB = 0 ' Define Color W1bac = "Lightgreen" W1brc = "Black" S1c = "Red" S2c = "DarkBlue" Pc = "DarkGray" ' Define Pen GraphicsWindow.PenColor = Pc GraphicsWindow.PenWidth = 5 ' Define Window Wmw = Desktop.Width ' Window max. width Wmh = Desktop.Height ' Window max height W1w = Wmw / 1.25 ' Window 1 width (80% of maximal) W1h = Wmh / 1.25 ' Window 1 height (80% of maximal) W1x = (Wmw - W1w) / 2 ' Window 1 position x (horizontal center) W1y = (Wmh - W1h) / 2 ' Window 1 position y (vertical center) GraphicsWindow.BackgroundColor = W1bac GraphicsWindow.BrushColor = W1brc ' Define atributs of SHAPE 1 S1w = 100 ' Shape 1 width S1h = 100 ' Shape 1 height S1x = (W1w / 2) - (S1w / 2) ' Shape 1 position x (horizontal center) S1y = (W1h / 2) - (s1h / 2) ' Shape 1 position y (on top) ' Define atributs of SHAPE 2 S2w = 50 ' Shape 2 width S2h = 30 ' Shape 2 height S2x = W1w - S2w ' Shape 2 position x (horizontal max right) S2y = W1h - S2h ' Shape 2 position y (vertical max down) Intersect = 0 ' Variable used in collision check Moved = 0 ' Variable used in move Speed = 0.025 ' Speed for square ' Show the Window on definition place GraphicsWindow.Left = W1x ' Set the window 1 position W1x on the desktop GraphicsWindow.Top = W1y -35 ' Set the window 1 potition W1y on the desktop GraphicsWindow.Width = W1w ' Set the window width GraphicsWindow.Height = W1h ' Set the window height GraphicsWindow.Show() ' Show the window GraphicsWindow.BrushColor = W1brc GraphicsWindow.BackgroundColor = W1bac 'Define Font Fon = "Arial" Fos = 18 Fob = T GraphicsWindow.FontName = Fon GraphicsWindow.FontSize = Fos GraphicsWindow.FontBold = Fob ' Write instruction GraphicsWindow.DrawText(5,5,"You controle the blue rectangle with the cursor keys.") GraphicsWindow.DrawText(5,30,"If it collide with the red circle a bell sonding.") GraphicsWindow.DrawText(5,55,"Press key Esc to exit the program.") ' Set Shape 1 on definition place GraphicsWindow.BrushColor = S1c S1 = Shapes.AddEllipse(S1w, S1h) GraphicsWindow.BrushColor = W1brc Shapes.HideShape(S1) Shapes.Move(S1,S1x,S1y) ' Set Shape 2 on definition place GraphicsWindow.BrushColor = S2c S2 = Shapes.AddRectangle(S2w,S2h) GraphicsWindow.BrushColor = W1brc Shapes.HideShape(S2) Shapes.Move(S2, S2x, S2y) 'Show Shapes Shapes.ShowShape(s1) Shapes.ShowShape(s2) EndSub 'Init Sub OnKeyDown LKD = GraphicsWindow.LastKey If LKD = "Up" Then KUD = 1 ElseIf LKD = "Down" Then KDD = 1 ElseIf LKD = "Left" Then KLD = 1 ElseIf LKD = "Right" Then KRD = 1 ElseIf LKD = "Escape" Then Program.End() EndIf EndSub 'OnKeyDown Sub OnKeyUp LKD = GraphicsWindow.LastKey If LKD = "Up" Then KUD = 0 ElseIf LKD = "Down" Then KDD = 0 ElseIf LKD = "Left" Then KLD = 0 ElseIf LKD = "Right" Then KRD = 0 EndIf EndSub 'OnKeyUp End>XBR791-1.sb< Start>XBS486.sb< '''''''''''''''''''''''''''''''''''''''''''''''' ' for Zock77 GotoLoop ''''''''''''''''''''''''''''''''''''''''''''''' init() AddTanks() GraphicsWindow.MouseDown=Onmousedown GraphicsWindow.MouseMove=Onmousemove While "true" erase() missilemove() Movetanks() hitcheck() endWhile Sub hitcheck ' tankoffset is necessary For L= 1 To Numoftanks For LL = startmsl to count If (Tankx[L]-tankoffsetGW For K=startmsl To count mslX[K]= Shapes.GetLeft(missile[K]) mslY[K]= Shapes.Gettop(missile[K]) If mslX[K]>0.95*GW Then Shapes.reMove(missile[K]) startmsl=K ' missile remains (count - startmsl) endif ' EndFor If Math.Remainder(count,10)=0 Then ' romove remained shapes again ( sometimes some missile remains) For K=1 To startmsl Shapes.reMove(missile[K]) EndFor endif endsub Sub missilemove ' move remained missiles For P=startmsl To count TimeNow [p] = (Clock.ElapsedMilliseconds - misstart[p])/1000 MslX[p] = vCos[p]*TimeNow[p] + StartX MslY[p] = vSin[p]*TimeNow[p] + TimeNow[p]*TimeNow[p] * Gravity/2 + StartY Shapes.Move( Missile[p],MslX[p],MslY[p] ) EndFor EndSub Sub Movetanks Tankoffset=100*(clock.ElapsedMilliseconds-t0)/1000 For Move = 1 To Numoftanks Shapes.Move(Tank[Move], (Tankx[Move] - Tankoffset), Tanky[Move]) EndFor EndSub Sub onmousemove gx= GraphicsWindow.MouseX gy= GraphicsWindow.MouseY If gxXBS486.sb< Start>XBZ649.sb< 'Message Crawl and Fade Prototype -- by Matthew L. Parets aka codingCat 'A message is defined as a series of text shapes. 'The message is then repeated crawled up the screen, 'slowly fading in as it moves upwards and then 'fading back out as it reaches the top GraphicsWindow.Show() GraphicsWindow.BackgroundColor = "black" '-------------------------------------------------------------------------- openingMsg[1] = "-A death defying search for" openingMsg[2] = "scientific riches amongst the rocks." openingMsg[3] = "-Use the arrow keys to move your ship." openingMsg[4] = "-Avoid being hit by the meteors while" openingMsg[5] = "you move from the home base (left)" openingMsg[6] = "to the new base (right)." openingMsg[7] = "-Each hit by a rock damages your ship" openingMsg[8] = "and returns you to the home." openingMsg[9] = "-The density of rocks increases as you" openingMsg[10] = "move deep into the field." openingMsg[11] = "-Points are awarded based on the density" openingMsg[12] = "of the rocks and time you take jumping" openingMsg[13] = "from base to base." openingMsg[14] = "-Good luck! You are going to need it." crawlMsg = openingMsg crawlMsgLength = Array.GetItemCount(crawlMsg) 'Build the message shapes GraphicsWindow.FontBold = "True" GraphicsWindow.FontSize = 12 crLinHei = 15 'Font size plus line spacing For i = 1 To crawlMsgLength If Text.GetSubText(crawlMsg[i], 1,1) = "-" Then msg = text.GetCharacter(10147) + " " + text.GetSubText(crawlMsg[i],2,Text.GetLength(crawlMsg[i])-1) Else msg = " " + crawlMsg[i] EndIf GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(87,87,87) msgshpshad[i] = Shapes.AddText(msg) Shapes.HideShape(msgshpshad[i]) GraphicsWindow.BrushColor = "red" msgshp[i] = Shapes.AddText(msg) Shapes.HideShape(msgshp[i]) EndFor openingMsgShpShad = msgshpshad openingMsgShp = msgshp msgshp = " " msgshpshad = " " msgshpshad = openingMsgShpShad msgshp = openingMsgShp 'Top of the display location crDispY = 150 crDispX = 0 'Current view into the message array crDspSiz = 11 'Size of view port should always be odd startPnt = crawlMsgLength 'Start at the end, the last line in the message endPnt = crawlMsgLength + (crDspSiz-1) 'end down past the size of the view port (this starts the message at the bottom, undisplayed) crDspMid = math.Round(crDspSiz / 2) 'Find the middle. This should be a single line and is why the view port should be an odd number of lines crPrcntBefAft = 100 / (crDspMid - 1) 'Percentage step for each line before and then after middle crOpcyChngPerLine = crPrcntBefAft / crLinHei 'Percentage change of opacity for each pixel line moved 'Loop until escaped by the user umc = 1 'Starting point for the message crawl While GraphicsWindow.LastKey <> "Escape" CrawlUpdateMessage() EndWhile Program.End() 'Move each line in the view port one pixel line 'Loop is external - umc must be set to 1 at the start of this process Sub CrawlUpdateMessage CrawlUpdateViewPort() umc = umc + 1 If umc > crLinHei then 'When text has completly scrolled from one line to another 'Hide the one at the top If startPnt <= crawlMsgLength then 'do not access display arrays if outside their range Shapes.HideShape(msgshpshad[startPnt]) Shapes.HideShape(msgshp[startPnt]) EndIf 'move the front of the array up (wrap if needed) startPnt = startPnt + 1 If startPnt > crawlMsgLength + (crDspSiz+3) then startPnt = 1 EndIf 'move the back of the array up (wrap if needed) endPnt = endPnt + 1 If endPnt > crawlMsgLength + (crDspSiz+3) then endPnt = 1 EndIf 'show the next one at the bottom If endPnt <= crawlMsgLength then 'do not access display arrays if outside their range Shapes.Move(msgshpshad[endPnt], crDispX+ 1, crDispY + (crLinHei * crDspSiz) + 1 - 1) Shapes.Move(msgshp[endPnt], crDispX, crDispY + (crLinHei * crDspSiz) - 1) Shapes.SetOpacity(msgshpshad[endPnt],0) Shapes.SetOpacity(msgshp[endPnt],0) Shapes.ShowShape(msgshpshad[endPnt]) Shapes.ShowShape(msgshp[endPnt]) EndIf umc = 1 EndIf EndSub 'Update each line of the viewport 'Move and modify the opacity of each display line one step Sub CrawlUpdateViewPort mvDispPos = 1 'Track the display line crAryPos = startPnt 'Index into the display array For uel = 1 To crDspSiz 'for eah line in the display If crAryPos <= crawlMsgLength then 'do not access display arrays if outside their range 'Move the text Shapes.Move(msgshpshad[crAryPos], crDispX+ 1, crDispY + (crLinHei * mvDispPos) + 1 - umc) Shapes.Move(msgshp[crAryPos], crDispX, crDispY + (crLinHei * mvDispPos) - umc) 'Set the visibility level If uel = crDspMid then 'if the middle line, set fully visible Shapes.SetOpacity(msgshpshad[crAryPos],100) Shapes.SetOpacity(msgshp[crAryPos],100) Else 'Update visibity based on location in view If uel < crDspMid then 'above the middle of the view opcy = ( (uel - 1) * crPrcntBefAft ) + ((crLinHei-umc) * crOpcyChngPerLine) Else 'below the middle of the view opcy = ( (crDspSiz - uel) * crPrcntBefAft ) + (umc * crOpcyChngPerLine) EndIf Shapes.SetOpacity(msgshpshad[crAryPos],opcy) Shapes.SetOpacity(msgshp[crAryPos],opcy) endif EndIf mvDispPos = mvDispPos + 1 ' crAryPos = crAryPos + 1 If crAryPos > crawlMsgLength + (crDspSiz+3) Then 'Wrap the position in the array crAryPos = 1 EndIf EndFor EndSub End>XBZ649.sb< Start>XBZ985.sb< myTextBox = Controls.AddTextBox(20,20) LDFocus.SetFocus(myTextBox) Controls.TextTyped = OnTextTyped Sub OnTextTyped If (Controls.LastTypedTextBox = myTextBox) Then input = Controls.GetTextBoxText(myTextBox) If (LDUtilities.IsNumber(input) = "False") Then 'Can also catch a single decimal point 'Remove non number characters and store location where a non number character was removed output = "" pos = Text.GetLength(input) 'Default at the end, but should always be set in loop below For i = 1 To Text.GetLength(input) char = Text.GetSubText(input,i,1) test = Text.Append(output,char) If (LDUtilities.IsNumber(test)) Then output = test 'The current appended character is still a number Else pos = i-1 'Position to cursor after character deletion EndIf EndFor Controls.SetTextBoxText(myTextBox,output) LDControls.SetCursorPosition(myTextBox,pos) EndIf EndIf EndSub End>XBZ985.sb< Start>XCB203.sb< w20=290 y400=400 GraphicsWindow.Width=1000 GraphicsWindow.Height=500 GraphicsWindow.BackgroundColor="darkblue LDEvents.MouseWheel =mww ss=15 args=0 cset() tx[1]="abcdefghijklmn tx[2]="oprstuvzwxyq tx[3]="mona lisa recut For f=1 to 3 For r=1 to Text.GetLength (tx[f]) ch=Text.GetSubText(tx[f],r,1) tt[1][f]=text.Append (tt[1][f],cc[ch][1]) tt[1][f]=text.Append (tt[1][f],5) tt[2][f]=text.Append (tt[2][f],cc[ch][2]) tt[2][f]=text.Append (tt[2][f],5) tt[3][f]=text.Append (tt[3][f],cc[ch][3]) tt[3][f]=text.Append (tt[3][f],5) endfor endfor redrw() Sub mww If FCKeyboard.IsControlPressed Then ' else ss=math.Abs(ss+ LDEvents.LastMouseWheelDelta*2) endif redrw() EndSub Sub redrw GraphicsWindow.Clear () For zz=1 to 3 For yy=1 To 3 cx=0 For xx=1 to Text.GetLength (tt[yy][zz]) LDCall.Function3 ("qdrw",xx,yy+zz*4,Text.GetSubText(tt[yy][zz],xx,1) ) EndFor endfor endfor EndSub Sub cset icc[1] ="281;0-0;050 icc[2] ="061;0-++<0;074 icc[3] ="266;0>>;377 icc[4] ="061;0>0;074 icc[5] ="08;0-;09 icc[6] ="08;0-;05 icc[7] ="266+;0>1;377+<3 icc[8] ="050;0-0;050 icc[9] ="0;0;0 icc[10] ="50;50;94 icc[11] ="024;0<21<<345;031 icc[12] ="05;05;09 icc[13] ="0120;0340;0550 icc[14] ="010;030;050 icc[15] ="2661;0>>0;3774 icc[16] ="081;0--;055 icc[17] ="2661;0>>0;377+<31<++ icc[18] ="081;0<21<<---;031 icc[19] ="1<88;31;99<3 icc[20] ="808;505;505 icc[21] ="050;050;394 icc[22] ="050;310;531<0 icc[23] ="0550;0210;0430 icc[24] ="3124;521<<345;2431 icc[25] ="31<24;50<55;50<55 icc[26] ="88<2;24;4<99 For f=1 To 26 cc[Text.GetCharacter(64+f)]=ldtext.Split (icc[f],";") EndFor EndSub Sub qdrw x=args[1] y=args[2] z=args[3] If z="<" Then cx=cx-ss Goto fff elseIf z=">" Then cx=cx+ss/1.5 Goto fff elseIf z=" " Then cx=cx+ss*2 Goto fff elseIf z="-" Then GraphicsWindow.FillRectangle (cx y*ss+ss/3.6 ss ss/1.6) cx=cx+ss Goto fff elseIf z="+" Then cx=cx+ss/2.8 Goto fff elseif z=0 or z>5 Then g=0 ElseIf z<5 then g=z+2 g=math.Remainder (g,4) Else cx=cx+ss Goto fff endif px[g]=cx py[g]=y*ss g=g+1 g=math.Remainder (g,4) px[g]=cx+ss py[g]=y*ss g=g+1 g=math.Remainder (g,4) px[g]=cx+ss py[g]=y*ss+ss g=g+1 g=math.Remainder (g,4) px[g]=cx py[g]=y*ss+ss GraphicsWindow.BrushColor =LDColours.HSLtoRGB (0,.7,0.55) If z=0 Then GraphicsWindow.FillRectangle (px[0] py[0] ss ss) cx=cx+ss ElseIf z=8 then GraphicsWindow.FillRectangle (px[0] py[0] ss ss/1.6) cx=cx+ss ElseIf z=9 then GraphicsWindow.FillRectangle (px[0] py[0]+ss/2.4 ss ss/1.6) cx=cx+ss ElseIf z=6 then GraphicsWindow.FillRectangle (px[0] py[0] ss/1.4 ss/1.6) cx=cx+ss/1.5 ElseIf z=7 then GraphicsWindow.FillRectangle (px[0] py[0]+ss/2.4 ss/1.4 ss/1.6) cx=cx+ss/1.5 Else GraphicsWindow.FillTriangle (px[1] py[1] px[2] py[2] px[3] py[3]) cx=cx+ss EndIf fff: EndSub End>XCB203.sb< Start>XCC382.sb< ' suudoku solver by NaochanON 2012/09/21 initData() While iniNMB+NN<81 RCdata() ' calculate Row Column Block data For j=1 to 9 For i=1 to 9 KK= 3*Math.Floor((j-1)/3)+Math.Floor((i-1)/3)+1 ' block number If D[J][i]=" " Then check() endif endfor endfor endwhile TextWindow.WriteLine(" Results is ................. "+Text.GetCharacter(10)) For j=1 to 9 For i=1 to 9 TextWindow.Write( " "+D[J][i]+" ") ' show results endfor TextWindow.Write(Text.GetCharacter(10)) endfor TextWindow.Writeline(" ") Sub check NMB="123456789" word=text.Append(text.Append(R[j],C[i]),B[KK]) For L=1 To Text.GetLength(word) MidP=text.GetSubText(word,L,1) For M=1 To 9 If text.GetSubText(NMB,M,1)=MidP Then NMB= text.Append(Text.GetSubText(NMB,1,M-1),Text.GetSubTextToEnd(NMB,M+1)) EndIf EndFor EndFor If Text.GetLength(NMB)=1 Then D[J][i]=NMB ' <------------- decided number NN=NN+1 ' TextWindow.WriteLine(NN+" : "+j+" : "+i+" : "+NMB) endif EndSub Sub RCdata '---------- Row data ------------- For J=1 To 9 R[J]="" For i=1 To 9 If D[J][i]<>" " Then R[J]=text.Append(R[J],D[J][i]) EndIf EndFor EndFor '---------- Columndata ------------- For i=1 To 9 C[i]="" For J=1 To 9 If D[J][i]<>" " Then C[i]=text.Append(C[i],D[J][i]) EndIf EndFor EndFor '---------- Block data ------------- for K=1 To 9 B[K]="" For j2=1 To 3 j=j2+3*Math.Floor((k-1)/3) For i2=1 To 3 i=i2+3*((k-1)-3*Math.Floor((k-1)/3)) If D[J][i]<>" " Then B[K]=text.Append(B[K],D[J][i]) EndIf EndFor EndFor EndFor EndSub Sub initData '---------- data ------------------------------------------- D[1]="1=7;2=8;3= ;4=9;5= ;6= ;7= ;8=5;9= " D[2]="1= ;2= ;3= ;4=4;5=8;6= ;7=1;8= ;9= " D[3]="1= ;2= ;3= ;4= ;5= ;6=7;7=8;8= ;9= " D[4]="1=4;2= ;3= ;4= ;5=9;6=2;7= ;8=8;9= " D[5]="1=1;2= ;3=5;4= ;5= ;6= ;7=2;8= ;9=7" D[6]="1= ;2=7;3= ;4=1;5=3;6= ;7= ;8= ;9=4" D[7]="1= ;2= ;3=7;4=3;5= ;6= ;7= ;8= ;9= " D[8]="1= ;2= ;3=6;4= ;5=5;6=4;7= ;8= ;9= " D[9]="1= ;2=4;3= ;4= ;5= ;6=6;7= ;8=2;9=9" '------------ count initial data number ---------------- For J=1 To 9 For i=1 To 9 If D[J][i]<>" " Then iniNMB=iniNMB+1 EndIf EndFor EndFor EndSub End>XCC382.sb< Start>XCC705-1.sb< 'Duck Shoot - local Version 1.0 August 2013 http://smallbasic.com/program/?XCC705-1 'This version is Modified to run with ide closed or open. '****************************BUG , fixed************************************ 'exe BUG, spear speed which runs in a Timer thread runs reliably only when the SB ide is open 'but when i run the exe the spear animation slows right down. spearSpeed = 1.8'8 '1.8 is good when ide is open. If this is too high collision test doesn't work 'optimise the thread by delay / 2 delay = 2'1 '0.5 is like critical limit . 2 for ide 'NB i put a speed test in Fire() It tests a condition if the ide is running ''*********************************************************************** mainTrack = "http://www.televisiontunes.com/download.php?f=Benny_Hill_Show" quack = "http://soundbible.com/grab.php?id=197&type=mp3" tree = ImageList.LoadImage("http://www.krishadlock.com/clients/informit/dwc/transparent_png/img/tree1.png") GraphicsWindow.KeyDown = OnKeyDown 'fire GraphicsWindow.MouseMove = OnMouseMove 'crossHairs Controls.ButtonClicked = OnButtonClicked 'Timer.Tick = OnTick 'animate spear & check collision SET in PlayMusic() OpenningScreen() GraphicsWindow.BrushColor = "Salmon" GraphicsWindow.FontSize = 20 openningMessage = Shapes.AddText("Please wait while sound effects d/load") Shapes.Move(openningMessage, 20, 150) Sound.PlayAndWait(quack) Shapes.SetText(openningMessage, "Press Enter to Start") While start <> "Yes" EndWhile Shapes.Remove(openningMessage) '--------------------------------------------------Main Program Data--------------------------------------------------------------- GraphicsWindow.Hide() GraphicsWindow.Clear() SetGW() DuckData() GraphicsData() SetAltitude() FlightSpeed() pause = 1 'minus 1 = Pause On flagFire = 1 flagCollision = 0 scopeRadius = 20 scopeLensOpacity = 20 accumulatedSeconds = 0 '-------------------------------------------------Sound Track Thread---------------------------------- Timer.Interval = 10'0 Timer.Tick = PlayMusic Sub PlayMusic 'thread issue Timer.Pause() Timer.Tick = OnTick 'animate spear & check collision While "True" Sound.PlayAndWait(mainTrack) EndWhile EndSub '-----------------------------------------------Event Response--------------------------------------- Sub OnButtonClicked If Controls.GetButtonCaption(Controls.LastClickedButton) = "Play Again" Then flagClick = "Play Again" EndIf EndSub Sub OnMouseMove UpdateScopePosition() MoveScope() EndSub Sub OnKeyDown If GraphicsWindow.LastKey = "Space" And flagFire = 1 Then Timer.Resume() flagFire = 0 ElseIf Text.ConvertToUpperCase(GraphicsWindow.LastKey) = "P" Then pause = -pause If pause > 0 Then 'continue from New startTime startTime = Clock.ElapsedMilliseconds EndIf ElseIf GraphicsWindow.LastKey = "Return" Then start = "Yes" EndIf EndSub Sub OnTick Timer.Pause() Fire() flagFire = 1 EndSub '============================Main Program======================= Mouse.HideCursor() DrawGraphics() CreateSpear() CreateDuckMessages() AddDuck() zOrderTree() 'could've been an issue with the way wings are Animated GraphicsWindow.Show() GetMouseCentre() 'get after GW.show CreateScopeShapes() OnMouseMove() ShowScope() startTime = Clock.ElapsedMilliseconds '=======================Main Loop / Event Loop ANIMATE DUCK====================== While "True" If flag = "Game Over" Then IndexHighScores() GraphicsWindow.BrushColor = "black" playAgainButton = Controls.AddButton("Play Again", gw/2-25, gh/2) 'WIP Mouse.ShowCursor() While flag = "Game Over" If flagClick = "Play Again" Then flagClick = 0 flag = "Break Loop" ResetTimeAndScore() SetAltitude() FlightSpeed() ResetDuck() EndIf EndWhile Else UpdateTime() EndIf While pause < 0 'negative = Pause On EndWhile If TY[3]+dTY > 28 Or TY[3]+dTY < -10 Then flapSpeed = -flapSpeed EndIf dTY = dTY + flapSpeed dX = dX + duckSpeed Shapes.Remove(frontWing) 'animate WING by redraw If TY[3]+dTY > 0 Then GraphicsWindow.BrushColor = "Maroon" Else GraphicsWindow.BrushColor = "DarkGoldenrod" EndIf frontWing = Shapes.AddTriangle(TX[1]+dx,TY[1]+oT,TX[2]+dx,TY[2]+oT,TX[3]+dx,TY[3]+dTY+oT) Shapes.Remove(rearWing) If TY[3]+dTY < 0 Then dRTY = dRTY + flapSpeed/2 GraphicsWindow.BrushColor = "Maroon" rearWing = Shapes.AddTriangle(TX[4]+dx,TY[4]+oT,TX[5]+dx,TY[5]+oT,TX[6]+dx,TY[6]+dRTY+oT) Else dRTY = 0 'reset rearWing displacement EndIf For i = 1 To 5 Shapes.Move(duckShape[i], DS[i]["X"]+dX, DS[i]["Y"]+oT) EndFor If DS[4]["X"] + dX > gw Then 'If tail is off screen right dX = -DS[2]["X"] - DS[2]["W"] dTY = 0 'BUG fixer?? SetAltitude() FlightSpeed() ElseIf flagCollision = 1 Then Sound.Play(quack) DeadDuck() UpdateScore() HideDeadDuck() SetAltitude() ResetDuck() ResetSpear() FlightSpeed() Sound.Stop(quack) flagCollision = 0 EndIf Program.Delay(10) '10 EndWhile '-------------------------------------------Duck Subroutines---------------------------------------------------------- Sub DuckData 'DUCK - DATA TABLE ' Table key: W = width; H = height; X = X rel to the body; Y = Y rel to body; R = rotate angle" DS[1] = "W=28;H=8;X=62;Y=2;R=-10;BC=DarkGoldenrod" 'NECK DS[2] = "W=22;H=6;X=89;Y=0;R=0;BC=Maroon" 'BEAK DS[3] = "W=20;H=18;X=82;Y=-8;R=0;BC=Purple" 'HEAD y=-5 DS[4] = "W=65;H=12;X=0;Y=4;R=5;BC=Sienna" 'TAIL DS[5] = "W=60;H=25;X=12;Y=0;R=0;BC=Sienna" 'BODY TX = "1=40;2=57;3=44;4=34;5=42;6=37" 'FRONT WING X TY = "1=8;2=8;3=28;4=0;5=0;6=0" 'FRONT WING Y . Y[3] animated by add/remove Speed = "1=1;2=1.4;3=1.6;4=1.8" Altitude = "1=200;2=130;3=280;4=100;5=230" EndSub Sub SetAltitude If a < 5 Then a = a + 1 Else a = 1 EndIf oT = Altitude[a] EndSub Sub AddDuck 'ADD DUCK w/o WINGS dX = -DS[2]["X"] - DS[2]["W"] 'position off Left For i = 1 To 5 GraphicsWindow.BrushColor = DS[i]["BC"] duckShape[i] = Shapes.AddEllipse(DS[i]["W"], DS[i]["H"]) Shapes.HideShape(duckShape[i]) 'reduce 0,0 flash Shapes.Rotate(duckShape[i], DS[i]["R"]) Shapes.Move(duckShape[i], DS[i]["X"]+dx, DS[i]["Y"]+oT) Shapes.ShowShape(duckShape[i]) EndFor EndSub Sub ResetDuck dTY = 0 'BUG fixer?? dX = -DS[2]["X"] - DS[2]["W"] For i = 1 To 5 Shapes.Move(duckShape[i], DS[i]["X"]+dX, DS[i]["Y"]+oT) Shapes.ShowShape(duckShape[i]) EndFor EndSub Sub FlightSpeed k = k + 1 If k > 4 Then k = 1 EndIf flapSpeed = Speed[k] * 2.5 duckSpeed = Speed[k] * 5 EndSub Sub Fire xS = gw / 2 yS = gh xT = scopeX + 8 yT = scopeY rise = yS - yT run = xT - xS slope = run / rise 'inverted angle = slope * 45 Shapes.Rotate(spear, angle) While yS > - 35 And xS > -35 And xS < gw +35 And flagCollision = 0 'animate Spear till Spear off screen yS = yS - spearSpeed ' 2.0 ' constant = spear speed xS = xS + spearSpeed * slope '2.0 Shapes.Move(spear, xS, yS) 'TODO adjust speed for angle If DS[5]["Y"]+oT > yS And DS[3]["Y"]+oT < yS And DS[5]["X"]+dX < xS And DS[3]["X"]+20 + dX > xS Then flagCollision = 1 If xS > DS[3]["X"]+dX Then Shapes.SetText(headShot, "Head Shot!! Bonus 50") flagHeadShot = 1 EndIf EndIf start_Time = Clock.ElapsedMilliseconds Program.Delay(delay) 'was 2 finish_Time = Clock.ElapsedMilliseconds speedTest = finish_Time - start_Time 'TextWindow.WriteLine(speedTest) If speedTest > 5 Then 'sb ide is closed spearSpeed = 8 delay = 1 Else 'sb ide is running spearSpeed = 1.8 delay = 2 EndIf EndWhile EndSub Sub DeadDuck get_xS = xS 'need to get so xS, yS is not shared get_yS = yS got_xS = get_xS 'don't need to store in got unless used in another event as well got_yS = get_yS Shapes.SetText(ducksMessage, "Ouch! Quack Quack") While oT < gh - 40 'And flag <> "Game Over" If flag <> "Game Over" Then UpdateTime() EndIf While pause = -1 EndWhile oT = oT + 3 got_yS = got_yS + 3 'yS is being shared on SPACE down so use oT Shapes.Move(spear, got_xS, got_yS) Shapes.Move(ducksMessage, got_xS, got_yS-25) For i = 1 To 5 Shapes.Move(duckShape[i], DS[i]["X"]+dX, DS[i]["Y"]+oT) EndFor Shapes.Remove(frontWing) frontWing = Shapes.AddTriangle(TX[1]+dx,TY[1]+oT,TX[2]+dx,TY[2]+oT,TX[3]+dx,TY[3]+dTY+oT) Shapes.Remove(rearWing) rearWing = Shapes.AddTriangle(TX[4]+dx,TY[4]+oT,TX[5]+dx,TY[5]+oT,TX[6]+dx,TY[6]+dRTY+oT) Program.Delay(10) EndWhile EndSub Sub HideDeadDuck For i = 1 To 5 Shapes.HideShape(duckShape[i]) EndFor Shapes.Remove(frontWing) Shapes.Remove(rearWing) Shapes.HideShape(spear) Shapes.SetText(headShot, "") Shapes.SetText(ducksMessage, "") EndSub Sub CreateSpear GraphicsWindow.BrushColor = "DarkGreen" spear = Shapes.AddRectangle(3, 35) Shapes.Move(spear, gw/2, gh) EndSub Sub ResetSpear Shapes.Move(spear, gw/2, gh) Shapes.ShowShape(spear) EndSub Sub CreateDuckMessages GraphicsWindow.BrushColor = "Purple" ducksMessage = Shapes.AddText("") 'positioned in DeadDuck() headShot = Shapes.AddText("") Shapes.Zoom(headShot, 3, 3) Shapes.Move(headShot, 300, 250) EndSub '===========================Screen Graphics Subroutines============== Sub GraphicsData Msg[1] = "FS=26;BrC=Khaki;oX=10;LS=0;Txt=Game Controls" Msg[2] = "FS=16;BrC=DarkKhaki;oX=10;LS=30;Txt=Fire: SPACE BAR" Msg[3] = "FS=16;BrC=DarkKhaki;oX=10;LS=50;Txt=Aim: MOUSE/TOUCH PAD" Msg[4] = "FS=16;BrC=DarkKhaki;oX=10;LS=70;Txt=Pause: P" Msg[5] = "FS=26;BrC=Khaki;oX=980;LS=0;Txt=Time" Msg[6] = "FS=26;BrC=Khaki;oX=520;LS=0;Txt=Score" Msg[7] = "FS=16;BrC=SaddleBrown;oX=960;LS=-475;Txt=Eora Duck Hunt" '10 Tot[1] = "W=130;Op=30;X=485;Y=10;BrC=Yellow" Tot[2] = "W=80;Op=30;X=300;Y=230;BrC=Yellow" Tot[3] = "W=60;Op=70;X=730;Y=270;BrC=LimeGreen" BO = 100 'bottom offset EndSub Sub DrawGraphics GraphicsWindow.BrushColor = "black" 'BOTTOM RIBBON GraphicsWindow.DrawRectangle(0, gh - BO, gw, gh) GraphicsWindow.FillRectangle(0, gh - BO, gw, gh) For i = 1 To 3 'add TOTEMS GraphicsWindow.BrushColor = Tot[i]["BrC"] totem[i] = Shapes.AddEllipse(Tot[i]["W"], Tot[i]["W"]) Shapes.HideShape(totem[i]) Shapes.SetOpacity(totem[i], Tot[i]["Op"]) Shapes.Move(totem[i], Tot[i]["X"], Tot[i]["Y"]) Shapes.ShowShape(totem[i]) EndFor GraphicsWindow.PenColor = "red" 'RAINBOW SNAKE GraphicsWindow.PenWidth = 15 y2 = gh - BO y1 = y2 For x2 = 1 To gw Step 5 y2 = Math.Sin(10 * x2) * 7 + gh - BO GraphicsWindow.DrawLine(x1, y1, x2, y2) x1 = x2 - 1 y1 = y2 - 1 EndFor GraphicsWindow.PenWidth = 0 x1 = 0 y1 = 0 For i = 1 To 7 'Draw GAME Text GraphicsWindow.FontSize = Msg[i]["FS"] GraphicsWindow.BrushColor = Msg[i]["BrC"] GraphicsWindow.DrawText(Msg[i]["oX"], gh-BO+Msg[i]["LS"], Msg[i]["Txt"]) ' EndFor GraphicsWindow.FontSize = 26 GraphicsWindow.BrushColor = "DarkKhaki" displayTime = Shapes.AddText("00:00") 'WIP Shapes.Move(displayTime, 985, gh-BO + 35) displayScore = Shapes.AddText("0") Shapes.Move(displayScore, 520, gh-BO + 35) GraphicsWindow.BrushColor = "DarkOliveGreen" GraphicsWindow.FontSize = 18 GraphicsWindow.DrawText(10, 8, "High Scores") Rank = "1=1st;2=2nd;3=3rd;X=10" RankY = "1=30;2=47;3=64" GraphicsWindow.FontSize = 16 For i = 1 To 3 GraphicsWindow.DrawText(Rank["X"], RankY[i], Rank[i]) displayHighScore[i] = Shapes.AddText("0") Shapes.Move(displayHighScore[i], 60, RankY[i]) EndFor EndSub Sub zOrderTree tree = Shapes.AddImage(tree) Shapes.Move(tree, gw-605, (gh-380)/4) Shapes.Zoom(tree, 0.5, 0.5) EndSub '----------------------------------------------Time Subroutines------------------------------------ Sub UpdateTime gameSeconds = (Clock.ElapsedMilliseconds - startTime) / 1000 If pause < 0 Then accumulatedSeconds = accumulatedSeconds + gameSeconds ElseIf pause > 0 Then totalSeconds = accumulatedSeconds + gameSeconds EndIf seconds = Math.Floor(Math.Remainder(totalSeconds, 60)) minutes = Math.Floor(Math.Remainder(totalSeconds / 60, 60)) If seconds < 10 And minutes < 10 Then Shapes.SetText(displayTime, "0" + minutes + ":0" + seconds) ElseIf seconds >= 10 And minutes < 10 Then Shapes.SetText(displayTime, "0" + minutes + ":" + seconds) EndIf If minutes = 1 Then flag = "Game Over" EndIf EndSub Sub ResetTimeAndScore ' PlayAgain minutes = 0 seconds = 0 accumulatedSeconds = 0 startTime = Clock.ElapsedMilliseconds score = 0 'WIP need to update after restart Shapes.SetText(displayScore, score) Mouse.HideCursor() Controls.HideControl(playAgainButton) EndSub '-----------------------------------------------Score Subroutines---------------------------------- Sub UpdateScore If flagHeadShot = 1 Then score = score + 50 flagHeadShot = 0 EndIf score = score + 10 Shapes.SetText(displayScore, score) EndSub Sub IndexHighScores j = j + 1 gotScore[j] = score For ranked = 1 To 3 For i = 1 To Array.GetItemCount(gotScore) 'get the max HS[ranked] = Math.Max(HS[ranked], gotScore[i]) EndFor For i = 1 To Array.GetItemCount(gotScore) If HS[ranked] = gotScore[i] Then gotScore[i] = "" EndIf EndFor index = Array.GetAllIndices(gotScore) For i = 1 To Array.GetItemCount(gotScore) newVal[i] = gotScore[index[i]] gotScore[i] = newVal[i] EndFor Shapes.SetText(displayHighScore[ranked], HS[ranked]) EndFor For i = Array.GetItemCount(gotScore) + 1 To Array.GetItemCount(gotScore) + 3 n = n + 1 gotScore[i] = HS[n] EndFor n = 0 EndSub '----------------------------------------------Scope Subroutines----------------------------------- Sub CreateScopeShapes GraphicsWindow.BrushColor = "black" 'ADDING THIS MAKES SCOPE APPEAR ON TOP? scopeLens = Shapes.AddEllipse(scopeRadius*2, scopeRadius*2) Shapes.SetOpacity(scopeLens, scopeLensOpacity) Shapes.HideShape(scopeLens) 'add then hide (on next line to minimise screen flash) scopeHorzLine = Shapes.AddRectangle(scopeRadius*2, 1) Shapes.HideShape(scopeHorzLine) 'using rectangle so i don't need x & y coord yet scopeVertLine = Shapes.AddRectangle(1, scopeRadius*2) Shapes.HideShape(scopeVertLine) EndSub Sub GetMouseCentre Mouse.MouseX = GraphicsWindow.Left + GraphicsWindow.Width/2 Mouse.MouseY = GraphicsWindow.Top + GraphicsWindow.Height/2 EndSub Sub ShowScope Shapes.ShowShape(scopeVertLine) 'pos 1st then show in centre of GW Shapes.ShowShape(scopeHorzLine) Shapes.ShowShape(scopeLens) EndSub Sub UpdateScopePosition scopeX = GraphicsWindow.MouseX scopeY = GraphicsWindow.MouseY EndSub Sub MoveScope Shapes.Move(scopeLens, scopeX - scopeRadius, scopeY - scopeRadius) Shapes.Move(scopeHorzLine, scopeX - scopeRadius, scopeY) Shapes.Move(scopeVertLine, scopeX, scopeY - scopeRadius) EndSub '-----------------------------------------Graphics Window Subroutines---------------------------- Sub SetGW gw = 1100 gh = 580 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = (Desktop.Height - gh) / 3 GraphicsWindow.Title = "Songline Software" 'GraphicsWindow.CanResize = "false" GraphicsWindow.BackgroundColor = "DeepSkyBlue" GraphicsWindow.PenWidth = 0 EndSub Sub OpenningScreen GraphicsWindow.CanResize = "false" gw = 470 gh = 500 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Left = (Desktop.Width - gw) / 2 GraphicsWindow.Top = (Desktop.Height - gh) / 3 GraphicsWindow.Title = "Songline Software" GraphicsWindow.BackgroundColor = "DarkOliveGreen" OM[1] = "X=0;Y=20;FS=20;BC=NavajoWhite;Txt=Hello & Welcome to" OM[2] = "X=0;Y=50;FS=32;BC=NavajoWhite;Txt=Eora Duck Hunt" OM[3] = "X=0;Y=95;FS=12;BC=NavajoWhite;Txt=local version 1.0" OM[4] = "X=0;Y=115;FS=10;BC=NavajoWhite;Txt=a duck shoot game by Jibba Jabba, August 2013" ' OM[5] = "X=0;Y=150;FS=20;BC=Salmon;Txt=Please wait while sound effects d/load" OM[6] = "X=0;Y=180;FS=12;BC=NavajoWhite;Txt=Plays best with an internet connection" OM[7] = "X=0;Y=250;FS=20;BC=NavajoWhite;Txt=How to play:" OM[8] = "X=0;Y=280;FS=14;BC=NavajoWhite;Txt=The aim is to spear as many ducks as you can in 1 minute" OM[9] = "X=0;Y=305;FS=14;BC=NavajoWhite;Txt=You'll score 10 points per duck and a bonus 50 for head shots" OM[10] = "X=0;Y=340;FS=14;BC=NavajoWhite;Txt=Aim: mouse/touchpad" OM[11] = "X=0;Y=360;FS=14;BC=NavajoWhite;Txt=Fire: space bar" OM[12] = "X=0;Y=380;FS=14;BC=NavajoWhite;Txt=Pause: P" OM[13] = "X=0;Y=460;FS=9;BC=NavajoWhite;Txt=This game does NOT intend to portray hunting as a sport or recreation" OM[14] = "X=0;Y=480;FS=9;BC=NavajoWhite;Txt=And suggests when hunting or gathering you only take what you need" leftOffset = 20 For i = 1 To 14 GraphicsWindow.FontSize = OM[i]["FS"] GraphicsWindow.BrushColor = OM[i]["BC"] GraphicsWindow.DrawText(OM[i]["X"] + leftOffset, OM[i]["Y"], OM[i]["Txt"]) EndFor EndSub End>XCC705-1.sb< Start>XCD435.sb< ' mahreen miangul MaY 2017 ' Kyoty drawn with Lines GraphicsWindow.top=0 GraphicsWindow.left=0 GraphicsWindow.CanResize = 0 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.Left = 0.38 * (Desktop.Width - GraphicsWindow.Width) GraphicsWindow.Top = 0.18 * (Desktop.Height - GraphicsWindow.Height) GraphicsWindow.BackgroundColor= "green"'"#e6e6f6" GraphicsWindow.Width = "1080" GraphicsWindow.Height = "555" GH = GraphicsWindow.Height GW = GraphicsWindow.Width '----------------------Font Animation ----------------------------------------------------------------------------------------- GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 33 GraphicsWindow.FontItalic = "True" GraphicsWindow.BrushColor = "silver" ' Text shadow color GraphicsWindow.DrawText(430, 245, "n") ' Shadow position/text GraphicsWindow.DrawText(450, 245, "o") ' Shadow position/text GraphicsWindow.DrawText(430, 270, "s") ' Shadow position/text GraphicsWindow.DrawText(450, 285, "y") ' Shadow position/text GraphicsWindow.BrushColor = "lightyellow" ' Text color GraphicsWindow.DrawText(425, 240, "n") ' Position and text GraphicsWindow.DrawText(445, 240, "o") ' Position and text GraphicsWindow.DrawText(425, 265, "s") ' Position and text GraphicsWindow.DrawText(445, 280, "y") ' Position and text '--------------------Font Animation ----------------------------------------------------------------------------------------- GraphicsWindow.FontName = "Times New Roman" GraphicsWindow.FontSize = 55 GraphicsWindow.FontItalic = "True" GraphicsWindow.BrushColor = "lightyellow" ' Text shadow color GraphicsWindow.DrawText(605, 25, "mahreen miangul!")' Shadow position/text GraphicsWindow.DrawText(285, 445, "Wile E Coyote!") ' Shadow position/text gold= GraphicsWindow.getcolorfromrgb(121,94,40) GraphicsWindow.BrushColor = gold ' Text color GraphicsWindow.DrawText(600, 20, "mahreen miangul!") ' Position and text GraphicsWindow.DrawText(280, 440, "Wile E Coyote!") ' Position and text '-------------------------haroon rashid------------------------------------------------------------------------------------------- GraphicsWindow.PenColor = "darkslategray" GraphicsWindow.PenWidth = "2" Lin = 0 LinH: For i = 1 to (GW/10) Lin = Lin + 25 Program.Delay(10) Shapes.AddLine(Lin, 0, Lin, GH) Endfor Lint = 0 For i = 1 to (GH/10) Lint = Lint + 25 Program.Delay(10) Shapes.AddLine(0, Lint, GW, Lint) Endfor Program.Delay(10) '------------------------------Wile E Coyote---------------------------------------------------------------------------------- GraphicsWindow.PenWidth = 4 GraphicsWindow.PenColor = "darkred" ' face 17 lines GraphicsWindow.drawline(380,440,520,440) ' down GraphicsWindow.drawline(380,440,250,290) ' left 1 GraphicsWindow.drawline(252,148,252,292) 'left 2 GraphicsWindow.drawline(520,440,620,290) ' right 1 GraphicsWindow.drawline(620,148,620,292) 'right 2 GraphicsWindow.drawline(250,150,310,30) ' 1 GraphicsWindow.drawline(310,30,360,150) ' 2 GraphicsWindow.drawline(360,150,380,100) ' 3 GraphicsWindow.drawline(380,100,400,150) ' 4 GraphicsWindow.drawline(400,150,400,70) ' 5 GraphicsWindow.drawline(400,70,420,150) ' 6 GraphicsWindow.drawline(420,150,440,70) ' 7 GraphicsWindow.drawline(440,70,450,150) ' 8 GraphicsWindow.drawline(450,150,480,100) ' 9 GraphicsWindow.drawline(480,100,510,150) ' 10 GraphicsWindow.drawline(510,150,540,30) ' 11 GraphicsWindow.drawline(540,30,620,150) ' 12 ' mushtash GraphicsWindow.drawline(330,240,420,300) GraphicsWindow.drawline(330,270,420,300) GraphicsWindow.drawline(330,310,420,300) GraphicsWindow.drawline(330,330,420,300) GraphicsWindow.drawline(540,240,470,300) GraphicsWindow.drawline(540,270,470,300) GraphicsWindow.drawline(540,300,470,300) GraphicsWindow.drawline(540,330,470,300) ' nosy GraphicsWindow.PenWidth = 4 GraphicsWindow.penColor = "yellow" GraphicsWindow.drawline(420,250,420,320) GraphicsWindow.drawline(420,250,470,250) GraphicsWindow.drawline(470,250,470,320) GraphicsWindow.drawline(420,320,470,320) ' mouth GraphicsWindow.PenWidth = 4 GraphicsWindow.PenColor = "darkslateblue"'"slateblue"'"mediumslateblue" GraphicsWindow.drawline(400,350,500,350) GraphicsWindow.drawline(420,390,480,390) GraphicsWindow.drawline(400,350,420,390) GraphicsWindow.drawline(500,350,480,390) ' ears GraphicsWindow.PenWidth = 4 GraphicsWindow.penColor = "blue" GraphicsWindow.drawline(280,150,295,115) ' left GraphicsWindow.drawline(295,115,315,150) GraphicsWindow.drawline(280,150,315,150) GraphicsWindow.drawline(540,150,555,115) ' right GraphicsWindow.drawline(555,115,570,150) GraphicsWindow.drawline(540,150,575,150) ' eyes GraphicsWindow.pencolor= "darkslategry" GraphicsWindow.drawline(290,240,330,240) ' eye left GraphicsWindow.drawline(290,240,290,210) GraphicsWindow.drawline(290,210,330,210) GraphicsWindow.drawline(330,210,330,240) GraphicsWindow.drawline(540,240,580,240) ' eye right GraphicsWindow.drawline(540,240,540,210) GraphicsWindow.drawline(580,210,580,240) GraphicsWindow.drawline(540,210,580,210) GraphicsWindow.PenWidth = 11 GraphicsWindow.pencolor= "snow" GraphicsWindow.drawline(300,225,315,225) ' pupil left GraphicsWindow.drawline(550,225,565,225) ' pupil right End>XCD435.sb< Start>XCF810.sb< args=0 GraphicsWindow.BackgroundColor="darkblue GraphicsWindow.BrushColor="brown Sub crww l=l+1 GraphicsWindow.Title="level: "+l n[l]=args[1] a[l]=args[2] h[l]=args[3] If n[l]=0 Then tmw() Else LDCall.Function3( "crww" n[l]-1 (-a[l]) h[l]/2) tang=tang+ a[l] LDCall.Function3( "crww" n[l]-1 a[l] h[l]/2) tang=tang+ a[l] LDCall.Function3( "crww" n[l]-1 (-a[l]) h[l]/2) EndIf l=l-1 EndSub Sub tmw pp=LDMath.Convert2Cartesian(tx ty h[l] tang) GraphicsWindow.PenColor=LDColours.HSLtoRGB(ss 1 .65) ss=ss+5 GraphicsWindow.DrawLine(tx ty pp[1] pp[2]) tx=pp[1] ty=pp[2] Program.Delay(6) EndSub GraphicsWindow.Title="crww tx=100 ty=420 tang=-60 GraphicsWindow.PenWidth=1.2 ldcall.Function3( "crww" 7 60 440) Turtle.Hide() End>XCF810.sb< Start>XCG342.sb< AddBike() LDPhysics.SetPosition(Bike,300,100,0) LDPhysics.DoTimestep() GraphicsWindow.MouseDown = Mouse GraphicsWindow.MouseUp = MouseUp While 1 = 1 Program.Delay(10) LDPhysics.DoTimestep() If Mouse.IsLeftButtonDown Then ' GraphicsWindow.ShowMessage(GraphicsWindow.MouseX + ", " + GraphicsWindow.MouseY,"") EndIf Pos = LDPhysics.GetPosition(FrontWheel) PosA = LDPhysics.GetPosition(DistAncor) Distx = Math.Abs(Pos[1]-PosA[1]) Disty = Math.Abs(Pos[2]-PosA[2]) OldDist = Dist Dist = Math.SquareRoot((Distx*Distx)+(Disty*Disty)) pjs = Dist - OldDist pjt = Dist-260 If (pjt * 100) + (pjs * 10) < 0 Then Sine = 1 Else Sine = -1 EndIf LDPhysics.SetJointMotor(FrontWheelJoint,1000*Sine,Math.abs((pjt * 100) + (pjs * 10))*2) rja = LDPhysics.GetAngle(Spar) - LDPhysics.GetAngle(Bike)+14 rjs = LDPhysics.GetRotation(Spar) - LDPhysics.GetRotation(Bike) If (rja * 5000) + (rjs * 100) < 0 Then Sine = 1 Else Sine = -1 EndIf LDPhysics.SetJointMotor(rearsparjoint,1000*Sine,Math.abs((rja * 5000) + (rjs * 1000))) EndWhile '============================================================================== '============================================================================== '============================================================================== '============================================================================== Sub AddBike GraphicsWindow.BrushColor = "#939393" GraphicsWindow.PenColor = "#D3D3D3" FrontWheel = Shapes.AddEllipse(100,100) LDShapes.Centre(FrontWheel,248,134) LDPhysics.AddMovingShape(FrontWheel,0.5,0.5,0.5) Point = "1=1\=105\;2\=133\;;2=1\=121\;2\=86\;;3=1\=208\;2\=49\;;4=1\=219\;2\=64\;;5=1\=185\;2\=123\;;" For i = 1 To Array.GetItemCount(Point) Points[i][1] = Point[i][1] Points[i][2] = Point[i][2] EndFor Bike = LDShapes.AddPolygon(Points) Points = "" Point = "1=1\=30\;2\=46\;;2=1\=116\;2\=95\;;3=1\=217\;2\=61\;;4=1\=199\;2\=25\;;" For i = 1 To Array.GetItemCount(Point) Points[i][1] = Point[i][1] Points[i][2] = Point[i][2] EndFor Bike2 = LDShapes.AddPolygon(Points) Points = "" Point = "1=1\=206\;2\=63\;;2=1\=248\;2\=141\;;3=1\=256\;2\=139\;;4=1\=191\;2\=8\;;5=1\=180\;2\=8\;;" For i = 1 To Array.GetItemCount(Point) Points[i][1] = Point[i][1] Points[i][2] = Point[i][2] EndFor Bike3 = LDShapes.AddPolygon(Points) Points = "" Point = "1=1\=215\;2\=56\;;2=1\=272\;2\=59\;;3=1\=273\;2\=65\;;4=1\=216\;2\=64\;;" For i = 1 To Array.GetItemCount(Point) Points[i][1] = Point[i][1] Points[i][2] = Point[i][2] EndFor Bike4 = LDShapes.AddPolygon(Points) LDPhysics.AddMovingShape(Bike,0.5,0.5,0.5) LDPhysics.AddMovingShape(Bike2,0.5,0.5,0.5) LDPhysics.AddMovingShape(Bike3,0.5,0.5,0.5) LDPhysics.AddMovingShape(Bike4,0.5,0.5,0.5) LDPhysics.GroupShapes(Bike2,Bike) LDPhysics.GroupShapes(Bike3,Bike) LDPhysics.GroupShapes(Bike4,Bike) LDPhysics.SetGroup(Bike,1,"1=0") LDPhysics.SetGroup(Bike2,2,"1=0") LDPhysics.SetGroup(Bike3,3,"1=0") LDPhysics.SetGroup(Bike4,4,"1=0") DistAncor = LDPhysics.AddMovingAnchor(193,26) LDPhysics.GroupShapes(DistAncor,Bike) RearWheel = Shapes.AddEllipse(100,100) LDShapes.Centre(RearWheel,49,141) LDPhysics.AddMovingShape(RearWheel,0.5,0.5,0.5) GraphicsWindow.BrushColor = "#545454" Points = "" Point = "1=1\=43\;2\=138\;;2=1\=81\;2\=116\;;3=1\=123\;2\=108\;;4=1\=130\;2\=117\;;5=1\=130\;2\=123\;;6=1\=116\;2\=130\;;7=1\=45\;2\=148\;;" For i = 1 To Array.GetItemCount(Point) Points[i][1] = Point[i][1] Points[i][2] = Point[i][2] EndFor Spar = LDShapes.AddPolygon(Points) LDPhysics.AddMovingShape(Spar,0.5,0.5,0.5) SparAncor = LDPhysics.AddMovingAnchor(122,119) LDPhysics.GroupShapes(Bike,SparAncor) Param[1] = -Math.GetRadians(2) Param[2] = Math.GetRadians(30) Param2[1] = LDMath.Cos(60) Param2[2] = LDMath.Sin(60) Param2[3] = -15 Param2[4] = 10 rearsparjoint = LDPhysics.AttachShapesWithJoint(SparAncor,Spar,"Revolute","False",Param) FrontWheelJoint = LDPhysics.AttachShapesWithJoint(Bike,FrontWheel,"Prismatic_V","False",Param2) LDPhysics.AttachShapesWithRotation(RearWheel,Spar) EndSub Sub Mouse Shape = LDShapes.GetAllShapesAt(GraphicsWindow.MouseX,GraphicsWindow.MouseY) MJoint = LDPhysics.AttachShapesWithJoint(Shape[1],Shape[1],"Mouse","False","") EndSub Sub MouseUp LDPhysics.DetachJoint(MJoint) EndSub End>XCG342.sb< Start>XCH114.sb< 'Challenge of the Month - December 2011 'Easy Challenge 2 'Get the Turtle to draw a Christmas tree or other festive shape (e.g. a star). gw = 722 gh = 800 GraphicsWindow.Left = (Desktop.Width-gw) /2 GraphicsWindow.Top = (Desktop.Height-gh) /2 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Title = "Xmas Tree Drawn by Turtle Object." GraphicsWindow.Hide() GraphicsWindow.BrushColor = "Black" Turtle.Speed = 10 GraphicsWindow.Show() center = gw / 2 Trunk() BottomOfLastBranch() FifthBranch() Sub Trunk 'Trunk For side = -1 To 1 Step 2 'This For Loop is to mirror the right side to the left side Turtle.X = -30 * side + center ' the * side will flip it to and from whatever side it is currently on to mirror it. The center has to be in this line of code to make the -30 count from the centre of the GraphicsWindow. Turtle.Y = 615 Turtle.Angle = 170 * side 'this line of code is to make the Turtle face down (but slightly left) Turtle.PenDown() For i = 1 To 90 'This For Loop is to make the first part of the trunk (first angle) Turtle.Move(3.2) Turtle.Turn(1.3 * side) EndFor For i = 1 To 70 ' This For Loop is to make the 2nd tighter loop in the trunk (2nd angle) Turtle.Move(2) Turtle.Turn(4 * side) EndFor EndFor Turtle.PenUp() Turtle.X = 260 Turtle.Y = 765 Turtle.Angle = 65 For i = 1 To 40 ' This For Loop is to draw the line at the bottom of the trunk (to join the 2 sides of the trunk together.) Turtle.PenDown() Turtle.Move(5) Turtle.Turn(1.2) EndFor Turtle.PenUp() EndSub Sub BottomOfLastBranch 'This is the very bottom line of the leaves For side = -1 To 1 Step 2 Turtle.X = center Turtle.Y = 615 Turtle.Angle = -90 * side Turtle.PenDown() For i = 1 To 65 Turtle.Move(2.5) Turtle.Turn(-0.4 * side) EndFor Turtle.PenUp() EndFor EndSub Sub FifthBranch GraphicsWindow.Show() Turtle.Show() For side = -1 To 1 Step 2 Turtle.X = -10 * side + center Turtle.Y = 485 Turtle.Angle = -150 * side Turtle.PenDown() For i = 1 To 30 Turtle.Move(10) Turtle.Turn(2 * side) EndFor EndFor EndSub End>XCH114.sb< Start>XCH497.sb< GraphicsWindow.Width=600 GraphicsWindow.Height=600 Money = 0 Bu = Controls.AddButton("Работать", 50, 50) Controls.SetSize(Bu, 100,30) Controls.ButtonClicked = Button Smoney = Shapes.AddText(Money) Shapes.Move(Smoney, 200, 50) Middle: Shapes.SetText(Smoney, Money) Sub Button IF Controls.LastClickedButton = Bu Then Money = Money + 1 EndIf EndSub End>XCH497.sb< Start>XCH698.sb< '' Easy challenge of the month entry: Convert Inches to Centimeters and '' Centimeters to Inches '' 1 inch = 2.54 Cm '' 1 centimeter = 0.393700787 inches '' Working on getting the entire background color to show up by using the .clear() TextWindow.Hide() TextWindow.Title = "Inch and Centimeter converter" TextWindow.BackgroundColor = "White" TextWindow.ForegroundColor = "Red" TextWindow.Show() TextWindow.Clear() Start() Sub Start TextWindow.WriteLine("Please Choose what you would like to do") TextWindow.WriteLine("1. Convert Inches to Centimeters.") TextWindow.WriteLine("2. Convert Centimeters to Inches") TextWindow.WriteLine("3. Stop the Program.") GetChoice() EndSub ''My way of dealing with forcing the user to use the options I gave them. Probably better ways :) ''But Im still learning. Sub GetChoice Choice = TextWindow.Read() If Choice = "1" Then ConvertToCM() Elseif Choice = "2" then ConvertToInch() Elseif Choice = "3" then Program.End() Else TextWindow.WriteLine("Please choose 1, 2, or 3") TextWindow.PauseWithoutMessage() TextWindow.Clear() Start() EndIf EndSub Sub ConvertToCM TextWindow.Clear() TextWindow.WriteLine("Please enter the Inches Measurement.") getIn = TextWindow.Read() cm = getIn / 2.5 TextWindow.Write(getIn +" Inches = "+ cm + " Centimeters") TextWindow.PauseWithoutMessage() TextWindow.Clear() Start() EndSub Sub ConvertToInch TextWindow.Clear() TextWindow.WriteLine("Please enter the Centimeters measurement.") getCM = TextWindow.Read() in = getCM * 2.5 TextWindow.Write(getCM + " Centimeters = " + in + " Inches") TextWindow.PauseWithoutMessage() TextWindow.Clear() Start() EndSub End>XCH698.sb< Start>XCL270.sb< GraphicsWindow.Title="Shapes3 (beta V0.3) GraphicsWindow.BackgroundColor="tan args=0 dffs() ssh="x LDShapes.ShapeEvent = see GraphicsWindow.MouseDown = mmm GraphicsWindow.MouseMove = mww GraphicsWindow.MouseUp = muu LDEvents.MouseWheel = mwwl LDUtilities.ShowNoShapeErrors="false lss="" LDList.Add(lss "NewDrwng") ldrw() GraphicsWindow.Width=1050 GraphicsWindow.Height=800 While 1=1'-----------------------mainloop---------------------------------- If cmd="opn" Then fff=LDDialogs.OpenFile("Sb|*.sb|SVG|*.svg|Nonki's shapes|*.nsh|HTML|*.htm;*.html|All|*.*" "e:/") If fff="" Then ElseIf Text.IsSubText(Text.ConvertToLowerCase(fff) ".nsh") Then ' The following line could be harmful and has been automatically commented. ' buf1 = File.ReadContents(fff) If Text.StartsWith(buf1 "!") Then '----cmprss mode File bf2=LDText.Split(buf1 cr+lf) spp="|" for lm=1 to Array.GetItemCount(bf2) if Text.StartsWith(bf2[lm] "!") Then qq=LDText.Split(bf2[lm] " ") buf1=LDText.Replace(buf1 qq[2] qq[3]) ElseIf Text.StartsWith(bf2[lm] "$") Then shape=LDText.Split(buf1 Text.GetSubText(bf2[lm] 3 1)) EndIf EndFor 'shape=LDText.Split(buf1 spp) n1=2 Else'----------------------------------normal mode file n1=1 buf2=LDText.Split(buf1 ";"+qt+cr+lf) 'TextWindow.WriteLine(buf2[1]) shape="" For ww=1 To Array.GetItemCount(buf2) bb=LDText.Split(buf2[ww] "] = "+qt) shape[ww]= bb[2] 'TextWindow.WriteLine(buf[ww]) EndFor EndIf scale=1 iMin=n1 iMax=Array.GetItemCount(shape) ' TextWindow.WriteLine(buf) GraphicsWindow.ShowMessage("objs:"+imax+cr+"click insert point (top+left)" "Shapes3") inss="false mins="true While not[inss] Program.Delay(1) EndWhile mins="false Shapes_Add() ElseIf Text.IsSubText(Text.ConvertToLowerCase(fff) ".svg") Then ' The following line could be harmful and has been automatically commented. ' buf = File.ReadContents(fff) Parse_SVG() Shapes_Add() EndIf cmd="" ElseIf cmd="sav" Then fff=LDDialogs.SaveFile("SVG|*.svg|Sb|*.sb|Nonki's shapes|*.nsh|HTML|*.htm;*.html|All|*.*" "e:/") If fff="" Then ElseIf Text.IsSubText(Text.ConvertToLowerCase(fff) ".svg") Then GenerateSVG() ' The following line could be harmful and has been automatically commented. ' File.WriteContents(fff, buf) EndIf cmd="" EndIf Program.Delay(1) EndWhile sub ldrw Controls.Remove(lsb) GraphicsWindow.BrushColor="darkblue lsb=LDControls.AddListBox(lss 550 800) Controls.Move(lsb 900 0) EndSub Sub mwwl If Mouse.IsRightButtonDown Then aaa[ssh]=aaa[ssh]+LDEvents.LastMouseWheelDelta*3 Shapes.Rotate(ssh aaa[ssh]) Else zz[ssh]=zz[ssh]+LDEvents.LastMouseWheelDelta/20 Shapes.Zoom(ssh zz[ssh] zz[ssh]) EndIf EndSub Sub muu lsh=ssh ssh="x" inss="true shX=GraphicsWindow.MouseX shY=GraphicsWindow.MouseY 'GraphicsWindow.Title=lsh EndSub Sub mww If Mouse.IsLeftButtonDown and GraphicsWindow.MouseY>25 Then If ssh="x" Then Else ldShapes.Centre(ssh GraphicsWindow.MouseX GraphicsWindow.MouseY) EndIf EndIf EndSub Sub mmm If ssh="x" Then Else ldShapes.Centre(ssh GraphicsWindow.MouseX GraphicsWindow.MouseY) EndIf EndSub Sub see If LDShapes.LastEventType="MouseDown" Then ssh=LDShapes.LastEventShape EndIf EndSub Sub dffs p50=30 DIGIT = "0123456789" buf="" Not = "False=True;True=False WQ = Text.GetCharacter(34) qt = WQ CR = Text.GetCharacter(13) LF = Text.GetCharacter(10) LT = "<" tt=Text.GetCharacter(9) pcolor="black bcolor="white pwidth=1.5 mnn["File"]="Main" mnn["New"]="File mnn["---"]="File mnn["Open ..."]="File mnn["Save"]="File mnn["Save As ..."]="File mnn["Import ..."]="File mnn["Make HTML..."]="file mnn["-"]="File mnn["Exit"]="File url = "D:\yotta\MySmallBasic\MySmallBasic\Sample\Shapes-master\img/" fffc="" imm=ImageList.LoadImage(url+"open.png") icc["Open ..."]=imm imm=ImageList.LoadImage(url+"save.png") icc["Save"]=imm icc["Save As ..."]=imm imm=ImageList.LoadImage(url+"open.png") icc["Import ..."]=imm mnn["Edit"]="Main" cpy="Copy"+tt+tt+"^C" mnn[cpy]="edit" imm=ImageList.LoadImage(url+"copy.png") icc[cpy]=imm mnn["Cut"+tt+tt+"Delete"]="edit" imm=ImageList.LoadImage(url+"cut.png") icc["cut"+tt+tt+"delete"]=imm pst="Paste"+tt+tt+"^V" mnn[pst]="edit" imm=ImageList.LoadImage(url+"paste.png") icc[pst]=imm dpp="Duplicate"+tt+"^D" mnn[dpp]="edit" imm=ImageList.LoadImage(url+"copy.png") icc[dpp]=imm li=ImageList.LoadImage("e:\shpp.png") ll=LDImage.SplitImage(li 8 3) ' GraphicsWindow.DrawImage(ll[1][1] 30 30) mnn["--"]="edit" mnn["Grid"+tt+tt+"^G"]="edit" mnn["Draw"]="main lnn="Line"+tt+tt+"^L" mnn[lnn]="draw icc[lnn]= ll[5][1] ddd="Curve"+tt+tt+"^U" mnn[ddd]="draw icc[ddd]=ll[8][1] ddd="Triangle"+tt+"^A" mnn[ddd]="draw icc[ddd]=ll[7][1] ddd="Rectangle"+tt+"^R" mnn[ddd]="draw icc[ddd]=ll[1][1] ddd="Ellipse"+tt+tt+"^E" fffc["elli"]="ell mnn[ddd]="draw icc[ddd]=ll[2][1] ddd="Circle"+tt+tt+"^I" mnn[ddd]="draw icc[ddd]=ll[3][1] ddd="Polygon"+tt+"^P" mnn[ddd]="draw icc[ddd]=ll[6][1] ddd="Reg.Polyg"+tt+"^Y" mnn[ddd]="draw icc[ddd]=ll[2][1] ddd="Text"+tt+tt+"^T" mnn[ddd]="draw icc[ddd]=ll[4][1] mnn["----"]="draw mnn["Shaded"]="draw mnn["Shape"]="main mnn["Star5"]="Shape icc["star5"]=ll[7][2] mnn["Star6"]="Shape icc["star6"]=ll[8][2] mnn["Arrow"]="Shape icc["arrow"]=ll[1][3] mnn["Baloon"]="Shape icc["baloon"]=ll[8][3] mnn["Image"]="Shape mnn["Sphere"]="Shape mnn["Cone"]="Shape mnn["Pyramid"]="Shape mnn["Cube"]="Shape mnn["Pipe"]="Shape mnn=LDText.Replace(mnn "^" "Ctrl+") icc=LDText.Replace(icc "^" "Ctrl+") LDControls.AddMenu(1600 20 mnn icc "") LDControls.MenuClicked=mnncl rmm=LDText.Split("Outline clr!Outline pen!Fill clr!Gradient!BgColor!BgImage!New Drawing!Shadow!Size_X!Size_Y!Unzoom!UnRot" "!") LDDialogs.AddRightClickMenu(rmm "") LDDialogs.RightClickMenu=rcc EndSub Sub rcc'-----------------------------rightclickmenu---------- ll=LDDialogs.LastRightClickMenuItem If ll=2 Then pwidth=FCDialogs.AskForTextLine("Width:") LDShapes.PenWidth(lsh pwidth) ElseIf ll=7 Then ccd=LDDialogs.Confirm("Ok to clear all?" "Shapes") If ccd="Yes" Then rsst="true EndIf ElseIf ll=8 Then LDEffect.DropShadow(lsh "") LDList.Add(lss lsh+"/Shdw") ldrw() ElseIf ll=1 Then pcolor= LDDialogs.Colour() LDShapes.PenColour(lsh pcolor) LDList.Add(lss lsh+"/pclr:"+pcolor) ldrw() ElseIf ll=9 Then ss=FCDialogs.AskForTextLine("SizeX:") LDShapes.SetSize(lsh ss LDShapes.Height(lsh)) ElseIf ll=10 Then ss=FCDialogs.AskForTextLine("SizeY:") LDShapes.SetSize(lsh LDShapes.Width(lsh) ss) ElseIf ll=11 Then zz[lsh]=1 Shapes.Zoom(lsh 1 1) ElseIf ll=3 Then bcolor= LDDialogs.Colour() LDShapes.BrushColour(lsh bcolor) LDList.Add(lss lsh+"/bclr:"+bcolor) ldrw() ElseIf ll=4 Then cl[1]= LDDialogs.Colour() cl[2]= LDDialogs.Colour() LDGraphicsWindow.BackgroundBrush( LDShapes.BrushGradient(cl "DD")) ElseIf ll=5 Then GraphicsWindow.BackgroundColor= LDDialogs.Colour() LDList.Add(lss "Bg/clr:"+GraphicsWindow.BackgroundColor) ldrw() ElseIf ll=6 Then fff=LDDialogs.OpenFile("1=png;2=jpg;3=bmp" "e:/") ldGraphicsWindow.BackgroundImage(imagelist.LoadImage(fff)) LDList.Add(lss "Bg/img:"+fff) ldrw() EndIf EndSub Sub mnncl'---------------------------menu click routine--------------------------- ll=LDControls.LastMenuItem If Text.StartsWith(ll "Bal") Then tt=FCDialogs.AskForTextLine("txt:") GraphicsWindow.BrushColor=bcolor GraphicsWindow.PenColor=pcolor GraphicsWindow.PenWidth=pwidth ff=LDFigures.AddCallout(100 50 tt "Cloud" "x=0;y=1.25") LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf Text.StartsWith(ll "Open") Then cmd="opn" ElseIf (ll= "Save") Then cmd="sav" ElseIf (ll="Star5") Then ff=LDShapes.AddStar(5 20 45) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf (ll="Star6") Then ff=LDShapes.AddStar(6 20 45) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf Text.StartsWith(ll "Ell") Then ff=Shapes.AddEllipse(100 50) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) ElseIf Text.StartsWith(ll "Rect") Then ff=Shapes.AddRectangle(100 50) LDShapes.SetShapeEvent(ff) zz[ff]=1 Shapes.Move(ff 0 50) EndIf EndSub Sub Parse_SVG ' param buf - SVG buffer scale = 1 iMin = nShapes + 1 iMax = nShapes p = 1 Parse_Header() Parse_Space() ' Parse_Defs() match="true While match Parse_Space() Parse_Rect() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf If Not[match] Then Parse_Ellipse() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf EndIf If Not[match] Then Parse_Polygon() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf EndIf If Not[match] Then Parse_Line() If match Then iMax = iMax + 1 shape[iMax] = shp EndIf EndIf EndWhile nShapes = iMax Parse_Use() EndSub Sub Parse_Line match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "line") Then param = "tag=line;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() Parse_SetStyle() points = attr["x1"] + "," + attr["y1"] + " " + attr["x2"] + "," + attr["y2"] Parse_Points() shp = "" shp["func"] = "line" shp["x"] = x shp["y"] = y+p50 shp["width"] = width shp["height"] = height shp["x1"] = px[1] - x shp["y1"] = py[1] - y shp["x2"] = px[2] - x shp["y2"] = py[2] - y shp["pw"] = pw shp["pc"] = pc match = "True" EndIf EndSub Sub Parse_Rect match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "rect") Then param = "tag=rect;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() x = attr["x"] y = attr["y"] width = attr["width"] height = attr["height"] Parse_SetStyle() Parse_Angle() shp = "" shp["func"] = "rect" shp["x"] = x - Math.Floor(pw / 2) shp["y"] = y - Math.Floor(pw / 2)+p50 shp["width"] = width + pw shp["height"] = height + pw shp["angle"] = angle shp["pw"] = pw shp["pc"] = pc shp["bc"] = bc match = "True" EndIf EndSub Sub Parse_Polygon match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "polygon") Then param = "tag=polygon;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() points = attr["points"] Parse_Points() Parse_SetStyle() Parse_Angle() shp = "" shp["func"] = "tri" shp["x"] = x shp["y"] = y+p50 shp["width"] = width shp["height"] = height shp["angle"] = angle shp["x1"] = px[1] - x shp["y1"] = py[1] - y shp["x2"] = px[2] - x shp["y2"] = py[2] - y shp["x3"] = px[3] - x shp["y3"] = py[3] - y shp["pw"] = pw shp["pc"] = pc shp["bc"] = bc match = "True" EndIf EndSub Sub Parse_Points len = Text.GetLength(points) px = "" py = "" nPoints = 1 For pPoints = 1 To len c = Text.GetSubText(points, pPoints, 1) While (pPoints <= len) And Text.IsSubText(DIGIT, c) px[nPoints] = Text.Append(px[nPoints], c) pPoints = pPoints + 1 c = Text.GetSubText(points, pPoints, 1) EndWhile If c = "," Then pPoints = pPoints + 1 c = Text.GetSubText(points, pPoints, 1) EndIf While (pPoints <= len) And Text.IsSubText(DIGIT, c) py[nPoints] = Text.Append(py[nPoints], c) pPoints = pPoints + 1 c = Text.GetSubText(points, pPoints, 1) EndWhile If nPoints = 1 Then xmin = px[1] ymin = py[1] xmax = px[1] ymax = py[1] Else If px[nPoints] < xmin Then xmin = px[nPoints] EndIf If py[nPoints] < ymin Then ymin = py[nPoints] EndIf If xmax < px[nPoints] Then xmax = px[nPoints] EndIf If ymax < py[nPoints] Then ymax = py[nPoints] EndIf EndIf If c = " " Then nPoints = nPoints + 1 EndIf EndFor x = xmin y = ymin width = xmax - xmin height = ymax - ymin EndSub Sub Parse_Angle angle = "" If attr["transform"] <> "" Then pAngle = 8 lAngle = Text.GetIndexOf(Text.GetSubTextToEnd(attr["transform"], pAngle), " ") - 1 angle = Text.GetSubText(attr["transform"], pAngle, lAngle) EndIf EndSub Sub Parse_Ellipse match = "False" If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "ellipse") Then param = "tag=ellipse;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() cx = attr["cx"] cy = attr["cy"] rx = attr["rx"] ry = attr["ry"] Parse_SetStyle() Parse_Angle() shp = "" shp["func"] = "ell" shp["x"] = cx - rx - Math.Floor(pw / 2) shp["y"] = cy - ry - Math.Floor(pw / 2)+p50 shp["width"] = 2 * rx + pw shp["height"] = 2 * ry + pw shp["angle"] = angle shp["pw"] = pw shp["pc"] = pc shp["bc"] = bc match = "True" EndIf EndSub Sub Parse_FindTag pSave = p tag = "" findNext = "True" While findNext findNext = "False" ' tag may be not found pTag = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), LT + param["tag"]) If 0 < pTag Then lTag = Text.GetLength(param["tag"]) + 1 pTag = p + pTag - 1 len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, pTag), "/" + param["tag"] + ">") If len = 0 Then lTag = 1 len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, pTag), "/>") EndIf If param["class"] = "" Then len = len + lTag tag = Text.GetSubText(buf, pTag, len) findNext = "False" ' found the tag ElseIf 0 < len Then findNext = "True" ' tag may have different class len = len + lTag attr = "class=" + qt + param["class"] + qt pAttr = pTag + lTag + 1 lAttr = Text.GetLength(attr) If Text.GetSubText(buf, pAttr, lAttr) = attr Then tag = Text.GetSubText(buf, pTag, len) findNext = "False" ' found the tag EndIf EndIf p = pTag + len EndIf EndWhile If tag = "" Then p = pSave EndIf EndSub Sub Parse_GetAttrAndText pTag = Text.GetIndexOf(tag, " ") + 1 pEnd = Text.GetIndexOf(tag, ">") attr = "" While pTag <= pEnd Parse_SkipSpaceInTag() pEq = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), "=") If 0 < pEq Then pEq = pTag + pEq - 1 If Text.GetSubText(tag, pEq + 1, 1) = qt Then pQ = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pEq + 2), qt) If 0 < pQ Then pQ = pEq + 2 + pQ - 1 attr[Text.GetSubText(tag, pTag, pEq - pTag)] = Text.GetSubText(tag, pEq + 2, pQ - pEq - 2) pTag = pQ + 2 EndIf EndIf Else pTag = pEnd + 1 EndIf EndWhile If pEnd + 1 < pTag Then pTag = pEnd + 1 EndIf len = Text.GetLength(tag) txt = "" While pTag <= len pL = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), LT) If pL = 0 Then txt = Text.Append(txt, Text.GetSubTextToEnd(tag, pTag)) pTag = len + 1 Else pL = pTag + pL - 1 txt = Text.Append(txt, Text.GetSubText(tag, pTag, pL - pTag)) pR = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), ">") If 0 < pR Then pTag = pTag + pR Else pTag = len + 1 EndIf EndIf EndWhile EndSub Sub Parse_GetStyleAttr pKw = Text.GetIndexOf(Text.GetSubTextToEnd(attr["style"], pStyle), kw) If pKw = 0 Then value = "" Else pValue = pStyle + pKw + Text.GetLength(kw) pColon = Text.GetIndexOf(Text.GetSubTextToEnd(attr["style"], pValue), ";") If pColon = 0 Then pColon = Text.GetLength(kw) + 1 EndIf value = Text.GetSubText(attr["style"], pValue, pColon - 1) EndIf EndSub Sub Parse_Header If Text.StartsWith(Text.GetSubTextToEnd(buf, p), LT + "svg") Then len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), ">") If 0 < len Then tag = Text.GetSubText(buf, p, len) Parse_GetAttrAndText() wi = attr["viewbox"] aaa=ldtext.Split(wi " ") width=aaa[3]-aaa[1] height = aaa[4]-aaa[2] GraphicsWindow.ShowMessage(width+":"+height "svg") p = p + len match = "True" EndIf EndIf EndSub Sub Parse_Space isSpace = "True" While isSpace char = Text.GetSubText(buf, p, 1) If Text.IsSubText(" " + CR + LF, char) Then p = p + 1 Else isSpace = "False" EndIf EndWhile EndSub Sub Parse_SetStyle pStyle = 1 kw = "fill" Parse_GetStyleAttr() bc = Text.ConvertToUpperCase(value) kw = "stroke" Parse_GetStyleAttr() pc = Text.ConvertToUpperCase(value) kw = "stroke-width" Parse_GetStyleAttr() pw = value EndSub Sub Parse_Use param = "tag=use;" Parse_FindTag() ' p is updated Parse_GetAttrAndText() shX = 0 shY = 0 For i = iMin To iMax shp = shape[i] shp["x"] = shp["x"] + attr["x"] shp["y"] = shp["y"] + attr["y"] If shp["func"] = "tri" And (shp["y2"] < shp["y1"]) Then shp["y2"] = shp["y1"] shp["y1"] = shp["y3"] shp["y3"] = shp["y2"] shp["angle"] = shp["angle"] + 180 If 360 <= shp["angle"] Then shp["angle"] = shp["angle"] - 360 EndIf EndIf If shp["pc"] <> "" Then color = shp["pc"] ' CS_AddColorToPalette() EndIf If shp["bc"] <> "" Then color = shp["bc"] ' CS_AddColorToPalette() EndIf shape[i] = shp CalcDetectBorder() EndFor EndSub Sub Parse_SkipSpaceInTag isSpace = "True" While isSpace char = Text.GetSubText(tag, pTag, 1) If Text.IsSubText(" " + CR + LF, char) Then pTag = pTag + 1 Else isSpace = "False" EndIf EndWhile EndSub Sub CalcDetectBorder ' param i - index of shapes shp = shape[i] If shp["func"] = "line" Then ' line x = shp["x2"] - shp["x1"] y = shp["y2"] - shp["y1"] rr=LDMath.Convert2Radial(shp["x1"] shp["y1"] shp["x2"] shp["y2"]) aa=rr[2] If 180 <= a Then a = a - 180 EndIf shp["angle"] = a len = rr[1] shp["_x0"] = Math.Floor(cx - len / 2) shp["_x1"] = Math.Floor(cx + len / 2) shp["_y0"] = cy - 4 shp["_y1"] = cy + 4 Else ' rectangle, ellipse or triangle If shp["func"] = "tri" Then ' triangle shp["width"] = shp["x3"] shp["height"] = shp["y2"] EndIf shp["_x0"] = shp["x"] shp["_y0"] = shp["y"] shp["_x1"] = shp["x"] + shp["width"] shp["_y1"] = shp["y"] + shp["height"] EndIf shape[i] = shp EndSub sub fxxn qa=args[1] qb=args[2] qc=Math.Floor(qa) qd=4-Text.GetLength(qc) qe=text.GetSubText("____" 1 qd) return=qe+LDMath.FixDecimal(qa qb) EndSub Sub Shapes_Add Shapes_CalcWidthAndHeight() s = scale ttt=Text.GetCharacter(9) For i = iMin To iMax shp = shape[i] GraphicsWindow.PenWidth = shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor = shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["func"]) Then GraphicsWindow.BrushColor = shp["bc"] EndIf x = shp["x"] y = shp["y"] If shp["func"] = "rect" Then shp["obj"] = Shapes.AddRectangle(shp["width"] * s, shp["height"] * s) LDList.Add(lss "Rct"+ttt+"/wh:"+ldcall.function2("fxxn" shp["width"]*s 2)+":"+ldcall.function2("fxxn" shp["height"]*s 2)+ttt+"/xy:"+ldcall.function2("fxxn" shX + x * s 2)+":"+ldcall.function2("fxxn" shY + y * s 2)+ttt+ttt+"|"+shp["obj"] ) ElseIf shp["func"] = "ell" Then shp["obj"] = Shapes.AddEllipse(shp["width"] * s, shp["height"] * s) LDList.Add(lss "Ell"+ttt+"/wh:"+ldcall.function2("fxxn" shp["width"]*s 2)+":"+ldcall.function2("fxxn" shp["height"]*s 2)+ttt+"/xy:"+ldcall.function2("fxxn" shX + x * s 2)+":"+ldcall.function2("fxxn" shY + y * s 2)+ttt+ttt+"|"+shp["obj"] ) ElseIf shp["func"] = "bll" Then shp["obj"] = LDFigures.AddCallout(shp["width"]*s, shp["height"]*s "" "Cloud" "x=0;y=1.25") ElseIf shp["func"] = "tri" Then shp["obj"] = Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["func"] = "line" Then shp["obj"] = Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) ElseIf shp["func"] = "text" Then fs = shp["fs"] GraphicsWindow.FontSize = fs * s GraphicsWindow.FontName = shp["fn"] shp["obj"] = Shapes.AddText(shp["text"]) EndIf ldShapes.SetShapeEvent( shp["obj"]) shp["rx"] = x shp["ry"] = y Shapes.Move(shp["obj"], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri|text", shp["func"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then 'Shapes.Rotate(shp["obj"], shp["angle"]) ccx=LDShapes.GetLeft(shp["obj"])+LDShapes.Width(shp["obj"])/2 ccy=LDShapes.GetTop(shp["obj"])+LDShapes.Height(shp["obj"])/2 LDShapes.RotateAbout(shp["obj"],ccx ccy shp["angle"]) EndIf shape[i] = shp EndFor shAngle = 0 ldrw() EndSub Sub Shapes_CalcRotatePos _cx = param["x"] + param["width"] / 2 _cy = param["y"] + param["height"] / 2 rr=LDMath.Convert2Radial( param["cx"] param["cy"] _cx _cy) a=rr[2] r=rr[1] a = a + param["angle"] x = r * Math.Cos(a * Math.Pi / 180) y = r * Math.Sin(a * Math.Pi / 180) _cx = x + param["cx"] _cy = y + param["cy"] x = _cx - param["width"] / 2 y = _cy - param["height"] / 2 EndSub Sub Shapes_CalcWidthAndHeight For i = iMin To iMax shp = shape[i] If shp["func"] = "tri" Or shp["func"] = "line" Then xmin = shp["x1"] xmax = shp["x1"] ymin = shp["y1"] ymax = shp["y1"] If shp["x2"] < xmin Then xmin = shp["x2"] EndIf If xmax < shp["x2"] Then xmax = shp["x2"] EndIf If shp["y2"] < ymin Then ymin = shp["y2"] EndIf If ymax < shp["y2"] Then ymax = shp["y2"] EndIf If shp["func"] = "tri" Then If shp["x3"] < xmin Then xmin = shp["x3"] EndIf If xmax < shp["x3"] Then xmax = shp["x3"] EndIf If shp["y3"] < ymin Then ymin = shp["y3"] EndIf If ymax < shp["y3"] Then ymax = shp["y3"] EndIf EndIf shp["width"] = xmax - xmin shp["height"] = ymax - ymin EndIf If i = 1 Then shWidth = shp["x"] + shp["width"] shHeight = shp["y"] + shp["height"] Else If shWidth < shp["x"] + shp["width"] Then shWidth = shp["x"] + shp["width"] EndIf If shHeight < shp["y"] + shp["height"] Then shHeight = shp["y"] + shp["height"] EndIf EndIf shape[i] = shp EndFor EndSub Sub Shapes_Move Stack.PushValue("local", i) s = scale shX = x shY = y For i = iMin To iMax shp = shape[i] _x = shp["rx"] _y = shp["ry"] Shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Remove Stack.PushValue("local", i) For i = iMin To iMax shp = shape[i] Shapes.Remove(shp["obj"]) EndFor i = Stack.PopValue("local") EndSub Sub Shapes_Rotate s = scale param["angle"] = angle If cx <> "" Then param["cx"] = cx Else cx = "" ' to avoid syntax error param["cx"] = shWidth / 2 EndIf If cy <> "" Then param["cy"] = cy Else cy = "" ' to avoid syntax error param["cy"] = shHeight / 2 EndIf For i = iMin To iMax shp = shape[i] param["x"] = shp["x"] param["y"] = shp["y"] param["width"] = shp["width"] param["height"] = shp["height"] Shapes_CalcRotatePos() shp["rx"] = x shp["ry"] = y Shapes.Move(shp["obj"], shX + x * s, shY + y * s) Shapes.Rotate(shp["obj"], angle + shp["angle"]) shape[i] = shp EndFor EndSub Sub GenerateSVG sp[4] = " " sp[6] = " " sp[8] = " " buf =LDText.Replace("" "'" wq)+cr+lf If nShapes > 0 Then shp = shape[1] xmin = shp["x"] ymin = shp["y"] xmax = shp["x"] ymax = shp["y"] EndIf For i = 2 To nShapes shp = shape[i] If shp["x"] < xmin Then xmin = shp["x"] EndIf If shp["y"] < ymin Then ymin = shp["y"] EndIf If xmax < shp["x"] Then xmax = shp["x"] EndIf If ymax < shp["y"] Then ymax = shp["y"] EndIf EndFor For i = 1 To nShapes shp = shape[i] If shp["func"] = "rect" Then buf = buf + sp[6] + LT + "rect " buf = buf + "x=" + WQ + Math.Floor(shp["x"] + shp["pw"] / 2 - xmin) + WQ + " " buf = buf + "y=" + WQ + Math.Floor(shp["y"] + shp["pw"] / 2 - ymin) + WQ + " " buf = buf + "width=" + WQ + (shp["width"] - shp["pw"]) + WQ + " " buf = buf + "height=" + WQ + (shp["height"] - shp["pw"]) + WQ + " " If shp["angle"] <> 0 And shp["angle"] <> "" Then buf = buf + CR + LF + sp[8] buf = buf + "transform=" + WQ + "rotate(" + shp["angle"] + " " buf = buf + Math.Floor(shp["width"] / 2 + shp["x"] - xmin) + " " buf = buf + Math.Floor(shp["height"] / 2 + shp["y"] - ymin) + ")" + WQ + " " EndIf buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ + "fill:" + Text.ConvertToLowerCase(shp["bc"]) + ";" ElseIf shp["func"] = "ell" Then buf = buf + sp[6] + LT + "ellipse " cx = Math.Floor(shp["width"] / 2 + shp["x"] - xmin) cy = Math.Floor(shp["height"] / 2 + shp["y"] - ymin) rx = Math.Floor((shp["width"] - shp["pw"]) / 2) ry = Math.Floor((shp["height"] - shp["pw"]) / 2) buf = buf + "cx=" + WQ + cx + WQ + " " buf = buf + "cy=" + WQ + cy + WQ + " " buf = buf + "rx=" + WQ + rx + WQ + " " buf = buf + "ry=" + WQ + ry + WQ + " " If shp["angle"] <> 0 And shp["angle"] <> "" Then buf = buf + CR + LF + sp[8] buf = buf + "transform=" + WQ + "rotate(" + shp["angle"] + " " buf = buf + cx + " " buf = buf + cy + ")" + WQ + " " EndIf buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ + "fill:" + Text.ConvertToLowerCase(shp["bc"]) + ";" ElseIf shp["func"] = "tri" Then buf = buf + sp[6] + LT + "polygon points=" + WQ buf = buf + (shp["x1"] + shp["x"] - xmin) + "," buf = buf + (shp["y1"] + shp["y"] - ymin) + " " buf = buf + (shp["x2"] + shp["x"] - xmin) + "," buf = buf + (shp["y2"] + shp["y"] - ymin) + " " buf = buf + (shp["x3"] + shp["x"] - xmin) + "," buf = buf + (shp["y3"] + shp["y"] - ymin) + WQ + " " If shp["angle"] <> 0 And shp["angle"] <> "" Then buf = buf + CR + LF + sp[8] buf = buf + "transform=" + WQ + "rotate(" + shp["angle"] + " " buf = buf + (shp["x1"] + shp["x"] - xmin) + " " buf = buf + Math.Floor((shp["y2"] - shp["y1"]) / 2 + shp["y"] - ymin) + ")" + WQ + " " EndIf buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ + "fill:" + Text.ConvertToLowerCase(shp["bc"]) + ";" ElseIf shp["func"] = "line" Then buf = buf + sp[6] + LT + "line " buf = buf + "x1=" + WQ + (shp["x1"] + shp["x"] - xmin) + WQ + " " buf = buf + "y1=" + WQ + (shp["y1"] + shp["y"] - ymin) + WQ + " " buf = buf + "x2=" + WQ + (shp["x2"] + shp["x"] - xmin) + WQ + " " buf = buf + "y2=" + WQ + (shp["y2"] + shp["y"] - ymin) + WQ + " " buf = buf + CR + LF + sp[8] buf = buf + "style=" + WQ EndIf If shp["pw"] > 0 Then buf = buf + "stroke:" + Text.ConvertToLowerCase(shp["pc"]) + ";" EndIf buf = buf + "stroke-width:" + shp["pw"] + WQ + "/>" + CR + LF EndFor buf = buf + cr+lf+ "" EndSub End>XCL270.sb< Start>XCL434-0.sb< 'Circling Marquee - Rotating letters around a center point with compensating letter rotation to keep letters pointing towards center -- Compliments of codingCat aka Matthew L. Parets - No rights resevered as long as no money is earned GraphicsWindow.Title ="Rotator message = "Lorem ipsum dolor magna sit ament adipscing tll=text.GetLength (message) spcJmp = 6 'Angle jump for spaces (spaces do not take up the same space as letters) radious = 275 'Size of the circle angleOffset = 90 'Angle rotation past vertical to start the first letter (90 = all letters point towards the center) rotationSpeed = 2 'Angle change between steps in rotation GraphicsWindow.FontSize = 40 GraphicsWindow.FontBold = "True" GraphicsWindow.BackgroundColor = "darkblue GraphicsWindow.BrushColor = "yellow GraphicsWindow.Width = 700 GraphicsWindow.Height = 700 GraphicsWindow.Show() '--- Everything from this point is calculated -------------------------------------------------- CountSpaces() 'How many spaces are their between letters barCnt = Text.GetLength(message) - spcCnt 'Number of letters to create shapes from angleStep = (360 - (spcCnt * spcJmp)) / barCnt 'Amount of space (angle count) between letters CreateLetterShapes() 'One shape per letter, no shapes for the spaces centerx = GraphicsWindow.Width/2 - 15 'Find the center of the circle - offset will need to be nudged with different sized letters centery = GraphicsWindow.Height/2 - 20 pos = 1 'Start with the first letter framestart = Clock.ElapsedMilliseconds 'Start the clock Timer.Tick=whh Timer.Interval=66 Sub whh 'Update position around the circle For t=1 To tll angle[pos] = angle[pos] + rotationSpeed angle[pos] = Math.Remainder(angle[pos],360) 'calcuate x/y based on angle around the circle radAngle = (angle[pos]) x = ldMath.Cos(radAngle) * radious + centerx y = ldMath.Sin(radAngle) * radious + centery Shapes.Rotate(bar[pos],angle[pos] + angleOffset) 'Rotate to match position ldShapes.Centre (bar[pos],x,y) 'Change the position if math.Remainder (tt,550)=0 then LDShapes.AnimateZoom (bar[pos] 500 2 2 2) Endif tt=tt+55 pos = pos + 1 ' Next letter please If pos > barCnt Then 'Reached the end? start over pos = 1 EndIf endfor Endsub Sub CountSpaces spcCnt = 0 For i = 1 to Text.GetLength(message) If Text.GetSubText(message,i,1) = " " Then spcCnt = spcCnt + 1 EndIf endfor EndSub Sub CreateLetterShapes baseAngle = 1 pos = 1 For i = 1 To Text.GetLength(message) If Text.GetSubText(message,i,1) <> " " then 'If its not a space baseAngle = baseAngle + angleStep 'update the angle to match its position around the circle bar[pos] = Shapes.AddText(Text.GetSubText(message,i,1)) 'Create the letter as a shape angle[pos] = baseAngle 'Store the shapes angle radAngle =(angle[pos]) 'Calculate its position around the circle based on the angle x = ldMath.Cos(radAngle) * radious + centerx y = ldMath.Sin(radAngle) * radious + centery Shapes.Rotate(bar[pos],angle[pos]) 'Rotate the shape to match Shapes.Move(bar[pos],x,y) 'Place the shape on the circle pos = pos + 1 'Next letter please Else baseAngle = baseAngle + spcJmp 'Don't create a shape if it's a space - Micro adjust space for space EndIf EndFor EndSub End>XCL434-0.sb< Start>XCL434.sb< 'Circling Marquee - Rotating letters around a center point with compensating letter rotation to keep letters pointing towards center -- Compliments of codingCat aka Matthew L. Parets - No rights resevered as long as no money is earned 'The message to be displayed message = "To Understand Recurson One Must First Undestand Recursion " spcJmp = 6 'Angle jump for spaces (spaces do not take up the same space as letters) radious = 275 'Size of the circle angleOffset = 90 'Angle rotation past vertical to start the first letter (90 = all letters point towards the center) rotationSpeed = 0.125 'Angle change between steps in rotation frameLength = 45 'Number of milleseconds between animation frames 'The look and feel of the letters GraphicsWindow.FontSize = 40 GraphicsWindow.FontBold = "True" GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "White" GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 GraphicsWindow.Show() '--- Everything from this point is calculated -------------------------------------------------- CountSpaces() 'How many spaces are their between letters barCnt = Text.GetLength(message) - spcCnt 'Number of letters to create shapes from angleStep = (360 - (spcCnt * spcJmp)) / barCnt 'Amount of space (angle count) between letters CreateLetterShapes() 'One shape per letter, no shapes for the spaces centerx = GraphicsWindow.Width/2 - 15 'Find the center of the circle - offset will need to be nudged with different sized letters centery = GraphicsWindow.Height/2 - 20 pos = 1 'Start with the first letter framestart = Clock.ElapsedMilliseconds 'Start the clock '--- Main Program Loop ----------------------------------------------------------------------- While "True" 'Update position around the circle angle[pos] = angle[pos] + rotationSpeed angle[pos] = Math.Remainder(angle[pos],360) 'calcuate x/y based on angle around the circle radAngle = Math.GetRadians(angle[pos]) x = Math.Cos(radAngle) * radious + centerx y = Math.Sin(radAngle) * radious + centery Shapes.Rotate(bar[pos],angle[pos] + angleOffset) 'Rotate to match position Shapes.Move(bar[pos],x,y) 'Change the position pos = pos + 1 ' Next letter please If pos > barCnt Then 'Reached the end? start over frameDelay() 'Wait a tick or two between moves pos = 1 EndIf EndWhile Sub CountSpaces spcCnt = 0 For i = 1 to Text.GetLength(message) If Text.GetSubText(message,i,1) = " " Then spcCnt = spcCnt + 1 EndIf endfor EndSub Sub CreateLetterShapes baseAngle = 1 pos = 1 For i = 1 To Text.GetLength(message) If Text.GetSubText(message,i,1) <> " " then 'If its not a space baseAngle = baseAngle + angleStep 'update the angle to match its position around the circle bar[pos] = Shapes.AddText(Text.GetSubText(message,i,1)) 'Create the letter as a shape angle[pos] = baseAngle 'Store the shapes angle radAngle = Math.GetRadians(angle[pos]) 'Calculate its position around the circle based on the angle x = Math.Cos(radAngle) * radious + centerx y = Math.Sin(radAngle) * radious + centery Shapes.Rotate(bar[pos],angle[pos]) 'Rotate the shape to match Shapes.Move(bar[pos],x,y) 'Place the shape on the circle pos = pos + 1 'Next letter please Else baseAngle = baseAngle + spcJmp 'Don't create a shape if it's a space - Micro adjust space for space EndIf EndFor EndSub Sub frameDelay 'Precise frame timing. More exact that program.delay While Clock.ElapsedMilliseconds - framestart < frameLength EndWhile framestart = Clock.ElapsedMilliseconds EndSub End>XCL434.sb< Start>XCT308.sb< init() txx=LDText.Split(" .l.o.r.e.m. .i.p.s.u.m. .s.i.t. .a..m.e.n.t. .h.i.c. .e.t. .n.u.n.c. .s.i.n.e. .i.r.a. .q.u.o.d. .m.a.g.n.u.m. .n.u.l.l.a. .f.e.c.e.s. .m.o.v.e.n.t. .t.a.b.u.l.a.e. .r.a.s.a. .p.o.s.t. .h.o.c. .e.g.o. .p.r.o.p.e.r. .t.e. .d.e.u.m. .p.r.o. .b.o.n.o. .e.x. .e.q.u.o. " ".") ltx=Array.GetItemCount(txx) GraphicsWindow.KeyDown=kyy Goto ii1 iii: ox=880 ii1: For xx=1 To 40*22 oxx=xx+ox tof=Math.Remainder(xx+off ltx)+1 sss[oxx]=txx[tof] att[oxx]=4 If sss[oxx-1]=" " Then att[oxx]=2 EndIf If tof<7 or (sss[oxx-1]=" " and Math.GetRandomNumber(9)>7) Then att[oxx]=3 EndIf If Math.GetRandomNumber(10)<3 and text.GetCharacterCode( sss[oxx-1])=32 and text.GetCharacterCode( sss[oxx])>32 Then att[oxx]=1 EndIf EndFor kkk="true If ox>0 Then as1=LDArray.CreateFromValues(sss) aa1=LDArray.CreateFromValues(att) For qa=1 To 22 For ww=1 To Array.GetItemCount(sss) LDArray.SetValue(as1 ww ldarray.GetValue (as1 ww+40)) LDArray.SetValue(aa1 ww ldarray.GetValue (aa1 ww+40)) EndFor printbuf() 'Program.Delay(8) EndFor LDCall.Function5("print2" 1 22 " " "" "2222222222222222222222222222222222222222222222222222222") Else as1=LDArray.CreateFromValues(sss) aa1=LDArray.CreateFromValues(att) printbuf() EndIf LDCall.Function5("print2" 1 24 "Scroll?" "" "2444442") fft="true While kkk fx=1 yy=1 rrr=rrr+1 printbuf() Program.Delay(333) printbufi() Program.Delay(333) EndWhile LDCall.Function5("print2" 1 24 " " "" "222222222") off=off+880 Goto iii Sub kyy kkk="false EndSub Sub init clrs=LDText.Split("blue #fe0000 magenta green cyan yellow white SaddleBrown DarkSlateGray teal tan" " ") clrs[0]="black cc[ 1]="..####.. ##### . #### . #### .######. ###### .$#####. #### .#$ @# #### #$ @# $# #### @#### ###### #######. #$ # @# # # #$ #@ .#####...#####...#$ @# .#$ @#.@# $#.#$ #@.##### . ##$ #### #### #### ###### #### #### #### ###### # # # # # # # ## #### ############ ######## ######## cc[ 2]=".#$ @#. #$ @# .#$ @#. #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ @# #$ @# $# #$ @# $# #$ $# . #$ ## @# ## ## #$ #@ .#$ @#..#$ @#..#$ @# .#$ @# @# $# #$ #@ # #. # #$ # $# #$ @# #@ $# #$ #$ #@ $# #$ ## # ## # # # # ##### # # # # # # # # # ############ ######## ######## cc[ 3]=".#$ @#. ##### .#$ . #$ @# .##### . ##### . $# . #$ $# .#$ @# #$ ###### $# #### @# $# #$ $# . #$ #$# @# #$##@# ###@ .#$ @#..#$ @#..#$ @# .#$ @# @## #$#@ # ### #. #$ $# #### #@ $# ##### ##### ## #$ #@# # # # # ###### # # # # # # # # # # # # # # ############ ######## ######## cc[ 4]=".######. #$ @# .#$ . #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ ### #$ @# #@ $# $# @# # $# #$ $# . #$ #@$#@# #$ @# #$$# .##### ..##### ..#$ @# .#$ @# $## #$ # # #. #$ #### #$ @# ##### $# #$ @# $# #$# @# # # # # ##### ##### ##### # # # ## ####### ############ ######## ######## cc[ 5]=".#$ @#. #$ @# .#$ @#. #$ @# .#$ . #$ . $# . #$ $# .#$ @# #$ @# #$ @# #@ $# #$ $# @# #$# #$ $# . #$ #@ $## #$ @# #$ $# .#$ ..#$ @# .. #$@# .#$##@# $# @# #$ # ### #. #$ #$ #$ @# $# #@ $# #$ @# #@ $# ## @# # ###### # ###### # # # # # # # # # # # #### #### ################ #### cc[ 6]=".#$ @#. ##### . #### . #### .######. #$ .$#####. #### . #### #### #$ @# #### #### @#### ###### $# . ###### #@ $# #$ @# #$ $# .#$ ..#$ @#.. ## . # # $# @# #$ # #. #####$. ######. #### @#### #### #### #### #### # # # . # # ##### # # # # # #### #### ################ #### cc[ 7]=".................................................................................................................................................................................................................##### .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. # .. .. # .# .. # .. # .. .. # .. .#### .#### .################ .####. .. .. . # # # # # # cc[ 8]="................................................................................................................................................................................................................. #### #### ################ #### cc[ 9]="................................................................................................................................................................................................................. cc[10]=" ..##. . ### . ## . ### .#### . #### . # . ## .# # ### # # # ### ## #### ##### # # # # # # # . ###. ..###.. # # .# # .# # .# # cc[11]=" .# # . # # .# # . # # .# . # . # . # # .# # # # # # # # # # # . # ## # ## ## # # . # # ..# #. # # .# # # # # # cc[12]=" .#### . ### .# . # # .### . ### . # . # # .# # # ## #### # ## # # # # . # # ## # # # ## . ### ..### . # # .# # # # cc[13]=" .# # . # # .# # . # # .# . # . # . # # .# # # # # # # # # # ## # # . # # # # # # # . # ..# # . # # .# # # # # # cc[14]=" .# # . ### . ## . ### .#### . # . # . ## . ## ### # # ## ### # # #### # . #### # # # # # # . # ..# #. # . # # # # # oppc="blue GraphicsWindow.PenWidth=0 GraphicsWindow.BackgroundColor="DarkSlateGray GraphicsWindow.BrushColor="darkblue GraphicsWindow.Width=1460 GraphicsWindow.Height=940 GraphicsWindow.Top=5 GraphicsWindow.Title="ZX Scroll LDUtilities.ShowErrors="false not="true=false;false=true ix="ABCDEFIOUGHJSQZTLNMKPRVWXY[1289563074>=+-:,`$/()^?*!@#&% " args=0 bl="# chm=ldtext.Split("A S D F G H J K L Q W E R T Y U I O P Z X C V B N M 0 1 2 3 4 5 6 7 8 9 + = > - : , ` $ / ( ) ^ ? * ! @ # & % [" " ") ppc="DarkSlateGray chm[57]=" " initt="true mchr() EndSub Sub mchr qdd=0 For h=1 To 57 If h>=51 Then qdd=1 EndIf thh=chm[h] If initt Then LDCall.Function2("gench" thh qdd) LDCall.Function("gencb" thh) If h<27 Then LDCall.Function("gencm" thh) EndIf jj[thh]=LDImage.Copy(ii[thh]) LDImage.ReplaceColour(ii[thh] oppc "black" 5) LDImage.ReplaceColour(ii[thh] "red" "white" 5) LDImage.ReplaceColour(kk[thh] oppc ppc 5) LDImage.ReplaceColour(kk[thh] "red" "lime" 5) EndIf LDImage.ReplaceColour(jj[thh] oppc ppc 5) LDImage.ReplaceColour(jj[thh] "red" "black" 5) LDImage.ReplaceColour(im[thh] oppc ppc 5) LDImage.ReplaceColour(im[thh] "red" "black" 5) EndFor oppc=ppc initt="false EndSub Sub gencm ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText (bl text.getSubText(cc[y+8] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor im[ch]=FCDrawings.GenerateImage(gg) Shapes.Remove(ss) EndSub Sub gench ch=args[1] qd=args[2] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText (bl text.getSubText(cc[y+qd] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor ' GraphicsWindow.Title=ch mg=FCDrawings.GenerateImage(gg) ii[ch]=mg thh=ch 'Shapes.AddImage(mg) 'Program.Delay(155) Shapes.Remove(ss) EndSub Sub printbuf yy=0 fx=1 For f=1 To 920 qw=ldarray.GetValue( as1 f) c1=LDArray.GetValue( aa1 f) If qw=" " Then jm=jj[" "] Else If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=ii[qw] EndIf EndIf GraphicsWindow.DrawImage(jm fx*32+50 50+yy*32) fx=fx+1 If fx>40 Then fx=1 yy=yy+1 EndIf EndFor EndSub Sub printbufi yy=0 fx=1 For f=1 To 920 qw=ldarray.GetValue( as1 f) c1=LDArray.GetValue( aa1 f) If qw=" " Then jm=jj[" "] Else If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=jj[qw] EndIf EndIf GraphicsWindow.DrawImage(jm fx*32+50 50+yy*32) fx=fx+1 If fx>40 Then fx=1 yy=yy+1 EndIf EndFor EndSub Sub print2b fx=args[1] yy=args[2] tt=args[3] ccc=args[4] c1s=args[5] For f=1 To Text.GetLength(tt) ix=fx+yy*40 args[4][ix]=text.GetSubText(tu f 1) args[5][ix]=text.GetSubText(c1s f 1) EndFor fx=fx+1 If fx>40 Then fx=1 yy=yy+1 EndIf EndSub Sub print2 fx=args[1] yy=args[2] tt=args[3] ccc=args[4] c1s=args[5] tu=tt' Text.ConvertToUpperCase(tt) For f=1 To Text.GetLength(tt) qw=text.GetSubText(tu f 1) c1=text.GetSubText(c1s f 1) If qw=" " Then jm=jj[" "] Else If c1=2 Then jm=jj[qw] ElseIf c1=3 Then jm=kk[qw] ElseIf c1=4 Then jm=im[qw] Else jm=ii[qw] EndIf EndIf GraphicsWindow.DrawImage(jm fx*32+50 50+yy*32) fx=fx+1 If fx>40 Then fx=1 yy=yy+1 EndIf EndFor EndSub Sub gencb ch=args[1] GraphicsWindow.BrushColor="blue GraphicsWindow.PenWidth=0 ss=shapes.AddRectangle (32 32) gg=FCDrawings.CreateGraphicsFromControl(ss) qw=Text.GetIndexOf(ix ch)-1 For x=0 To 7 For y=0 To 7 n=x+8*qw+1 If Text.IsSubText ("#$@" text.getSubText(cc[y] n 1)) Then lx=x*4 ly=y*4 FCDrawings.FillRectangle(gg "red" lx ly 4 4) EndIf EndFor EndFor kk[ch]=FCDrawings.GenerateImage(gg) thh=ch Shapes.Remove(ss) EndSub End>XCT308.sb< Start>XCT881.sb< rrs="3|9|11|13|15|18|22|25|26|27|28|30|41|43|45|47|50|54|57|59|60|62|65|67|69|70|71|73|75|77|79|81|82|83|85|86|89|90|93|94|97|99|101|102|105|107|109|114|118|121|124|126|129|131|133|135|137|141|146|147|149|150|151|153|154|158|161|163|165|167|177|179|182|183|188|190|195|197|206|210|214|215|220|222|229|230| rrr=LDText.Split(rrs "|") For nn=1 To Array.GetItemCount(rrr) n50=rrr[nn] a=0 GraphicsWindow.Clear() GraphicsWindow.BackgroundColor="tan GraphicsWindow.BrushColor="darkblue GraphicsWindow.Title="Rule"+n50+" Generator m=60 tt="true ff="false s10=3 b=LDMath.Decimal2Base(256+n50 2) For t=2 To 9 mm[t-1]=ff If Text.GetSubText(b t 1)="1" Then mm[t-1]=tt EndIf EndFor rr[tt][tt][tt]=mm[1] rr[tt][tt][ff]=mm[2] rr[tt][ff][tt]=mm[3] rr[tt][ff][ff]=mm[4] rr[ff][tt][tt]=mm[5] rr[ff][tt][ff]=mm[6] rr[ff][ff][tt]=mm[7] rr[ff][ff][ff]=mm[8] GraphicsWindow.Width=(2*m+1)*s10 GraphicsWindow.Height=m*s10 c=m+1 a[c][1]="true For y=2 To m For x=2 To m*2 cc=a[x][y-1] If cc="" Then cc=ff EndIf lc=a[x-1][y-1] If lc="" Then lc=ff EndIf rc=a[x+1][y-1] If rc="" Then rc=ff EndIf a[x][y]=rr[lc][cc][rc] EndFor EndFor For y=1 To m For x=1 To m*2 If a[x][y] Then GraphicsWindow.FillRectangle(x*s10 y*s10 s10 s10) EndIf EndFor EndFor Program.Delay(2222) EndFor End>XCT881.sb< Start>XCV147.sb< '========================================== 'INITIALISE '========================================== Initialise() '========================================== 'MAIN GAME LOOP '========================================== start: playing = "True" While (playing) start = Clock.ElapsedMilliseconds speed = speed+0.01 If (start-musicLast > 70000) Then Sound.Stop(music) Sound.Play(music) musicLast = start EndIf If (start-turn > 50) Then Shapes.Rotate(cars[numCar],0) EndIf MoveLanes() MoveCars() CrashCheck() score = score+speed/100 Shapes.SetText(scoreBox,"Score "+Math.Floor(score)+" Crashes "+crashes) If (crashes = 5 Or keys["Escape"]) Then playing = "False" EndIf delay = 20-(Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile NewGame() Goto start '========================================== 'SUBROUTINES '========================================== Sub Initialise laneWidth = 100 numLane = 5 gw = numLane*laneWidth gh = Desktop.Height-100 GraphicsWindow.Width = gw GraphicsWindow.Height = gh GraphicsWindow.Top = 0 GraphicsWindow.Left = (Desktop.Width-gw)/2 GraphicsWindow.Title = "Lane Changer" GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.BrushColor = "White" GraphicsWindow.PenWidth = 0 For i = 1 To numLane-1 For j = 1 To 8 lane[i][j] = Shapes.AddRectangle(6,100) Shapes.Move(lane[i][j],laneWidth*i-3,200*j-100) EndFor EndFor GraphicsWindow.BrushColor = "Black" GraphicsWindow.FontSize = laneWidth/2 loading = Shapes.AddText("Loading...") Shapes.Move(loading,gw/4,gh/2-100) GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.MouseDown = OnMouseDown GraphicsWindow.MouseUp = OnMouseUp Timer.Interval = 1000 Timer.Tick = OnTick While (music = "") For i = 100 To 0 Step -1 Shapes.SetOpacity(loading,i) Program.Delay(5) EndFor For i = 0 To 100 Shapes.SetOpacity(loading,i) Program.Delay(5) EndFor EndWhile speed = 10 score = 0 crashes = 0 GraphicsWindow.BrushColor = "#50FFAAAA" Shapes.AddRectangle(gw,30) GraphicsWindow.FontSize = 20 GraphicsWindow.BrushColor = "DarkRed" scoreBox = Shapes.AddText("") Shapes.Move(scoreBox,gw/2-100,0) CR = Text.GetCharacter(10) Shapes.Remove(loading) EndSub Sub GetResources numCar = 8 For res = 1 To numCar resources[res] = "car"+res+".png" EndFor resources[9] = "backgroundMusic.mp3" resources[10] = "crashSound.mp3" path = Program.Directory+"/" web = "http://litdev.co.uk/game_images/" ' The following line could be harmful and has been automatically commented. ' files = File.GetFiles(path) For res = 1 To Array.GetItemCount(resources) If (Array.ContainsValue(files,path+resources[res]) = "False") Then tempFile = Network.DownloadFile(web+resources[res]) ' The following line could be harmful and has been automatically commented. ' File.CopyFile(tempFile,path+resources[res]) ' The following line could be harmful and has been automatically commented. ' File.DeleteFile(tempFile) EndIf If (Text.EndsWith(resources[res],"png")) Then image = ImageList.LoadImage(web+"car"+res+".png") carWidth[res] = ImageList.GetWidthOfImage(image) carHeight[res] = ImageList.GetHeightOfImage(image) cars[res] = Shapes.AddImage(image) If (res = numCar) Then carLane[res] = Math.Ceiling(numLane/2) carY[res] = gh-carHeight[res] Else carLane[res] = Math.GetRandomNumber(numLane) carY[res] = gh EndIf Shapes.Move(cars[res],-carWidth[res]/2+laneWidth*(carLane[res]-0.5),carY[res]) EndIf EndFor music = path+resources[9] crash = path+resources[10] EndSub Sub MoveLanes laneY = laneY+speed If (laneY > 200) Then laneY = laneY-200 EndIf For i = 1 To numLane-1 For j = 1 To 8 Shapes.Move(lane[i][j],laneWidth*i-3,laneY+200*j-500) EndFor EndFor EndSub Sub MoveCars For i = 1 To numCar-1 carY[i] = carY[i]+speed/2 If (carY[i] >= gh) Then carLane[i] = Math.GetRandomNumber(numLane) carY[i] = -Math.GetRandomNumber(2500) For j = 1 To numCar-1 If (i <> j And carLane[i] = carLane[j]) Then carY[i] = Math.Min(carY[i],carY[j]-800) EndIf EndFor EndIf Shapes.Move(cars[i],-carWidth[i]/2+laneWidth*(carLane[i]-0.5),carY[i]) EndFor Shapes.Animate(cars[numCar],-carWidth[numCar]/2+laneWidth*(carLane[numCar]-0.5),carY[numCar],50) EndSub Sub CrashCheck For i = 1 To numCar-1 If (carLane[i] = carLane[numCar] And carY[i]+carHeight[i] > gh-carHeight[numCar]) Then Sound.Stop(crash) Sound.Play(crash) carY[i] = gh speed = 10 crashes = crashes+1 EndIf EndFor EndSub Sub NewGame Sound.Stop(music) musicLast = 0 score = Math.Floor(score) ' The following line could be harmful and has been automatically commented. ' highscore = File.ReadContents(File.GetSettingsFilePath()) If (score > highscore) Then highscore = score ' The following line could be harmful and has been automatically commented. ' File.WriteContents(File.GetSettingsFilePath(),highscore) EndIf Program.Delay(500) GraphicsWindow.BrushColor = "#50AAAAFF" mask = Shapes.AddRectangle(gw,gh) GraphicsWindow.BrushColor = "DarkBlue" GraphicsWindow.FontSize = 20 message = Shapes.AddText(" Your Score is "+score+CR+" High Score is "+highscore+CR+"(Press a key to play again)") Shapes.Move(message,gw/2-135,50) Shapes.Animate(message,gw/2-135,gh/2,2000) keys = "" While (keys = "") Program.Delay(100) EndWhile Shapes.Remove(mask) Shapes.Remove(message) speed = 10 score = 0 crashes = 0 For i = 1 To numCar-1 carY[i] = gh EndFor EndSub '========================================== 'EVENTS '========================================== Sub OnTick Timer.Pause() GetResources() EndSub Sub OnKeyDown key = GraphicsWindow.LastKey keys[key] = "True" If (key = "Left" And carLane[numCar] > 1) Then carLane[numCar] = carLane[numCar]-1 Shapes.Rotate(cars[numCar],-20) ElseIf (key = "Right" And carLane[numCar] < numLane) Then carLane[numCar] = carLane[numCar]+1 Shapes.Rotate(cars[numCar],20) EndIf turn = Clock.ElapsedMilliseconds EndSub Sub OnKeyUp key = GraphicsWindow.LastKey keys[key] = "" EndSub Sub OnMouseDown If (Mouse.IsLeftButtonDown) Then keys["LeftMouse"] = "True" If (carLane[numCar] > 1) Then carLane[numCar] = carLane[numCar]-1 Shapes.Rotate(cars[numCar],-20) EndIf ElseIf (Mouse.IsRightButtonDown) Then keys["RightMouse"] = "True" If (carLane[numCar] < numLane) Then carLane[numCar] = carLane[numCar]+1 Shapes.Rotate(cars[numCar],20) EndIf EndIf turn = Clock.ElapsedMilliseconds EndSub Sub OnMouseUp keys["LeftMouse"] = "" keys["RightMouse"] = "" EndSub End>XCV147.sb< Start>XDC335.sb< '============================= 'Data Extension Initialisation DataExtension.Init() '============================= '==================================================================== 'Init Graphic Window GW=925 GameWindow.Width = GW GameWindow.Height = 422 GameWindow.CanResize = "False" GameWindow.Theme = "Aero" GameWindow.Icon = "C:\Program Files\K-Lite Codec Pack\icons\wmv.ico" GameWindow.Show() 'GUI Controls VideoBox = GameControls.AddRectangle(5,5,450,300) PlayListBox = GameControls.AddRectangle(460,5,GW-475,380) Button_Border = GameControls.AddRectangle(45,335,330,50) Button_Border_Inside = GameControls.AddRectangle(245,338,127,45) GameControls.SetColors(VideoBox,"White","Black",1) GameControls.SetColors(PlayListBox,"White","Black",1) GameControls.SetColors(Button_Border,"White","Black",1) GameControls.SetColors(Button_Border_Inside,"White","Black",1) Scroller = GameControls.AddSlider(0,GW-210,182.5,380,25) ' Scroller X position is changed by Rotation GameControls.Rotate(Scroller,90) 'File Extension list Musicext=".mp3:.wma:.mp4:.avi:.wmv:.mpg" 'Buttons Show_PlayList = GameControls.AddButton("<<",427,360,30,25) Play_Button = GameControls.AddButton("▲",140,340,40,40) GameControls.Rotate(Play_Button,90) GameControls.SetFont(Play_Button,"Arial","25","Red","False","False","Center") Next_Button = GameControls.AddButton("►►",185,340,40,40) GameControls.SetFont(Next_Button,"Arial","15","Red","False","False","Center") Prev_Button = GameControls.AddButton("◄◄",95,340,40,40) GameControls.SetFont(Prev_Button,"Arial","15","Red","False","False","Center") Stop_Button = GameControls.AddButton("■",50,340,40,40) GameControls.SetFont(Stop_Button,"Arial","25","Red","False","False","Center") Shuffle_Tick = GameControls.AddCheckBox("Shuffle",253,365) Seek_Bar = GameControls.AddSlider(0,10,310,395,22) Volume_Control_Bar = GameControls.AddSlider(0,253,340,115,22) 'Time text box Time_Box = GameControls.AddTextBox("Text",410,310,45,22) 'Music Note Album_Pic = ImageList.LoadImage("C:\Users\Home\Desktop\Skin\musicnotes.PNG") Pics = GameControls.AddImage(Album_Pic,7,7) GameControls.SetSize(Pics,446,296) 'Register Sub GameControls.RegisterMouseDownEvent(Play_Button,"Play_Song") GameControls.RegisterMouseDownEvent(Next_Button,"Play_Next") GameControls.RegisterMouseDownEvent(Prev_Button,"Play_Prev") GameControls.RegisterMouseDownEvent(Stop_Button,"Stop_Song") GameControls.RegisterMouseDownEvent(Show_PlayList,"Show") GameControls.RegisterMouseDownEvent(Seek_Bar,"Slider_Move") GameControls.RegisterValueChangedEvent(Volume_Control_Bar,"Volume_Set") GameControls.RegisterValueChangedEvent(Scroller,"Scroll") GameControls.RegisterValueChangedEvent(Shuffle_Tick,"Shuffle") 'Sub To Call On Window load Open_Files() '===================================================================== 'Create Media Play Control Player = Media.CreateMediaPlayer(Files_Array[1],7,7,446,296) ' Open first music file '===================================================================== 'Loading Video and Sound File into an array Sub Open_Files start: Dir = Dialogs.AskForDirectory() ' Select a directory that include music files Files_Array = FilePlus.GetAllFiles(Dir) Total_Files = Array.GetItemCount(Files_Array) For i=1 To Total_Files CurrentExt=FilePlus.GetFileExtension(Files_Array[i]) If text.IsSubText(Musicext,CurrentExt)="True" then MM=MM+1 Files_Array[MM]=Files_Array[i] Else Files_Array[i]=" " EndIf EndFor GameWindow.Title = "Small Music Player - By Amir "+Dir Song_Id=1 'First file To Play CurrentExt= FilePlus.GetFileExtension(Files_Array[Song_Id]) If text.IsSubText(Musicext,CurrentExt)="True" then Else Dialogs.ShowMessageBox("Please Select Media Directory First","No Files","OK","Error") Goto Start EndIf Add_List() SetVolume() EndSub '========================================================================================= '========================================================================================= 'Play First song Sub Play_Song Load_album_Art() If GameControls.GetText(Play_Button) = "〓" Then Media.Pause(Player) GameControls.SetText(Play_Button,"▲") ElseIf GameControls.GetText(Play_Button)="▲" Then Media.Resume(Player) GameControls.SetText(Play_Button,"〓") EndIf EndSub '========================================================================================= '========================================================================================= 'Play next song Sub Play_Next Media.Stop(Player) Song_Id = Song_Id + 1 If Song_Id > Total_Files Then Song_Id = Total_Files EndIf Media.SetMedia(Player, Files_Array[Song_Id]) ' Song_ID is already +1 Scroll() GameControls.SetValue(Seek_Bar,0) ' progress bar =0 Media.Play(Player) If Total_Files > 25 Then Scroller_Pos = Scroller_Pos + 1 NNM=math.Round(Scroller_Pos-0.5) GameControls.SetValue(Scroller,NNM/10) EndIf GameControls.SetText(Play_Button,"〓") Load_Album_Art() EndSub '=========================================================================================== '=========================================================================================== 'Play previous song Sub Play_Prev Media.stop(Player) Song_Id = Song_Id - 1 If Song_Id < 1 Then Song_Id = 1 EndIf Media.SetMedia(Player, Files_Array[Song_Id]) Scroll() GameControls.SetValue(Seek_Bar,0) ' progress bar =0 Media.Play(Player) If Total_Files > 25 Then Scroller_Pos = Scroller_Pos - 1 NNM=math.Round(Scroller_Pos-0.5) GameControls.SetValue(Scroller,NNM/10) EndIf GameControls.SetText(Play_Button,"〓") Load_Album_Art() EndSub '============================================================================================ Sub Shuffle If GameControls.IsEnabled(Shuffle_Tick) = "True" Then Ticked_Checbox = 1 Else Ticked_Checbox = 0 EndIf EndSub '============================================================================================ 'Stop Current Playing Song Sub Stop_Song GameControls.SetText(Play_Button,"▲") Media.stop(Player) EndSub '============================================================================================ 'Volume Settings Sub Volume_Set Vol_Value = GameControls.GetValue(Volume_Control_Bar) Media.SetVolume(Player,Vol_Value/100) EndSub '============================================================================================ 'Loading Album Art from Flicker Sub Load_album_Art If(CurrentExt = ".mp3") = "False" Then GameControls.Remove(Pics) EndIf EndSub '============================================================================================ 'Hide PlayList Sub Show If GameControls.GetText(Show_PlayList)="<<" Then ' close For i = 915 To 460 Step -5 GameWindow.Width = i EndFor GameControls.SetText(Show_PlayList,">>") else For i = 460 To 915 Step 5 ' open GameWindow.Width = i EndFor GameControls.SetText(show_PlayList,"<<") EndIf EndSub '============================================================================================ 'Set Song possition Sub Slider_Move Slider_Position = GameControls.GetValue(Seek_Bar) Slider_Time_Position = (Slider_Position*Media.GetLength(Player))/100 Media.SetPosition(Player,Slider_Time_Position) EndSub '============================================================================================ 'Set Volume level at 50% Sub SetVolume Media.SetVolume(Player,50) GameControls.SetValue(Volume_Control_Bar,50/10) EndSub '============================================================================================ 'Prepare Playlist Contents Sub Add_List For i=1 To 24 Song_name[i]= GameControls.AddText(FilePlus.GetFileName(Files_Array[i])+FilePlus.GetFileExtension(Files_Array[i]),465,10+15*(i-1),"Arial",15,"False","False") EndFor GameControls.SetColors(Song_name[Song_Id],"red","red",2) EndSub Sub Scroll NN=math.Round(GameControls.GetValue(Scroller)+0.5) For i=1 To 24 S_name= FilePlus.GetFileName(Files_Array[i+NN])+FilePlus.GetFileExtension(Files_Array[i+NN]) If i+NN>MM Then S_name=" " EndIf GameControls.SetText(Song_name[i],S_name) ' sets music(movie) name + extension If Song_Id=i+NN Then GameControls.SetColors(Song_name[i],"red","red",2) ' current Else GameControls.SetColors(Song_name[i],"Black","Black",2) endif EndFor EndSub '============================================================================================ 'Seek Bar update and next media on end While "True" Media_Position= (Media.GetPosition(Player)*100)/Media.GetLength(Player) ' ##.# % GameControls.SetValue(Seek_Bar,Media_Position/10) ' #.## % Min = Math.Floor(Media.GetPosition(Player)/1000/60) ' ## min Secs = Math.Floor(Math.Remainder(Media.GetPosition(Player)/1000,60)) ' ## sec GameControls.SetText(Time_Box,Min+" : "+Secs+"") If Media_Position>=99.9 then ' End point Play_Next() EndIf endwhile End>XDC335.sb< Start>XDC346-0.sb< GraphicsWindow.Title="Sine Flags GraphicsWindow.Height=800 GraphicsWindow.Top=5 GraphicsWindow.Width=1600 GraphicsWindow.Left=5 LDScrollBars.add(8000 800) GraphicsWindow.PenWidth=4 GraphicsWindow.PenColor="#02529C GraphicsWindow.BackgroundColor="lightgray args=0 For x=0 To 360 Step 2 sx[x]=LDMath.Sin(x)*15 EndFor LDCall.Function3("drff2" 560, 450 "white #02529C red faroe") LDCall.Function3("drff2" 560, 220 "#02529C gold red aaland") LDCall.Function3("drff2" 620, -50 "white #02529C #02529C finland") LDCall.Function3("drff" 100, -70 "#02529C gold sweden") LDCall.Function3("drff2" 1100, 220 "red white norway") LDCall.Function3("drff" 1150, -50 "red white denmark") LDCall.Function3("drff2" 5, 220 "#02529C white red iceland") LDCall.Function3("drff4" 30, 450 "#02529C white cuba") GraphicsWindow.BrushColor="red GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+90) GraphicsWindow.BrushColor="white ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+5 nd[2]+55) GraphicsWindow.PenWidth=4 LDCall.Function3("drffh" 2800 200 "white red czech") GraphicsWindow.BrushColor="#02529C GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+88) GraphicsWindow.PenWidth=4 LDCall.Function3("drffh" 1100 450 "white red poland") vst="true LDCall.Function3("drffh" 1650 450 "white red #02529C chile") GraphicsWindow.BrushColor="white ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+35 nd[2]+10) LDShapes.PenWidth(ss 0) LDCall.Function3("drffv3" 1700, -70 "blue white red france") LDCall.Function3("drffv3" 1650, 200 "green white red italy") nln="true LDGraphicsWindow.FloodFillTolerance=33 LDCall.Function3("drff2" 2250, -50 "darkred white latvia") LDCall.Function3("drff21" 2210, 440 "red white austria") LDCall.Function3("drff22" 2250, 200 "red white blue holland") 'holland LDCall.Function3("drff22" 2850, -50 "red white green hungary")'hungary LDCall.Function3("drff22" 2750, 440 "red white black yemen") 'yemen LDCall.Function3("drff22" 3500, -50 "red blue gold armenia") 'armenia LDCall.Function3("drff22" 3450, 200 "red gold green bolivia") 'bolivia LDGraphicsWindow.FloodFillTolerance=0 LDCall.Function3("drff22" 3400, 440 "black red gold germany") 'germany vst="false LDGraphicsWindow.FloodFillTolerance=22 LDCall.Function3("drffh" 4050, -50 "#02529C gold ucraine") 'ucraine LDCall.Function3("drffh" 4000, 200 "red white indonesia") 'indonesia LDCall.Function3("drff22" 3950, 440 "white green red bulgary")'bulgary LDCall.Function3("drff22" 4650, -50 "#02529C black white estonia") 'estonia LDCall.Function3("drff22" 4600, 200 "red white #02529C Luxembourg") 'luxemb. LDCall.Function3("drff22" 4550, 440 "#02529C white #02529C honduras")'honduras LDCall.Function3("drffv3" 5250, -50 "black gold red begium") LDCall.Function3("drffv3" 5200, 200 "darkblue gold red chad") LDCall.Function3("drffv3" 5150, 440 "red gold green guinea") LDCall.Function3("drffv3" 5850, -50 "green white green nigeria") LDCall.Function3("drffv3" 5800, 200 "green gold red mali") LDCall.Function3("drffv3" 5750, 440 "green white orange irelnd") LDCall.Function3("drffv3" 6450, -50 "red white red peru") LDCall.Function3("drffv3" 6400, 200 "green gold red senegal") GraphicsWindow.BrushColor="green ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.move(ss nd[1]+200 nd[2]+70) Shapes.Rotate(ss 10) LDCall.Function3("drffv3" 6350, 440 "green red gold cameroon") GraphicsWindow.BrushColor="gold ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.move(ss nd[1]+200 nd[2]+70) Shapes.Rotate(ss 10) GraphicsWindow.PenWidth=4 LDCall.Function3("drff22" 7050, -50 "green gold #02529C gabon") LDCall.Function3("drffh" 7000 440 "red white monaco") LDCall.Function3("drffh" 6950 200 "cyan green djibouti") GraphicsWindow.BrushColor="white GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+88) GraphicsWindow.BrushColor="red ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+5 nd[2]+55) GraphicsWindow.Title=fc+" Sine Flags Sub shdrw fc=fc+1 f15=2 For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(x/f15 x/f15 x/f15) GraphicsWindow.DrawLine(ox+x*1.4+55+10 oy+100-s+20 ox+x*1.4+5+10 20+oy+300-s) EndFor GraphicsWindow.BrushColor="white GraphicsWindow.FontName="Noto mono GraphicsWindow.FontSize=16 GraphicsWindow.FontBold="false GraphicsWindow.FontItalic="true ttt=Shapes.AddText(text.ConvertToUpperCase(Text.GetSubText (args[1] 1 1))+Text.GetSubTextToEnd(args[1] 2)) Shapes.Rotate(ttt,-10) Shapes.move (ttt ox+19 oy+295 ) 'Program.Delay(7) EndSub Sub drff ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor For x=90 To 110 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drffv3 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") nd[1]=ox+55 nd[2]=oy+100 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) For m=0 To 2 GraphicsWindow.PenColor=cc[m+1] For x=m*120 To (m+1)*120 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndFor EndSub Sub drff4 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+45 oy+140-s ox+x*1.4+35 oy+180-s) GraphicsWindow.DrawLine(ox+x*1.4+25 oy+220-s ox+x*1.4+15 oy+260-s) EndFor EndSub Sub drffh ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenWidth=4 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) For x=0 To 360 Step 2 GraphicsWindow.PenColor=cc[1] s=sx[x] If vst and x<110 Then GraphicsWindow.PenColor=cc[3] Else GraphicsWindow.PenColor=cc[1] EndIf GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+25+5 oy+200-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drff2 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] If nln Then Else For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+180-s ox+x*1.4+24 oy+220-s) EndFor For x=85 To 115 Step 2 s=LDMath.Sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[3] For x=90 To 110 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndIf For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor EndSub Sub drff21 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+38 oy+168-s ox+x*1.4+22 oy+227-s) EndFor EndSub Sub drff22 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+38 oy+168-s ox+x*1.4+22 oy+227-s) EndFor LDGraphicsWindow.FloodFill(ox+15 oy+290 cc[3]) EndSub End>XDC346-0.sb< Start>XDC346-1.sb< GraphicsWindow.Title="Sine Flags GraphicsWindow.Height=800 GraphicsWindow.Top=5 GraphicsWindow.Width=1600 GraphicsWindow.Left=5 LDScrollBars.add(9900 800) shl=360 GraphicsWindow.PenWidth=4 GraphicsWindow.PenColor="#02529C GraphicsWindow.BackgroundColor="lightgray args=0 Sub main For x=0 To 360 Step 2 sx[x]=LDMath.Sin(x)*15 EndFor LDCall.Function3("drff2" 560, 450 "white #02529C red faroe") LDCall.Function3("drff2" 560, 220 "#02529C gold red aaland") LDCall.Function3("drff2" 620, -50 "white #02529C #02529C finland") LDCall.Function3("drff" 100, -70 "#02529C gold sweden") LDCall.Function3("drff2" 1100, 220 "red white norway") LDCall.Function3("drff" 1150, -50 "red white denmark") LDCall.Function3("drff2" 5, 200 "#02529C white red iceland") LDCall.Function3("drff4" 30, 450 "#02529C white cuba") GraphicsWindow.BrushColor="red GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+90) GraphicsWindow.BrushColor="white ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+5 nd[2]+55) GraphicsWindow.PenWidth=4 LDCall.Function3("drffh" 2800 200 "white red czech") GraphicsWindow.BrushColor="#02529C GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+88) GraphicsWindow.PenWidth=4 LDCall.Function3("drffh" 1100 450 "white red poland") vst="true LDCall.Function3("drffh" 1650 450 "white red #02529C chile") GraphicsWindow.BrushColor="white ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+35 nd[2]+10) LDShapes.PenWidth(ss 0) LDCall.Function3("drffv3" 1700, -70 "blue white red france") LDCall.Function3("drffv3" 1650, 200 "green white red italy") nln="true LDGraphicsWindow.FloodFillTolerance=33 LDCall.Function3("drff2" 2250, -50 "darkred white latvia") LDCall.Function3("drff21" 2210, 440 "red white austria") LDCall.Function3("drff22" 2250, 200 "red white blue holland") 'holland LDCall.Function3("drff22" 2850, -50 "red white green hungary")'hungary LDCall.Function3("drff22" 2750, 440 "red white black yemen") 'yemen LDCall.Function3("drff22" 3500, -50 "red blue gold armenia") 'armenia LDCall.Function3("drff22" 3450, 200 "red gold green bolivia") 'bolivia LDGraphicsWindow.FloodFillTolerance=0 LDCall.Function3("drff22" 3400, 440 "black red gold germany") 'germany vst="false LDGraphicsWindow.FloodFillTolerance=22 LDCall.Function3("drffh" 4050, -50 "#02529C gold ucraine") 'ucraine LDCall.Function3("drffh" 4000, 200 "red white indonesia") 'indonesia LDCall.Function3("drff22" 3950, 440 "white green red bulgary")'bulgary LDCall.Function3("drff22" 4650, -50 "#02529C black white estonia") 'estonia LDCall.Function3("drff22" 4600, 200 "red white #02529C Luxembourg") 'luxemb. LDCall.Function3("drff22" 4550, 440 "#02529C white #02529C honduras")'honduras LDCall.Function3("drffv3" 5250, -50 "black gold red begium") LDCall.Function3("drffv3" 5200, 200 "darkblue gold red chad") LDCall.Function3("drffv3" 5150, 440 "red gold green guinea") LDCall.Function3("drffv3" 5850, -50 "green white green nigeria") LDCall.Function3("drffv3" 5800, 200 "green gold red mali") LDCall.Function3("drffv3" 5750, 440 "green white orange irelnd") LDCall.Function3("drffv3" 6450, -50 "red white red peru") LDCall.Function3("drffv3" 6400, 200 "green gold red senegal") GraphicsWindow.BrushColor="green ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.move(ss nd[1]+200 nd[2]+70) Shapes.Rotate(ss 10) LDCall.Function3("drffv3" 6350, 440 "green red gold cameroon") GraphicsWindow.BrushColor="gold ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.move(ss nd[1]+200 nd[2]+70) Shapes.Rotate(ss 10) GraphicsWindow.PenWidth=4 LDCall.Function3("drff22" 7050, -50 "green gold #02529C gabon") LDCall.Function3("drffh" 7000 200 "red white monaco") LDCall.Function3("drffh" 6950 440 "#4682B4 green djibouti") GraphicsWindow.BrushColor="white GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+88) GraphicsWindow.BrushColor="red ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+5 nd[2]+55) nln="true GraphicsWindow.PenWidth=4 LDCall.Function3("drff23" 7600, 200 "red white blue green gambia") LDCall.Function3("drff22" 7550, 440 "green gold red lithuania") LDCall.Function3("drff22" 7650, -50 "red gold green ghana") GraphicsWindow.BrushColor="black ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.move(ss nd[1]+200 nd[2]+70) Shapes.Rotate(ss 10) LDCall.Function3("drff22" 8250, -50 "white blue red russia") LDCall.Function3("drffh1" 8200 200 "red green white madagascar") LDCall.Function3("drff23" 8150, 440 "#4682B4 white black #4682B4 botswana") LDCall.Function3("drff22" 8800, 200 "green white #02529C sierra_Leone") LDCall.Function3("drff22" 8850, -50 "red white black syria") GraphicsWindow.BrushColor="green ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.Rotate(ss 10) Shapes.move(ss nd[1]+200-50 nd[2]+60) ss=LDShapes.AddStar(5 12 30) LDShapes.PenWidth(ss 0) Shapes.Rotate(ss 10) Shapes.move(ss nd[1]+200+50 nd[2]+80) LDCall.Function3("drff22" 8750, 440 "red white black sudan") GraphicsWindow.BrushColor="green GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+88) GraphicsWindow.PenWidth=4 LDCall.Function3("sdrff" 9450, -50 "red white swiss") LDCall.Function3("shrff" 9400, 200 "yellow white vatican") LDCall.Function3("shrff" 9350, 440 "white red malta") GraphicsWindow.Title=fc+" Sine Flags EndSub main() Sub shdrw fc=fc+1 f15=2 For x=0 To shl Step 2 s=sx[x] GraphicsWindow.PenColor=GraphicsWindow.GetColorFromRGB(x/f15 x/f15 x/f15) GraphicsWindow.DrawLine(ox+x*1.4+55+10 oy+100-s+20 ox+x*1.4+5+10 20+oy+300-s) EndFor GraphicsWindow.BrushColor="white GraphicsWindow.FontName="Noto mono GraphicsWindow.FontSize=16 GraphicsWindow.FontBold="false GraphicsWindow.FontItalic="true ttt=Shapes.AddText(text.ConvertToUpperCase(Text.GetSubText (args[1] 1 1))+Text.GetSubTextToEnd(args[1] 2)) Shapes.Rotate(ttt,-10) Shapes.move (ttt ox+19 oy+295 ) 'Program.Delay(7) EndSub Sub drff ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor For x=90 To 110 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub sdrff ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 shl=240 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 240 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=50 To 190 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor For x=110 To 130 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+45 oy+130-s ox+x*1.4+10 oy+270-s) EndFor EndSub Sub shrff ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 shl=240 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 120 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=120 To 240 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drffv3 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") nd[1]=ox+55 nd[2]=oy+100 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) For m=0 To 2 GraphicsWindow.PenColor=cc[m+1] For x=m*120 To (m+1)*120 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndFor EndSub Sub drff4 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+45 oy+140-s ox+x*1.4+35 oy+180-s) GraphicsWindow.DrawLine(ox+x*1.4+25 oy+220-s ox+x*1.4+15 oy+260-s) EndFor EndSub Sub drffh ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenWidth=4 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) For x=0 To 360 Step 2 GraphicsWindow.PenColor=cc[1] s=sx[x] If vst and x<110 Then GraphicsWindow.PenColor=cc[3] Else GraphicsWindow.PenColor=cc[1] EndIf GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+25+5 oy+200-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drffh1 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenWidth=4 ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.PenColor=cc[1] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+25+5 oy+200-s ox+x*1.4+5 oy+300-s) EndFor For x=0 To 110 Step 2 s=sx[x] GraphicsWindow.PenColor=cc[3] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drff2 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] If nln Then Else For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+180-s ox+x*1.4+24 oy+220-s) EndFor For x=85 To 115 Step 2 s=LDMath.Sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[3] For x=90 To 110 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndIf For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor EndSub Sub drff23 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+180-s ox+x*1.4+24 oy+220-s) EndFor GraphicsWindow.PenColor=cc[3] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor LDGraphicsWindow.FloodFill(ox+15 oy+290 cc[4]) EndSub Sub drff21 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+38 oy+168-s ox+x*1.4+22 oy+227-s) EndFor EndSub Sub drff22 ox=args[1] oy=args[2] nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 cc=LDText.Split(args[3] " ") ldcall.function("shdrw" cc[Array.GetItemCount(cc)]) GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=sx[x] GraphicsWindow.DrawLine(ox+x*1.4+38 oy+168-s ox+x*1.4+22 oy+227-s) EndFor LDGraphicsWindow.FloodFill(ox+15 oy+290 cc[3]) EndSub End>XDC346-1.sb< Start>XDC346.sb< GraphicsWindow.Title="Sine Flags GraphicsWindow.Height=800 GraphicsWindow.Top=5 GraphicsWindow.Width=1600 GraphicsWindow.Left=5 LDScrollBars.add(3000 800) GraphicsWindow.PenWidth=4 GraphicsWindow.PenColor="#02529C GraphicsWindow.BackgroundColor="lightgray args=0 LDCall.Function3("drff2" 560, 470 "white #02529C red") LDCall.Function3("drff2" 560, 270 "#02529C gold red") LDCall.Function3("drff2" 620, -50 "white #02529C #02529C") LDCall.Function3("drff" 100, -70 "#02529C gold") LDCall.Function3("drff2" 150 110 "red white") LDCall.Function3("drff" 1150, -50 "red white") LDCall.Function3("drff2" 5, 270 "#02529C white red") LDCall.Function3("drff4" 50 480 "#02529C white") GraphicsWindow.BrushColor="red GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+90) GraphicsWindow.BrushColor="white ss=LDShapes.AddStar(5 12 30) Shapes.move(ss nd[1]+5 nd[2]+55) GraphicsWindow.PenWidth=4 LDCall.Function3("drffh" 1100 200 "white red") GraphicsWindow.BrushColor="#02529C GraphicsWindow.PenWidth=0 w5=2 Shapes.AddTriangle(nd[1]-w5 nd[2]-w5 nd[3]-w5 nd[4]-w5 nd[1]+150 nd[2]+88) GraphicsWindow.PenWidth=4 LDCall.Function3("drffh" 1100 440 "white red") Sub drff ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55+10 oy+100-s+10 ox+x*1.4+5+10 10+oy+300-s) EndFor GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor For x=90 To 110 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drff4 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 For x=0 To 360 Step 2 'shdw s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55+10 oy+100-s+10 ox+x*1.4+5+10 10+oy+300-s) EndFor GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+45 oy+140-s ox+x*1.4+35 oy+180-s) GraphicsWindow.DrawLine(ox+x*1.4+25 oy+220-s ox+x*1.4+15 oy+260-s) EndFor EndSub Sub drffh ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 For x=0 To 360 Step 2 'shdw s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55+10 oy+100-s+10 ox+x*1.4+5+10 10+oy+300-s) EndFor GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor nd[1]=ox+55 nd[2]=oy+100 nd[3]=ox+5 nd[4]=oy+300 GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+25+5 oy+200-s ox+x*1.4+5 oy+300-s) EndFor EndSub Sub drff2 ox=args[1] oy=args[2] cc=LDText.Split(args[3] " ") GraphicsWindow.PenColor="#333355 For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55+10 oy+100-s+10 ox+x*1.4+5+10 10+oy+300-s) EndFor GraphicsWindow.PenColor=cc[1] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[2] For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+35 oy+180-s ox+x*1.4+24 oy+220-s) EndFor For x=85 To 115 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor GraphicsWindow.PenColor=cc[3] For x=90 To 110 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+55 oy+100-s ox+x*1.4+5 oy+300-s) EndFor For x=0 To 360 Step 2 s=LDMath.sin(x)*15 GraphicsWindow.DrawLine(ox+x*1.4+35 oy+185-s ox+x*1.4+27 oy+215-s) EndFor EndSub End>XDC346.sb< Start>XDD141-0.sb< args=0 offl="e:\ft2" ln[1]="ell;100 50 150 200;cyan;red;2" ln[2]="tri;0 0 50 20 20 60;yellow;black;1" ln[3]="Lin;50 20 175 50;blue;blue;2 ln[4]="rct;30 30 20 40;brown;white;0" Sub deff aa["lin"][1]=" aa["rct"][1]=" aa["ell"][1]=" aa["tri"][1]=" aa["lin"][2]="GraphicsWindow.DrawLine(%1, %2, %3, %4)" aa["lin"][3]="Shapes.AddLine (%1, %2, %3, %4)" aa["lin"][4]="GraphicsWindow.DrawLine(%1, %2, %3, %4)" aa["rct"][2]="GraphicsWindow.DrawRectangle(%1, %2, %3, %4)" aa["rct"][3]="Shapes.Move(Shapes.AddRectangle (%3, %4), %1, %2)" aa["rct"][4]="GraphicsWindow.FillRectangle(%1, %2, %3, %4)" aa["ell"][2]="GraphicsWindow.DrawEllipse(%1, %2, %3, %4)" aa["ell"][3]="Shapes.Move(Shapes.AddEllipse (%3, %4), %1, %2)" aa["ell"][4]="GraphicsWindow.FillEllipse(%1, %2, %3, %4)" aa["tri"][2]="GraphicsWindow.DrawTriangle(%1, %2, %3, %4, %5, %6)" aa["tri"][3]="Shapes.AddTriangle(%1, %2, %3, %4, %5, %6)" aa["tri"][4]="GraphicsWindow.FillTriangle(%1, %2, %3, %4, %5, %6)" bb=Array.GetAllIndices(aa) For f=1 To Array.GetItemCount(bb) aa[bb[f]][1]=LDText.Replace(aa[bb[f]][1] "`" Text.GetCharacter(34)) EndFor EndSub deff() Sub sbinit xt=".sb TextWindow.WriteLine("") TextWindow.WriteLine(offl+xt) EndSub Sub svginit xt=".svg TextWindow.WriteLine("") TextWindow.WriteLine(offl+xt) ss=" ss=LDText.Replace(ss "`" Text.GetCharacter(34)) LDCall.Function("appd" ss) EndSub Sub svgend LDCall.Function("appd" "") EndSub Sub hsvginit xt=".htm TextWindow.WriteLine("") TextWindow.WriteLine(offl+xt) pp=" LDCall.Function("appd" pp) LDCall.Function("appd" "") pp=" pp=LDText.Replace(pp "`" Text.GetCharacter(34)) LDCall.Function("appd" pp) pp=" pp=LDText.Replace(pp "`" Text.GetCharacter(34)) LDCall.Function("appd" pp) EndSub Sub hsvgend LDCall.Function("appd" "") LDCall.Function("appd" "") LDCall.Function("appd" "") EndSub Sub appd TextWindow.WriteLine(args[1]) ' The following line could be harmful and has been automatically commented. ' File.AppendContents(offl+xt args[1]) EndSub Sub repl ss=LDText.Split(args[2] " ") rr=args[1] For r=1 To Array.GetItemCount(ss) vv=ss[r] If args[3]="ell" Then If r=1 Then vv=vv+ss[3]/2 ElseIf r=2 Then vv=vv+ss[4]/2 ElseIf r>2 Then vv=vv/2 EndIf EndIf rr=LDText.Replace(rr "%"+r vv) EndFor If args[3]="tri" Then rr=LDText.Replace(rr "%7" GBrushColor) rr=LDText.Replace(rr "%8" GPenColor) rr=LDText.Replace(rr "%9" GPenWidth) Else rr=LDText.Replace(rr "%6" GBrushColor) rr=LDText.Replace(rr "%7" GPenColor) rr=LDText.Replace(rr "%8" GPenWidth) EndIf return=rr EndSub lw=Array.GetItemCount(ln) hsvginit() For w=1 To lw lin=LDText.Split(ln[w] ";") GBrushColor=lin[3] GPenColor=lin[4] GPenWidth=lin[5] lnn=LDCall.Function3("repl" aa[lin[1]][1] lin[2] lin[1]) LDCall.Function("appd" lnn) EndFor hsvgend() svginit() For w=1 To lw lin=LDText.Split(ln[w] ";") GBrushColor=lin[3] GPenColor=lin[4] GPenWidth=lin[5] lnn=LDCall.Function3("repl" aa[lin[1]][1] lin[2] lin[1]) LDCall.Function("appd" lnn) EndFor svgend() sbinit() nn=Text.GetCharacter(34) For w=1 To lw lin=LDText.Split(ln[w] ";") lnn=LDCall.Function2("repl" aa[lin[1]][3] lin[2]) LDCall.Function("appd" "GraphicsWindow.BrushColor="+nn+lin[3]+nn) LDCall.Function("appd" "GraphicsWindow.PenColor="+nn+lin[4]+nn) LDCall.Function("appd" "GraphicsWindow.PenWidth="+nn+lin[5]+nn) LDCall.Function("appd" lnn) EndFor End>XDD141-0.sb< Start>XDF014.sb< ' mahreen miangul NoveMber 2018 ' AKeys S-Blink M-OZ DDrop FXZ HSWAT ' simple 2D space shooting game - Import PZF938 Initialise() Sub Initialise InitGW() EndSub '========================================Create the GraphicsWindow==================== Sub InitGW 'gw = Desktop.Width gw = 1280 'gh = Desktop.Height-100 gh = 660 GraphicsWindow.Width = gw GraphicsWindow.Height = gh 'GraphicsWindow.Left = -6 GraphicsWindow.Left = 50 GraphicsWindow.Top = 0 GraphicsWindow.Title = "mahreen miangul" GraphicsWindow.BackgroundColor = "DarkBlue" GraphicsWindow.BrushColor = "Khaki" GraphicsWindow.FillRectangle(0,0.8*gh,gw,gh) GraphicsWindow.BrushColor = "DarkKhaki" For i = 1 To 25 x = Math.GetRandomNumber(gw) GraphicsWindow.FillTriangle(x-30,0.8*gh,x,0.75*gh,x+30,0.8*gh) EndFor For i = 1 To 100 GraphicsWindow.brushcolor=GraphicsWindow.GetRandomColor() x = Math.GetRandomNumber(gw) y = Math.GetRandomNumber(0.75*gh) GraphicsWindow.FontSize = 10+Math.GetRandomNumber(10) GraphicsWindow.DrawText(x,y,Text.GetCharacter(10037)) EndFor GraphicsWindow.BrushColor = "White" GraphicsWindow.FontSize = 26 GraphicsWindow.FontName = "Papyrus" EOL = Text.GetCharacter(10) infoBox = Shapes.AddText("mahreen miangul..."+EOL+"mussa-maina!"+EOL+"haroon rashid!") Shapes.Move(infoBox,gw/4,gh/2) endsub '========================================Slide Animation=================== GraphicsWindow.PenColor = "maroon" GraphicsWindow.PenWidth = 4 GraphicsWindow.DrawLine(260, 15, 860, 15)'--------1 GraphicsWindow.DrawLine(260, 45, 860, 45) GraphicsWindow.DrawLine(100, 60, 1100, 90)'-----1 GraphicsWindow.DrawLine(100, 90, 1100, 120) GraphicsWindow.DrawLine(100, 150, 1100, 140)'----1 GraphicsWindow.DrawLine(100, 180, 1100, 170) GraphicsWindow.DrawLine(100, 200, 1100, 230) GraphicsWindow.DrawLine(100, 230, 1100, 260) GraphicsWindow.DrawLine(100, 290, 1100, 280) GraphicsWindow.DrawLine(100, 320, 1100, 310) InitLine1() duration = 2000 n = Array.GetItemCount(Line) index = Array.GetAllIndices(Line) For i = 1 To n h = Line[index[i]] GraphicsWindow.pencolor= "Maroon haroon = shapes.addLine(60, 10, 60, 40) Shapes.Move(haroon, 0, 0) Shapes.Animate(haroon, h["x"], h["y"], duration) Shapes.Rotate(haroon, h["angle"]) EndFor Sub InitLine1 Line[0] = "x=215;y=-8;angle=28" ' right sides Line[1] = "x=225;y=18;angle=-26" Line[2] = "x=245;y=-8;angle=28" Line[3] = "x=255;y=18;angle=-26;" Line[4] = "x=275;y=-8;angle=28" Line[5] = "x=285;y=18;angle=-26" 'Triangle[6] = "x=880;y=60;" 'Triangle[7] = "x=920;y=100;" 'Triangle[8] = "x=930;y=140;" 'Triangle[9] = "x=930;y=175;" 'Triangle[10] = "x=910;y=215;angle=15;" 'heart[11] = "x=880;y=260;angle=15;" 'heart[12] = "x=850;y=300;angle=0;" 'heart[13] = "x=800;y=345;angle=0;" 'heart[14] = "x=750;y=385;angle=0;" 'heart[15] = "x=700;y=420;angle=0;" 'heart[16] = "x=650;y=460;angle=0;" 'heart[17] = "x=600;y=500;angle=0;" ' left sides 'heart[18] = "x=480;y=60;angle=0;" 'heart[19] = "x=430;y=20;" 'heart[20] = "x=380;y=20;" 'heart[24] = "x=330;y=20;" 'heart[25] = "x=270;y=20;" 'heart[26] = "x=220;y=60;" 'heart[27] = "x=200;y=100;" 'heart[28] = "x=180;y=140;" 'heart[29] = "x=175;y=175;" 'heart[30] = "x=180;y=215;angle=-15;" 'heart[31] = "x=200;y=260;angle=-15;" 'heart[32] = "x=220;y=300;angle=-15;" 'heart[33] = "x=270;y=340;angle=-15;" 'heart[34] = "x=330;y=390;angle=-15;" 'heart[35] = "x=390;y=430;angle=-15;" 'heart[36] = "x=450;y=470;angle=-15;" 'heart[37] = "x=510;y=510;angle=-15;" 'heart[38] = "x=560;y=530;" EndSub InitLine2A() duration = 2000 n = Array.GetItemCount(Line) index = Array.GetAllIndices(Line) For i = 1 To n h = Line[index[i]] GraphicsWindow.pencolor= "cyan GraphicsWindow.PenWidth = 4 haroon = shapes.addLine(0, 20, 0, 50) Shapes.Move(haroon, 0, 0) Shapes.Animate(haroon, h["x"], h["y"], duration) Shapes.Rotate(haroon, h["angle"]) EndFor Sub InitLine2A Line[0] = "x=800;y=28;angle=0" ' right sides Line[1] = "x=820;y=28;angle=0;" Line[2] = "x=780;y=92;" Line[3] = "x=800;y=92;" Line[4] = "x=380;y=158;" Line[5] = "x=400;y=158;" Line[6] = "x=770;y=232;" Line[7] = "x=790;y=232;" 'Line[8] = "x=720;y=26;angle=90" 'Triangle[9] = "x=910;y=215;angle=15;" 'heart[10] = "x=880;y=260;angle=15;" EndSub InitLine2B() duration = 2000 n = Array.GetItemCount(Line) index = Array.GetAllIndices(Line) For i = 1 To n h = Line[index[i]] GraphicsWindow.pencolor= "cyan GraphicsWindow.PenWidth = 4 haroon = shapes.addLine(0, 20, 0, 40) Shapes.Move(haroon, 0, 0) Shapes.Animate(haroon, h["x"], h["y"], duration) Shapes.Rotate(haroon, h["angle"]) EndFor Sub InitLine2B Line[0] = "x=820;y=33;angle=90" ' right sides Line[1] = "x=820;y=43;angle=90;" Line[2] = "x=820;y=53;angle=90" Line[3] = "x=800;y=98;angle=90" Line[4] = "x=800;y=108;angle=90" Line[5] = "x=800;y=118;angle=90" Line[6] = "x=400;y=165;angle=90" Line[7] = "x=400;y=175;angle=90" Line[8] = "x=400;y=185;angle=90" 'Triangle[9] = "x=910;y=215;angle=15;" 'heart[10] = "x=880;y=260;angle=15;" EndSub '========================================STARS ==================== GraphicsWindow.BrushColor = "yellow" For i = 0 To 120 GraphicsWindow.FontSize = 5+ Math.GetRandomNumber(30) x = Math.GetRandomNumber(GraphicsWindow.Width-1000) y = Math.GetRandomNumber(GraphicsWindow.height/4) star[i]=Shapes.AddText("★") Shapes.Move(star[i],x,y) Program.Delay(10) EndFor ' ========================================MOON ==================== GraphicsWindow.BrushColor = "yellow" GraphicsWindow.PenWidth=0 moon= Shapes.AddEllipse(20,20) Shapes.Move(moon,50,50) GraphicsWindow.BrushColor = "darkBlue" shadow= Shapes.AddEllipse(20,20) Shapes.Move(shadow,60,45) GraphicsWindow.KeyDown = onkeyDown '========================================Makesprite()==================== SPRITE_init() add_shapes() '========================================MakeImage//Halloween()==================== MakeImage() ' ========================================Drag & Drop Add Animate==================== 'GraphicsWindow.brushColor = "snow" GraphicsWindow.FontSize = 33 arrayOfx = "1=400;2=400;3=400;4=500;5=500;6=600;7=600;8=600;9=700;10=700" arrayofy = "1=0;2=40;3=80;4=40;5=80;6=0;7=40;8=80;9=40;10=80" For numOftext = 1 To 10 GraphicsWindow.brushcolor=GraphicsWindow.GetRandomColor() txt[numOftext] = Shapes.AddText("420") Shapes.Move(txt[numOftext],arrayOfx[numOftext],arrayofy[numOftext]) EndFor ' ========================================Aircraft Animation==================== dZ = 0.1 zoom = 1 ddx=0 ddy=0 bdx=0 bdy=0 bdy2=5 ' <------ initial ball2 moving speed-Y ANMB="5:1" BNMB="6:1" ' <----- Blue car shapes number=6 repeat =1 shoot="False" shoot2="False" ' <----- zm=1 Hit_count=0 No_hit=0 ' ========================================Cannon//Car Timer ==================== Timer.Interval=800 Timer.Tick=CannonCar_up ' ========================================Drag & Drop To Target or Return Home ==================== GraphicsWindow.brushColor = "snow" home = "X=515;Y=0" spriteSize = "420" sprite[1] = Shapes.Addtext("👹") Shapes.Move(sprite[1], home["X"], home["Y"]) spriteTarget[1] = Shapes.Addtext(spriteSize + 0) 'upSize Target For special fx Shapes.Move(spriteTarget[1], 700, 0) Shapes.SetOpacity(spriteTarget[1], 80) ' ========================================Cannon Animation==================== GraphicsWindow.PenWidth = 0 GraphicsWindow.BrushColor= "Red" Ball=Shapes.AddEllipse(10,20) Shapes.Move(Ball,shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) Shapes.HideShape(Ball) GraphicsWindow.BrushColor= "white" ' <----- Ball2=Shapes.AddEllipse(10,20) ' <----- Shapes.Move(Ball2,shapes.GetLeft(shp[BNMB][15]),shapes.Gettop(shp[BNMB][15]))' <----- Shapes.HideShape(Ball2)' <----- '========================================Sub//Cloud==================== Sub cloud cloud = Shapes.Addtext("🌁") Shapes.Animate(cloud,x,y,22000) EndSub ' ========================================Cloud Moving ==================== dx = GraphicsWindow.Width dY = GraphicsWindow.Height GraphicsWindow.BrushColor = "silver" GraphicsWindow.FontSize = 122 x = x + dX - 44 y = y + dY - 550 cloud() Shapes.Animate(cloud,x,y,0) Program.Delay(800) cloud() '========================================Setting//Mouse==================== While "True" ' mseX = GraphicsWindow.MouseX mseY = GraphicsWindow.MouseY If Mouse.IsLeftButtonDown Then 'handle click and select If selected = "" And clicked = "False" Then 'can loop thru here For more than 1 box If mseX >= home["X"] And mseX <= home["X"] + spriteSize And mseY >= home["Y"] And mseY <= home["Y"] + spriteSize Then selected = 1 'box number EndIf EndIf clicked = "True" 'the mse has been clicked For this frame Shapes.Move(sprite[selected], mseX, mseY) Else If Math.Round(mseX/50) = Math.Round(Shapes.GetLeft(spriteTarget[selected])/50) Then If Math.Round(mseY/50) = Math.Round(Shapes.GetTop(spriteTarget[selected])/50) Then Shapes.Remove(sprite[selected]) Shapes.SetOpacity(spriteTarget[selected], 100) EndIf EndIf Shapes.Move(sprite[selected], home["X"], home["Y"]) selected = "" 'deselect when finishised with the box clicked = "False" 'inits here, get ready For next click EndIf Program.Delay(20) ' ========================================Aircraft Blinking Program==================== zoom = zoom - dZ For i = 1 To Array.GetItemCount(shape[5])'<<<<<<<<<<'Aircraft shapes data number = 5 If Array.ContainsValue(shape[5][i], "eye") Then Shapes.Zoom(shp[ANMB][i], 1, zoom) ElseIf Array.ContainsValue(shape[5][i], "mouth") Then Shapes.Zoom(shp[ANMB][i], zoom, zoom) EndIf shapes.Move(shp[ANMB][i],shapes.GetLeft(shp[ANMB][i])+ddx,shapes.Gettop(shp[ANMB][i])+ddy) EndFor If zoom = 0.1 Or zoom = 1 Then dZ = -dZ EndIf ' ========================================Star Blinking Program==================== 'While zm<6 'If zm<6 Then ' <<<<>>>> mmm= Math.GetRandomNumber(80) ' blinking star number _op=Shapes.GetOpacity(star[mmm]) ' opacity ... brightness If _op>50 Then Shapes.SetOpacity(star[mmm],Math.GetRandomNumber(49)) ' darker Else Shapes.SetOpacity(star[mmm],50+Math.GetRandomNumber(50)) ' brighter EndIf If mmm=50 Then Shapes.Move(star[0],400+Math.GetRandomNumber(700),-200) Shapes.Animate(star[0],Math.GetRandomNumber(500),2200,2000) 'shooting star Program.Delay(30) zm=zm+0.1 Shapes.Zoom(moon,zm,zm) ' moon becomes bigger Shapes.Zoom(shadow,zm,zm)' shadow becomes bigger Shapes.Move(moon,shapes.GetLeft(moon)+1,shapes.GetTop(moon)+1) Shapes.Move(shadow,shapes.GetLeft(shadow)+2,shapes.GetTop(shadow)+1) EndIf Program.Delay(20) ' <<<<>>>> 'endif 'endwhile ' ========================================Aircraft Reverse Moving//X,Y Direction==================== cycleX= shapes.GetLeft(shp[ANMB][5]) cycleY= shapes.GetTop(shp[ANMB][5]) If cycleX<0 Or cycleX>GraphicsWindow.Width Then ddx=-ddx EndIf If cycleY<0 Or cycleY>200 Then ddy=-ddy EndIf ' ===========================================BallFire==================== If shoot Then shapes.Move(Ball ,shapes.GetLeft(ball)-bdx/2,shapes.Gettop(ball)-bdy/2) If shapes.Gettop(ball)>700 Then shoot="False" No_hit=No_hit+1 GraphicsWindow.Title="You Hit !!!!!! Total "+(Hit_count*10-No_hit*5) +" Points get" Shapes.Move(Ball,shapes.GetLeft(shp[ANMB][9])+10,shapes.Gettop(shp[ANMB][9])+30) Shapes.HideShape(Ball) EndIf ' =========================================Collision Check Here//AirCraft Hit Cannon==================== CCar_X=shapes.GetLeft(shp[BNMB][5]) CCar_Y=shapes.GetTop(shp[BNMB][5]) ballX=shapes.GetLeft(ball) bally=shapes.GetTop(ball) If (CCar_X>>> shape[5][14] = "func=ell;x=50;y=235;width=33;height=22;bc=greenyellow;pw=0;tag=eye" ' eye 2 ' <<<<>>>> shape[5][15] = "func=ell;x=70;y=133;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' ' <<<<>>>> shape[5][16] = "func=ell;x=70;y=153;width=44;height=11;bc=cyan;pw=0;tag=mouth" ' ' <<<<>>>> ' Sprit Shapes--Cannon-Igloo/Kawi-Birds/Ducks/Bees ' Car--Cannon s[6] ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=0.2" shX[6]="1=460;2=540;3=580;4=480;5=520;6=560;7=600" shY[6]="1=210;2=210;3=210;4=260;5=260;6=260;7=260" shape[6][1] = "func=rect;x=1690;y=1045;width=20;height=44;bc=red;pw=0;" shape[6][2] = "func=rect;x=1705;y=1045;width=20;height=44;bc=green;pw=0;" shape[6][3] = "func=rect;x=1727;y=1045;width=20;height=44;bc=yellow;pw=0;" shape[6][4] = "func=rect;x=1747;y=1043;width=20;height=55;bc=blue;pw=0;" shape[6][5] = "func=rect;x=1633;y=1030;width=55;height=68;bc=darkslategray=0;" shape[6][6] = "func=rect;x=1644;y=1044;width=33;height=33;bc=snow;pw=0;" shape[6][7] = "func=ell;x=1646;y=1046;width=30;height=30;bc=darkslategray;pw=0;" shape[6][8] = "func=rect;x=1600;y=1150;width=330;height=90;bc=darkslategray;pw=0;" shape[6][9] = "func=ell;x=1600;y=1080;width=210;height=140;bc=darkslategray;pw=0;" shape[6][10]="func=ell;x=1640;y=1120;width=33;height=22;angle=-50;bc=snow;pw=0.5" shape[6][11]="func=ell;X=1730;Y=1120;width=33;height=22;angle=50;bc=mediumslateblue;pw=0.5" shape[6][12]="func=rect;X=1640;Y=1180;width=33;height=22;angle=40;bc=mediumslateblue;pc=darkslategray;pw=0" shape[6][13]="func=rect;X=1730;Y=1180;width=33;height=22;angle=-40;bc=snow;pc=darkslategray;pw=0" shape[6][14]="func=rect;X=1810;Y=1050;width=40;height=100;angle=0;bc=darkslategray;pc=black;pw=2" '<------ cannon for ball2 shape[6][15]="func=rect;x=1804;y=1020;width=50;height=30;angle=0;bc=darkslategray;pc=black;pw=2" '<------ cannon for ball2 ' 6B--Kiwi Birds//7 'shape[6][16]="func=line;X=35;Y=360;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 1<------ shape[6][16]="func=line;X=35;Y=1960;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 1<------ shape[6][17]="func=line;X=35;Y=1970;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 2<------ shape[6][18]="func=line;X=35;Y=1980;x1=0;y1=0;x2=14;y2=10;angle=0;pc=orange;pw=8" ' F 3<------ shape[6][19]="func=ell;X=19;Y=1980;width=10;height=40;angle=50;bc=orange;pc=darkslategray;pw=0.6" ' F 1 <------ shape[6][20]="func=ell;X=27;Y=1990;width=10;height=44;angle=30;bc=orange;pc=orange;pw=0.6" ' F 2<------ shape[6][21]="func=ell;X=41;Y=1990;width=10;height=44;angle=15;bc=orange;pc=orange;pw=0.6" ' F 3<------ shape[6][22]="func=line;X=118;Y=1960;x1=0;y1=10;x2=14;y2=0;angle=0;pc=orange;pw=8" ' F 1<------ shape[6][23]="func=line;X=118;Y=1970;x1=0;y1=10;x2=14;y2=0;angle=0;pc=orange;pw=8" ' F 2<------ shape[6][24]="func=line;X=118;Y=1980;x1=0;y1=10;x2=14;y2=0;angle=0;pc=orange;pw=8" ' F 3<------ shape[6][25]="func=ell;X=118;Y=1990;width=10;height=40;angle=-15;bc=orange;pc=orange;pw=0.5" ' F 1<------ shape[6][26]="func=ell;X=133;Y=1990;width=10;height=44;angle=-30;bc=orange;pc=orange;pw=0.5" ' F 2<------ shape[6][27]="func=ell;X=145;Y=1980;width=10;height=44;angle=-50;bc=orange;pc=orange;pw=0.5" ' F 3<------ shape[6][28]="func=ell;X=-10;Y=1790;width=35;height=110;angle=40;bc=darkslategray;pc=darkslategray;;pw=0"' Arm 1 shape[6][29]="func=ell;X=140;Y=1790;width=35;height=110;angle=-40;bc=darkslategray;pc=darkslategray;pw=0"' Arm 2 shape[6][30]="func=ell;X=0;Y=1800;width=170;height=180;angle=0;bc=snow;pc=darkslategray;pw=4"' body shape[6][31]="func=ell;X=30;Y=1710;width=120;height=120;bc=darkslategray;pc=darkslategray;;pw=0"' Face shape[6][32]="func=ell;X=40;Y=1730;width=50;height=70;angle=20;bc=snow;pc=darkslategray;pw=0"' Face 1 shape[6][33]="func=ell;X=90;Y=1730;width=50;height=70;angle=-10;bc=snow;pc=darkslategray;pw=0"' Face 2 shape[6][34]="func=ell;X=46;Y=1745;width=88;height=80;angle=0;bc=snow;pc=darkslategray;pw=0"' Face 3 shape[6][35]="func=ell;X=60;Y=1750;width=25;height=25;bc=snow;pc=darkslategray;pw=2"' eye 1 shape[6][36]="func=ell;X=65;Y=1761;width=10;height=10;bc=darkslategray;pc=darkslategray;pw=2"' eye 1 shape[6][37]="func=ell;X=100;Y=1750;width=25;height=25;bc=snow;pc=darkslategray;pw=2"' eye 2 shape[6][38]="func=ell;X=105;Y=1761;width=10;height=10;bc=darkslategray;pc=darkslategray;pw=2"' eye 2 shape[6][39]="func=tri;X=-40;Y=1620;x1=120;y1=170;x2=130;y2=180;x3=140;y3=170;bc=orange" ' nosy ' 6C--Doggy//7 'shape[6][40] = "func=ell;x=330;y=360;width=250;height=50;angle=0;bc=gray;pc=firebrick;pw=2" '--------------------< Body shape[6][40] = "func=ell;x=1730;y=660;width=250;height=50;angle=0;bc=gray;pc=firebrick;pw=2" '--------------------< Body 'shape[6][41] = "func=ell;x=390;y=220;width=130;height=150;angle=0;bc=lightgray;pc=firebrick;pw=0" '--------------------< Face shape[6][41] = "func=ell;x=1790;y=520;width=130;height=150;angle=0;bc=lightgray;pc=firebrick;pw=0" '--------------------< Face shape[6][42] = "func=rect;x=1760;y=510;width=38;height=115;angle=22;bc=gray;pc=red;pw=2" '-----------------------< Ear 1 shape[6][43] = "func=rect;x=1915;y;510;width=38;height=115;angle=-22;bc=gray;pc=red;pw=2" '---------------------< Ear 2 shape[6][44] = "func=rect;x=1840;y;560;width=30;height=25;angle=0;bc=darkslategray;pc=red;pw=2" ' Nose 1 shape[6][45] = "func=rect;x=1850;y;585;width=10;height=45;angle=0;bc=darkslategray;pc=red;pw=2" 'Nose 2 shape[6][46] = "func=line;x=1372;y=333;x1=440;y1=210;x2=474;y2=195;angle=0;bc=darkslategray;pc=darkslategray;pw=2"' <------Eye/Lash--1 shape[6][47] = "func=line;x=1445;y=243;x1=455;y1=305;x2=425;y2=285;angle=0;bc=darkslategray;pc=darkslategray;pw=2" ' <------Eye/Lash--2 shape[6][48] = "func=ell;x=1813;y=544;width=25;height=40;angle=20;bc=darkslategray;pc=firebrick;pw=2" '--------------------< Eye/Left--1 shape[6][49] = "func=ell;x=1820;y=550;width=14;height=20;angle=20;bc=snow;pc=snow;pw=0;tag=eye" '--------------------< Eye/Left--2 shape[6][50] = "func=ell;x=1821;y=552;width=10;height=10;angle=0;bc=darkslategray;pc=darkslategray;pw=0" '--------------------< Eye/Left--3 shape[6][51] = "func=ell;x=1870;y=546;width=25;height=40;angle=-20;bc=darkslategray;pc=firebrick;pw=2" '--------------------< Eye/;tag=eyeRight--1 shape[6][52] = "func=ell;x=1875;y=550;width=14;height=20;angle=-20;bc=snow;pc=snow;pw=0;tag=eye" '--------------------< Eye/Right--2 shape[6][53] = "func=ell;x=1874;y=553;width=10;height=10;angle=0;bc=darkslategray;pc=darkslategray;pw=0;" '--------------------< Eye/Right--3 shape[6][54] = "func=line;x=1425;y=300;x1=440;y1=350;x2=420;y2=350;angle=0;bc=darkslategray;pc=darkslategray;pw=2"' <------Mouth shape[6][55] = "func=line;x=1380;y=435;x1=460;y1=210;x2=470;y2=198;angle=0;bc=darkslategray;pc=darkslategray;pw=2"' <------Mouth/ shape[6][56] = "func=line;x=1385;y=335;x1=489;y1=310;x2=480;y2=298;angle=0;bc=darkslategray;pc=darkslategray;pw=2" ' <------Moth/ ' 6D--Penguins//7 shape[6][57]="func=ell;X=61;Y=132;width=22;height=130;angle=10;bc=gray;pc=gray;pw=0" ' F 1 <------ shape[6][58]="func=ell;X=54;Y=297;width=16;height=24;angle=0;bc=white;pc=white;pw=0" ' F 2<------ shape[6][59]="func=ell;X=40;Y=312;width=58;height=18;angle=0;bc=orange;pc=orange;pw=0" ' F 1 <------ shape[6][60]="func=tri;X=93;Y=314;x1=0;y1=0;x2=0;y2=9;x3=26;y3=6;angle=0;bc=black;pc=black;pw=0" ' F 1 <------ y1< y3XDF014.sb< Start>XDG023.sb< 'text decryption by S Paget ' These are the normal frequencies for each letter in English text target[1] = 8.167 target[2] = 1.492 target[3]=2.782 target[4]=4.253 target[5]=12.702 target[6]=2.228 target[7]=2.015 target[8]=6.094 target[9]=6.966 target[10]=0.153 target[11]=0.772 target[12]=4.025 target[13]=2.406 target[14]=6.749 target[15]=7.507 target[16]=1.929 target[17]=0.095 target[18]=5.987 target[19]=6.327 target[20]=9.056 target[21]=2.758 target[22]=0.978 target[23]=2.360 target[24]=0.150 target[25]=1.974 target[26]=0.074 ' load the encrypted file TextWindow.top=0 TextWindow.left=0 TextWindow.WriteLine("Encrpted text:") ' The following line could be harmful and has been automatically commented. ' mytext = File.ReadContents("encryptedtext.txt") TextWindow.Writeline(mytext) TextWindow.WriteLine("") 'count letters in sample text For i = 1 To Text.GetLength(mytext) charval = Text.GetCharacterCode(Text.GetSubText(mytext,i,1)) - 96 count[charval]=count[charval]+1 EndFor 'convert to percentage frequencies For letter = 1 To 26 freq[letter] = count[letter]/text.GetLength(mytext)*100 TextWindow.WriteLine("Frequency of " + Text.GetCharacter(letter+96) + " is " + freq[letter]) EndFor 'run through all possible offsets min = 3000 For offset = 1 To 26 'for each offset, add up the total amount of "difference" between the actual frequency 'and the target frequency difference[offset] = 0 For letter = 1 To 26 comparisonfreq = letter + offset If comparisonfreq>26 Then comparisonfreq = 0 + comparisonfreq-26 EndIf difference[offset] = difference[offset] + math.Abs(target[letter] - freq[comparisonfreq]) EndFor If difference[offset]XDG023.sb< Start>XDH362.sb< InitRadioButtons() 'init other stuff While programLoop '?? Clear() If selected = radioCircle Then 'react to RB selection - draw circle EndIf 'If Other Event Takes Place Then WaitStatusChange() 'rb loop ??? EndWhile Sub WaitStatusChange While lastSelected = selected Control_GetSelectedRadioButton() selected = return EndWhile lastSelected = selected EndSub Sub Control_GetSelectedRadioButton For iRadioButton = 1 To radioNum If radioObj[iRadioButton]["selected"] Then return = "RadioButton" + iRadioButton Goto 'break this EndIf EndFor EndSub End>XDH362.sb< Start>XDK444.sb< ' SBace-Invaders-25 - A space invader game in under 25 lines by Davey~Wavey, Nov.2009, for Small Basic. ' ' Alien has increasing speed as it descends to increase difficulty, but you also get more score the faster they are! ' You are rated on your score and your hit accuracy. You have 3 lives. Use your mouse to move your rocket and left mousebutton to fire. ' NOTES: This looks more complex than it really is. Instead of defining any variables, I am using the array to handle everything. ' Unfortunately this means that every time I change a variable, I have to completely rebuild the array, hence the long 'gamearry' lines. ' If you compare them though, you'll see that only one, or maybe two, values change each time. ' To cut down on lines, I'm also using the ElseIf's to handle the various checks, which means I only need one endif. ' ' bx, by = bullet x,y. ax,ay = alien x,y. adir = alien direction. aspeed = alien speed. ' The strange '1=-1;-1=1' elements, along with 'adir', allow me to simulate a logical 'NOT' type function when I need to bounce the alien. (i.e. adir=NOT adir) ' initialise game array and start mouse event handling gamearry = "1=-1;-1=1;bx=0;by=0;lives=3;ammo=0;score=0;bullet=" + Shapes.AddEllipse(5,10) + ";gun=" + Shapes.AddImage("http://www.tutorialized.com/upload/(2006.06.21-09:12:44)rocket50x50.jpg") + ";ax=" + (GraphicsWindow.Width/2) + ";ay=20;adir=-1;aspeed=0.2;alien=" + shapes.AddImage("http://www.adiumxtras.com/images/thumbs/space_invaders_1_17601_6150_thumb.png") GraphicsWindow.MouseDown=fire While gamearry["lives"] > 0 ' update alien and bullet positions gamearry = "1=-1;-1=1;bx=" + gamearry["bx"] + ";by=" + (gamearry["by"] - gamearry["aspeed"]) +";lives=" + gamearry["lives"] +";ammo=" + gamearry["ammo"] +";score=" + gamearry["score"] +";bullet=" + gamearry["bullet"] +";gun=" + gamearry["gun"] +";ax=" + (gamearry["ax"] + (gamearry[ gamearry["adir"] ] * gamearry["aspeed"] )) +";ay=" + gamearry["ay"] +";adir=" + gamearry["adir"] +";aspeed=" + gamearry["aspeed"] +";alien=" + gamearry["alien"] ' move the gun, alien and bullet Shapes.Move(gamearry["gun"], GraphicsWindow.MouseX-25, GraphicsWindow.Height-50) Shapes.Animate(gamearry["alien"], gamearry["ax"]-25, gamearry["ay"]-25,0) Shapes.Move(gamearry["bullet"], gamearry["bx"]-3, gamearry["by"]) ' bounce the alien at the screen edge (or has it hit player?) If ((gamearry["ax"] < 35) or (gamearry["ax"] > GraphicsWindow.Width-35)) Then ' alien has hit edge of screen, so bounce it gamearry = "1=-1;-1=1;bx=" + gamearry["bx"] + ";by=" + gamearry["by"] +";lives=" + gamearry["lives"] +";ammo=" + gamearry["ammo"] +";score=" + gamearry["score"] +";bullet=" + gamearry["bullet"] +";gun=" + gamearry["gun"] +";ax=" + gamearry["ax"] +";ay=" + (gamearry["ay"]+10) +";adir=" + gamearry[ gamearry["adir"] ] +";aspeed=" + (gamearry["aspeed"]+0.01) +";alien=" + gamearry["alien"] ElseIf (gamearry["ay"] >= GraphicsWindow.Height-15) Then ' alien has reached the bottom - decrease life and reset alien. gamearry = "1=-1;-1=1;bx=" + gamearry["bx"] + ";by=" + gamearry["by"] +";lives=" + (gamearry["lives"]-1) +";ammo=" + gamearry["ammo"] +";score=" + gamearry["score"] +";bullet=" + gamearry["bullet"] +";gun=" + gamearry["gun"] +";ax=" + (GraphicsWindow.Width/2) + ";ay=20;adir=" + gamearry[ gamearry["adir"] ] +";aspeed=" + (gamearry["aspeed"]+0.01) +";alien=" + gamearry["alien"] ElseIf ( math.abs( math.Floor(gamearry["bx"]-(gamearry["ax"])) ) <25 ) and ( math.Abs( Math.Floor( gamearry["by"]-gamearry["ay"] ) ) < 10 ) Then ' bullet has collided with alien - increase score and reset alien gamearry = "1=-1;-1=1;bx=" + gamearry["bx"] + ";by=" + gamearry["by"] +";lives=" + gamearry["lives"] +";ammo=" + gamearry["ammo"] +";score=" + (gamearry["score"]+Math.Floor((gamearry["aspeed"]+1)*(gamearry["aspeed"]+1))) +";bullet=" + gamearry["bullet"] +";gun=" + gamearry["gun"] +";ax=" + (GraphicsWindow.Width/2) + ";ay=20;adir=" + gamearry["adir"] +";aspeed=" + gamearry["aspeed"] +";alien=" + gamearry["alien"] EndIf ' show status GraphicsWindow.Title = "SBace-Invaders-25: SCORE=" + gamearry["score"] + " LIVES=" + gamearry["lives"] EndWhile ' Game Over! GraphicsWindow.ShowMessage ("Well Done, you scored: " + gamearry["score"] + " and your Skill = " + Math.Floor((gamearry["score"]/gamearry["ammo"])*100) + "%", "<<< G-A-M-E O-V-E-R >>> ") Sub fire gamearry = "1=-1;-1=1;bx=" + (GraphicsWindow.mousex) + ";by=" + (GraphicsWindow.Height-45) +";lives=" + gamearry["lives"] +";ammo=" + (gamearry["ammo"]+1) +";score=" + gamearry["score"] +";bullet=" + gamearry["bullet"] +";gun=" + gamearry["gun"] +";ax=" + gamearry["ax"] +";ay=" + gamearry["ay"] +";adir=" + gamearry["adir"] +";aspeed=" + gamearry["aspeed"] +";alien=" + gamearry["alien"] EndSub End>XDK444.sb< Start>XDK566.sb< GraphicsWindow.Title="Zodiac 1-8" wrap="True gw=1670 gh=800 LDUtilities.ShowErrors ="false LDUtilities.ShowNoShapeErrors ="false GraphicsWindow.Width=gw GraphicsWindow.Height=gh GraphicsWindow.BackgroundColor="#000055 star=0 main() Sub main Shapes_Init() scale=1 angle=0 zii=200 qi=1 Shapes_Add() InitStars()'----------------fishes s_=ldtext.Split(stary[qi] "|") num=Array.GetItemCount(s_) offsetX=0 offsetY=0 GetMinMax() offsetX=-xMin + 50 offsetY=-yMin + 90 DrawGrids() sdrw() qi=2 Shapes_Initcc()'-------------capricorn scale=1.2 angle=0 Shapes_Add() sdrw() qi=3'-----------------------aquarius Shapes_Initaq() scale=1.2 angle=0 Shapes_Add() sdrw() qi=4'----------------------aries Shapes_Initary() scale=1 angle=0 Shapes_Add() sdrw() qi=5'------------------------cancer shpcnc() scale=1 angle=0 Shapes_Add() sdrw() qi=6'-----------------taurus Shapes_Init_tau () scale=1 angle=0 zii=1 Shapes_Add() sdrw() qi=7'-----------------gemini Shapes_Initgmm () scale=1 angle=0 zii=1 Shapes_Add() sdrw() qi=8'-----------------leo Shapes_InitLn () scale=1.05 angle=0 zii=1 Shapes_Add() sdrw() LDFastShapes.Update () ds=95 For s= 1 to 10 dooff () Program.Delay (333) endfor LDEvents.MouseWheel=wll inn=0 EndSub Sub sdrw GraphicsWindow.PenWidth=1 GraphicsWindow.PenColor="DarkGray s_=ldtext.Split(stary[qi] "|") num=Array.GetItemCount(s_) GraphicsWindow.BrushColor="White" For i=1 To num ra=s_[i]["r"] dec=s_[i]["d"] RADec2XY() mag=s_[i]["m"] d=20 / mag ell=Shapes.AddEllipse(d, d) ldShapes.ZIndex (ell,1000) el[qi][i]=LDFastShapes.ShapeIndex (ell) ldfastShapes.Move(el[qi][i], x - d / 2, y - d / 2) EndFor EndSub Sub moom 'GraphicsWindow.Title="Zodiac scroll GraphicsWindow.Title=GraphicsWindow.MouseX +" , "+GraphicsWindow.MouseY EndSub Sub wll If inn=0 then inn=1 ds=LDEvents.LastMouseWheelDelta *25 off=off+ds 'GraphicsWindow.Title=off dooff() inn=0 endif EndSub sub dooff For qi=1 To 8 For i=1 To Array.GetItemCount (el[qi]) LDFastShapes.Move (el[qi][i],LDFastShapes.GetLeft (el[qi][i])+ds, LDFastShapes.GetTop (el[qi][i])) EndFor For i=1 To Array.GetItemCount (ffs[qi]) LDFastShapes.Move (ffs[qi][i],LDFastShapes.GetLeft (ffs[qi][i])+ds, LDFastShapes.GetTop (ffs[qi][i])) EndFor EndFor LDFastShapes.Update () For i=1 to Array.GetItemCount (txx) Shapes.Move (txx[i],shapes.GetLeft (txx[i])+ds, Shapes.GetTop (txx[i])) EndFor For i=1 to Array.GetItemCount (ltx) Shapes.Move (ltx[i], Shapes.GetLeft (ltx[i])+ds,1) EndFor EndSub Sub GetMinMax For i=1 To num ra=s_[i]["r"] dec=s_[i]["d"] RADec2XY() ra1=Text.GetSubText(ra, 1, 2) If wrap And 12 < ra1 Then ra1=ra1 - 24 EndIf If i=1 Then raMin=ra1 decMin=Text.GetSubText(dec, 1, 3) raMax=ra1 decMax=Text.GetSubText(dec, 1, 3) xMin=x yMin=y xMax=x yMax=y Else raMin=Math.Min(ra1, raMin) decMin=Math.Min(Text.GetSubText(dec, 1, 3), decMin) raMax=Math.Max(ra1, raMax) decMax=Math.Max(Text.GetSubText(dec, 1, 3), decMax) xMin=Math.Min(x, xMin) yMin=Math.Min(y, yMin) xMax=Math.Max(x, xMax) yMax=Math.Max(y, yMax) EndIf EndFor decMin=Math.Floor(decMin / 10) * 10 raMax=raMax + 1 decMax=decMax + 1 EndSub Sub InitStars ' Initialize stars stary[1]="r=01 31 28.99;d=+15 20 45.0;m=3.62|r=23 17 09.49;d=+03 16 56.1;m=3.70|r=23 59 18.60;d=+06 51 48.9;m=4.03|r=23 39 56.82;d=+05 37 38.5;m=4.13|r=01 45 23.59;d=+09 09 27.5;m=4.26|r=01 02 56.66;d=+07 53 24.3;m=4.27|r=23 27 58.17;d=+06 22 44.8;m=4.27|r=02 02 02.80;d=+02 45 49.5;m=4.33|r=00 01 57.59;d=-06 00 50.3;m=4.37|r=00 48 40.90;d=+07 35 06.7;m=4.44|r=01 41 25.91;d=+05 29 15.4;m=4.45|r=23 03 52.61;d=+03 49 12.3;m=4.48|r=23 42 02.88;d=+01 46 49.5;m=4.49|r=01 11 39.59;d=+30 05 23.0;m=4.51|r=00 05 20.15;d=-05 42 28.2;m=4.61|r=01 53 33.34;d=+03 11 14.9;m=4.61|r=01 11 27.19;d=+21 02 04.8;m=4.66|r=01 13 44.94;d=+24 35 01.6;m=4.67|r=01 19 27.98;d=+27 15 50.7;m=4.74|r=01 30 10.94;d=+06 08 38.2;m=4.84|r=23 58 40.41;d=-03 33 20.9;m=4.88|r=23 26 55.91;d=+01 15 21.0;m=4.95|r=23 46 23.54;d=+03 29 12.7;m=4.95|r=00 28 02.84;d=+17 53 35.1;m=5.01|r=23 20 20.54;d=+05 22 53.2;m=5.05|r=00 48 58.71;d=+16 56 28.1;m=5.07|r=00 01 49.44;d=-03 01 38.9;m=5.13|r=01 17 47.98;d=+03 36 52.3;m=5.13|r=01 11 06.77;d=+31 25 29.2;m=5.15|r=01 13 43.80;d=+07 34 31.8;m=5.21|r=02 02 02.80;d=+02 45 49.0;m=5.23|r=01 21 07.35;d=+28 44 18.2;m=5.23|r=01 42 29.95;d=+20 16 12.5;m=5.24|r=01 05 40.93;d=+21 28 23.6;m=5.33|r=01 26 15.28;d=+19 10 20.4;m=5.35|r=00 39 55.55;d=+21 26 18.8;m=5.36|r=00 46 32.98;d=+15 28 32.2;m=5.36|r=00 20 35.86;d=+08 11 24.9;m=5.38|r=00 32 35.40;d=+20 17 40.0;m=5.38|r=23 08 40.84;d=+02 07 39.4;m=5.42|r=22 59 27.40;d=+00 57 47.1;m=5.43|r=00 57 50.15;d=+28 59 32.0;m=5.44|r=23 47 56.49;d=-02 45 41.8;m=5.49|r=01 02 49.09;d=+31 48 15.6;m=5.50|r=01 26 41.65;d=+19 14 26.0;m=5.50|r=00 47 01.43;d=+11 58 26.2;m=5.51|r=01 08 22.34;d=+05 39 00.8;m=5.51|r=00 10 02.18;d=+11 08 44.9;m=5.54|r=01 37 05.96;d=+12 08 29.4;m=5.54|r=01 05 41.68;d=+21 27 55.7;m=5.55|r=01 07 57.11;d=+20 44 21.6;m=5.56|r=01 09 49.20;d=+19 39 30.2;m=5.57|r=23 51 57.83;d=+02 55 49.5;m=5.59|r=01 05 05.35;d=+14 56 45.6;m=5.64|r=23 36 23.35;d=+02 06 07.5;m=5.68|r=00 32 23.75;d=+06 57 19.6;m=5.69|r=00 02 29.76;d=+08 29 08.1;m=5.70|r=00 25 24.22;d=+01 56 23.0;m=5.77|r=23 49 27.48;d=+01 04 34.3;m=5.77|r=00 54 35.22;d=+19 11 18.4;m=5.80|r=00 39 22.09;d=+21 15 04.9;m=5.88|r=00 36 47.31;d=+15 13 54.3;m=5.89|r=02 00 09.02;d=+03 05 51.5;m=5.89|r=23 34 08.95;d=-01 14 51.1;m=5.91|r=00 48 17.34;d=+07 17 59.7;m=5.92|r=23 52 55.52;d=-03 09 19.4;m=5.93|r=01 14 07.65;d=+16 08 00.8;m=5.97|r=00 47 23.62;d=+06 44 27.5;m=5.98|r=01 39 40.77;d=+16 24 21.2;m=5.98|r=01 29 52.83;d=+18 21 20.4;m=6.01|r=00 14 58.78;d=+08 49 15.7;m=6.02|r=01 04 52.62;d=+05 39 22.7;m=6.03|r=01 14 42.40;d=+06 59 42.7;m=6.04|r=00 28 12.69;d=+16 26 42.4;m=6.05|r=00 55 58.52;d=+27 12 33.7;m=6.08|r=00 47 13.56;d=+19 34 43.3;m=6.11|r=22 54 59.47;d=+01 03 53.6;m=6.11|r=00 16 34.06;d=+08 14 24.7;m=6.12|r=01 06 33.62;d=+12 57 21.5;m=6.14|r=23 00 37.88;d=+00 11 09.0;m=6.22|r=23 55 07.78;d=+07 04 15.7;m=6.22|r=01 08 01.20;d=+32 00 43.9;m=6.23|r=01 35 46.44;d=+14 39 41.2;m=6.23|r=00 22 25.45;d=+13 28 56.8;m=6.25|r=23 27 14.77;d=+01 07 21.7;m=6.26|r=01 44 55.85;d=+20 05 00.3;m=6.27|r=01 06 11.20;d=+32 10 53.6;m=6.28|r=23 53 04.75;d=+02 05 26.3;m=6.29|r=00 02 24.17;d=+08 57 24.6;m=6.33|r=01 05 49.22;d=+04 54 31.2;m=6.35|r=23 31 57.56;d=-01 05 09.3;m=6.39|r=00 27 58.48;d=+19 30 50.7;m=6.40|r=01 13 45.17;d=+07 34 42.2;m=6.44|r=23 35 28.61;d=+01 18 47.5;m=6.47|r=00 24 38.15;d=+14 18 55.9;m=6.48|r=00 47 54.73;d=+20 55 31.1;m=6.51|r=00 19 56.28;d=+16 15 03.2;m=6.60|r=00 17 24.50;d=+08 52 34.8;m=6.66|r=01 39 15.39;d=+14 17 08.3;m=6.74|r=00 25 41.89;d=+07 41 28.4;m=6.77|r=00 49 53.11;d=+27 42 37.1;m=7.0|r=01 27 39.81;d=+05 21 11.2;m=7.01|r=00 49 53.20;d=+27 42 37.0;m=7.1|r=01 05 51.42;d=+04 54 35.0;m=7.26|r=01 34 51.61;d=+12 33 31.2;m=7.28 stary[2]="r=21 31 33.52;d=-05 34 16.2;m=2.90|r=22 05 47.03;d=-00 19 11.4;m=2.95|r=22 54 39.04;d=-15 49 14.7;m=3.27|r=22 28 49.80;d=-00 01 12.2;m=3.65|r=23 09 26.76;d=-21 10 20.9;m=3.68|r=22 52 36.86;d=-07 34 46.8;m=3.73|r=20 47 40.53;d=-09 29 44.5;m=3.78|r=22 21 39.30;d=-01 23 14.5;m=3.86|r=23 22 58.30;d=-20 06 01.2;m=3.96|r=22 35 21.33;d=-00 07 02.5;m=4.04|r=22 49 35.51;d=-13 35 33.1;m=4.05|r=22 16 49.97;d=-07 46 59.7;m=4.17|r=23 14 19.33;d=-06 02 54.7;m=4.22|r=23 15 53.28;d=-09 05 15.7;m=4.24|r=22 06 26.21;d=-13 52 10.3;m=4.29|r=23 26 02.82;d=-20 38 30.7;m=4.38|r=23 17 54.20;d=-09 10 57.0;m=4.41|r=22 28 50.10;d=-00 01 12.0;m=4.42|r=20 47 44.24;d=-05 01 39.4;m=4.43|r=23 06 40.81;d=-23 44 35.2;m=4.48|r=23 42 43.28;d=-14 32 41.1;m=4.49|r=21 09 35.59;d=-11 22 18.0;m=4.50|r=21 37 45.04;d=-07 51 14.9;m=4.68|r=22 43 35.25;d=-18 49 49.1;m=4.68|r=23 33 16.63;d=-20 54 52.3;m=4.70|r=23 09 54.88;d=-22 27 27.3;m=4.71|r=20 52 39.21;d=-08 58 59.7;m=4.73|r=22 03 18.83;d=-02 09 19.2;m=4.74|r=22 25 16.61;d=+01 22 38.6;m=4.80|r=22 30 38.82;d=-10 40 40.4;m=4.82|r=23 41 45.80;d=-17 48 59.5;m=4.82|r=23 16 50.95;d=-07 43 35.3;m=4.93|r=23 39 47.04;d=-14 13 19.4;m=4.97|r=23 18 57.65;d=-09 36 38.6;m=4.99|r=22 37 45.42;d=-04 13 39.9;m=5.04|r=21 39 33.28;d=+02 14 37.5;m=5.10|r=22 21 35.58;d=-21 35 52.9;m=5.12|r=20 39 24.83;d=+00 29 11.4;m=5.15|r=23 51 21.32;d=-18 54 33.0;m=5.17|r=23 19 06.37;d=-13 27 17.0;m=5.19|r=23 22 39.10;d=-15 02 21.8;m=5.19|r=23 19 06.51;d=-13 27 30.4;m=5.20|r=22 34 41.50;d=-20 42 28.3;m=5.21|r=22 47 33.19;d=-19 36 46.3;m=5.24|r=23 44 12.06;d=-18 16 36.9;m=5.24|r=23 46 00.84;d=-18 40 42.1;m=5.28|r=22 04 47.43;d=-00 54 22.5;m=5.29|r=22 14 18.02;d=-21 04 28.9;m=5.33|r=22 16 48.04;d=-12 49 53.2;m=5.34|r=22 20 11.91;d=-07 49 16.0;m=5.35|r=23 41 34.51;d=-18 01 36.8;m=5.36|r=22 10 37.46;d=-11 33 53.9;m=5.43|r=23 05 09.71;d=-07 41 37.7;m=5.44|r=21 24 11.44;d=-12 52 41.3;m=5.48|r=21 25 16.96;d=-03 33 23.7;m=5.48|r=20 56 54.03;d=-09 41 51.1;m=5.49|r=21 04 04.58;d=-05 49 24.2;m=7.31|r=22 23 30.79;d=-24 45 45.6;m=5.53|r=22 54 45.60;d=-16 16 18.3;m=5.53|r=20 52 08.69;d=-05 30 25.4;m=5.55|r=22 03 16.43;d=-06 31 20.7;m=5.55|r=22 26 34.15;d=-16 44 31.7;m=5.55|r=23 19 23.86;d=-05 07 27.5;m=5.56|r=22 01 05.01;d=+00 36 17.1;m=5.60|r=21 42 10.12;d=+01 17 07.0;m=5.66|r=22 47 42.75;d=-14 03 23.1;m=5.68|r=21 25 13.02;d=-09 44 53.3;m=5.71|r=22 17 06.50;d=-05 23 14.0;m=5.75|r=22 24 27.03;d=-13 31 45.9;m=5.76|r=22 24 06.87;d=-04 50 13.2;m=5.79|r=22 08 58.99;d=-18 31 10.5;m=5.80|r=22 53 28.69;d=-11 36 59.5;m=5.80|r=21 18 11.07;d=-04 31 10.2;m=5.83|r=21 21 04.33;d=-04 33 36.5;m=5.87|r=22 34 02.89;d=-01 34 27.0;m=5.88|r=21 04 04.74;d=-05 49 23.0;m=5.89|r=22 19 00.70;d=-13 18 17.9;m=5.96|r=20 51 25.69;d=-05 37 35.9;m=5.99|r=21 22 56.27;d=-09 19 09.4;m=5.99|r=22 12 25.74;d=-14 11 37.8;m=6.04|r=23 02 32.56;d=-06 34 26.1;m=6.18|r=22 48 30.19;d=-10 33 19.8;m=6.19|r=22 54 34.13;d=-07 12 16.3;m=6.20|r=21 00 33.81;d=-04 43 47.7;m=6.21|r=23 01 23.65;d=-07 03 40.1;m=6.23|r=23 31 42.04;d=-21 22 10.0;m=6.24|r=22 26 34.40;d=-16 44 33.0;m=6.35|r=22 30 17.33;d=-14 35 08.3;m=6.36|r=21 24 51.68;d=-03 23 53.6;m=6.38|r=22 02 26.25;d=-16 57 53.4;m=6.39|r=22 31 41.28;d=-10 54 19.7;m=6.39|r=22 35 48.82;d=-17 27 37.1;m=6.39|r=22 43 14.25;d=-06 57 46.5;m=6.40|r=21 16 17.78;d=-09 12 52.8;m=6.45|r=22 09 29.87;d=-07 32 55.2;m=6.63|r=22 10 31.74;d=-10 49 13.7;m=6.64|r=21 39 31.39;d=-00 03 04.1;m=6.66|r=23 41 46.39;d=-17 47 00.5;m=8.52 stary[3]="r=02 07 10.29;d=+23 27 46.0;m=2.01|r=01 54 38.35;d=+20 48 29.9;m=2.64|r=02 49 58.99;d=+27 15 38.8;m=3.61|r=03 11 37.67;d=+19 43 36.1;m=4.35|r=02 47 54.44;d=+29 14 50.7;m=4.52|r=01 53 31.80;d=+19 17 45.0;m=4.62|r=02 43 27.11;d=+27 42 25.8;m=4.65|r=01 53 31.77;d=+19 17 38.7;m=4.70|r=01 57 55.78;d=+23 35 45.9;m=4.79|r=03 14 54.11;d=+21 02 40.7;m=4.87|r=02 09 25.29;d=+25 56 23.9;m=4.98|r=02 06 33.91;d=+22 38 54.3;m=5.03|r=01 57 21.03;d=+17 49 03.3;m=5.09|r=03 22 45.27;d=+20 44 31.6;m=5.10|r=02 44 57.51;d=+12 26 45.5;m=5.18|r=02 59 12.70;d=+21 20 25.0;m=5.2 |r=02 12 47.98;d=+21 12 39.5;m=5.23|r=02 49 17.56;d=+17 27 51.6;m=5.26|r=03 21 13.61;d=+21 08 49.7;m=5.27|r=02 40 41.03;d=+27 03 39.6;m=5.30|r=02 38 49.00;d=+21 57 41.2;m=5.45|r=03 05 26.69;d=+25 15 18.7;m=5.45|r=02 24 49.04;d=+10 36 38.2;m=5.48|r=02 59 12.73;d=+21 20 25.6;m=5.5 |r=03 24 18.46;d=+24 43 27.1;m=5.50|r=02 51 29.57;d=+15 04 55.7;m=5.52|r=03 22 11.89;d=+27 36 27.3;m=5.55|r=02 15 42.83;d=+25 02 35.7;m=5.57|r=02 18 07.55;d=+19 54 04.2;m=5.58|r=02 56 25.98;d=+18 01 25.1;m=5.58|r=02 03 39.26;d=+25 56 07.6;m=5.64|r=02 36 37.75;d=+12 26 52.2;m=5.64|r=02 10 37.54;d=+19 30 01.5;m=5.68|r=02 13 03.25;d=+15 16 47.7;m=5.72|r=02 42 21.92;d=+20 00 41.7;m=5.74|r=03 09 36.73;d=+29 04 37.6;m=5.74|r=01 55 51.03;d=+23 34 38.4;m=5.76|r=02 55 48.50;d=+18 19 54.0;m=5.76|r=02 44 32.97;d=+15 18 42.8;m=5.78|r=03 12 14.24;d=+27 15 25.2;m=5.78|r=02 15 45.94;d=+25 46 59.2;m=5.79|r=02 58 05.08;d=+20 40 07.7;m=5.80|r=01 50 08.58;d=+22 16 31.3;m=5.83|r=02 48 32.06;d=+18 17 01.9;m=5.83|r=01 48 10.90;d=+16 57 20.3;m=5.86|r=02 48 45.87;d=+25 11 17.1;m=5.89|r=01 50 08.50;d=+22 16 33.0;m=5.90|r=03 01 54.15;d=+26 27 44.4;m=5.91|r=03 19 55.81;d=+27 04 16.7;m=5.91|r=01 50 52.01;d=+11 02 36.4;m=5.93|r=02 32 54.15;d=+15 02 04.1;m=6.00|r=02 06 49.22;d=+25 42 16.5;m=6.01|r=02 11 12.06;d=+25 56 13.0;m=6.01|r=03 28 26.57;d=+22 48 15.4;m=6.03|r=03 24 26.11;d=+20 48 12.6;m=6.07|r=03 07 25.69;d=+17 52 47.9;m=6.13|r=02 30 38.37;d=+19 51 19.4;m=6.14|r=03 20 25.57;d=+25 39 46.7;m=6.14|r=02 30 54.38;d=+17 42 14.6;m=6.21|r=03 08 21.09;d=+18 47 42.3;m=6.25|r=02 42 28.95;d=+10 44 30.4;m=6.32|r=02 44 19.09;d=+17 45 50.5;m=6.46|r=02 37 00.44;d=+24 38 50.1;m=6.48|r=03 02 25.87;d=+26 36 34.7;m=6.62|r=03 05 26.70;d=+25 15 19.0;m=7.00|r=02 54 55.17;d=+17 44 05.3;m=7.01|r=02 36 57.64;d=+24 38 53.1;m=7.09 stary[4]="r=08 16 30.95;d=+09 11 08.4;m=3.53|r=08 44 41.11;d=+18 09 17.5;m=3.94|r=08 46 41.83;d=+28 45 36.0;m=4.03|r=08 58 29.20;d=+11 51 28.0;m=4.26|r=08 43 17.21;d=+21 28 06.9;m=4.66|r=08 12 12.71;d=+17 38 53.3;m=4.67|r=08 05 04.51;d=+13 07 06.1;m=5.14|r=08 20 03.87;d=+27 13 07.0;m=5.14|r=09 09 21.53;d=+22 02 43.6;m=5.16|r=08 57 14.91;d=+15 19 21.8;m=5.22|r=08 55 39.69;d=+27 55 39.2;m=5.23|r=08 59 32.68;d=+32 25 07.1;m=5.23|r=09 07 44.82;d=+10 40 05.6;m=5.23|r=08 07 45.84;d=+21 34 55.1;m=5.30|r=08 31 35.77;d=+18 05 40.4;m=5.33|r=08 32 42.52;d=+20 26 28.6;m=5.33|r=09 15 13.88;d=+14 56 29.5;m=5.36|r=08 54 14.70;d=+30 34 45.0;m=5.40|r=09 08 00.07;d=+29 39 15.2;m=5.42|r=08 55 55.56;d=+11 37 33.8;m=5.44|r=08 56 56.63;d=+32 54 38.1;m=5.44|r=09 02 44.27;d=+24 27 10.6;m=5.45|r=08 26 43.95;d=+12 39 17.5;m=5.56|r=08 26 27.73;d=+27 53 37.9;m=5.58|r=08 00 47.31;d=+17 18 31.4;m=5.60|r=08 13 08.87;d=+29 39 23.7;m=5.62|r=08 43 12.34;d=+12 40 51.1;m=5.62|r=08 44 45.04;d=+10 04 54.2;m=5.63|r=08 52 34.62;d=+32 28 26.8;m=5.67|r=08 57 35.16;d=+15 34 52.4;m=5.68|r=08 31 30.57;d=+24 04 52.4;m=5.71|r=08 10 27.23;d=+25 30 29.4;m=5.73|r=07 56 59.47;d=+15 47 25.4;m=5.80|r=08 00 55.87;d=+25 23 34.2;m=5.87|r=08 46 56.06;d=+12 06 36.3;m=5.89|r=09 01 24.13;d=+32 15 08.3;m=5.89|r=08 20 32.15;d=+24 01 20.5;m=5.92|r=08 37 05.79;d=+09 39 20.1;m=5.92|r=08 23 21.87;d=+18 19 56.2;m=5.94|r=08 28 37.35;d=+14 12 39.1;m=5.94|r=09 08 47.42;d=+26 37 48.0;m=5.95|r=08 38 19.00;d=+32 48 07.3;m=5.96|r=08 52 36.13;d=+28 19 53.0;m=5.96|r=08 06 18.40;d=+22 38 07.8;m=5.97|r=08 01 30.29;d=+16 27 19.2;m=5.99|r=09 10 20.86;d=+21 59 47.1;m=6.04|r=08 28 36.80;d=+24 08 42.2;m=6.05|r=09 01 48.88;d=+27 54 10.0;m=6.07|r=08 23 55.21;d=+10 37 55.6;m=6.11|r=08 25 49.99;d=+17 02 47.9;m=6.11|r=08 45 21.42;d=+30 41 51.9;m=6.12|r=08 26 47.08;d=+26 56 07.7;m=6.14|r=08 26 47.00;d=+26 56 07.0;m=6.19|r=08 40 18.31;d=+31 56 31.1;m=6.21|r=08 08 42.44;d=+13 38 27.4;m=6.25|r=08 52 28.60;d=+28 15 33.0;m=6.25|r=08 57 58.63;d=+30 14 01.5;m=6.25|r=08 40 27.03;d=+19 32 41.4;m=6.29|r=08 01 43.77;d=+25 05 22.0;m=6.32|r=08 33 00.14;d=+24 05 05.7;m=6.35|r=08 51 01.53;d=+15 21 01.7;m=6.36|r=08 40 06.44;d=+20 00 28.1;m=6.39|r=08 10 13.12;d=+25 50 40.4;m=6.44|r=08 32 39.87;d=+10 03 57.7;m=6.48|r=09 12 17.87;d=+14 59 43.6;m=6.49|r=08 26 39.82;d=+24 32 03.7;m=6.51|r=08 38 05.19;d=+09 34 28.7;m=6.54|r=08 35 19.47;d=+19 35 24.3;m=6.55|r=08 40 11.47;d=+19 58 16.2;m=6.61|r=09 18 58.91;d=+17 42 20.4;m=6.61|r=08 39 42.68;d=+19 46 42.5;m=6.66|r=09 04 09.87;d=+27 53 53.9;m=6.67|r=08 39 31.87;d=+32 30 56.2;m=6.69|r=08 39 56.35;d=+32 43 38.2;m=6.71|r=08 40 43.23;d=+19 43 09.6;m=6.83|r=08 03 50.48;d=+22 04 14.9;m=6.84|r=09 11 56.93;d=+18 02 39.0;m=6.87|r=09 09 02.31;d=+17 28 10.7;m=7.18|r=08 51 10.83;d=+15 59 57.8;m=7.38|r=08 26 40.10;d=+24 32 07.0;m=7.81|r=08 43 08.36;d=+18 09 02.0;m=8.03|r=09 05 45.52;d=+17 23 24.5;m=8.10 stary[5]="r=04 35 55.20;d=+16 30 35.1;m=0.87|r=05 26 17.50;d=+28 36 28.3;m=1.65|r=03 47 29.06;d=+24 06 18.9;m=2.85|r=05 37 38.68;d=+21 08 33.3;m=2.97|r=04 28 39.67;d=+15 52 15.4;m=3.40|r=04 00 40.82;d=+12 29 25.4;m=3.41|r=04 28 36.93;d=+19 10 49.9;m=3.53|r=03 24 48.84;d=+09 01 44.6;m=3.61|r=03 49 09.73;d=+24 03 12.7;m=3.62|r=04 19 47.53;d=+15 37 39.7;m=3.65|r=03 44 52.52;d=+24 06 48.4;m=3.72|r=03 27 10.12;d=+09 43 58.0;m=3.73|r=04 22 56.03;d=+17 32 33.3;m=3.77|r=04 28 34.43;d=+15 57 44.0;m=3.84|r=03 45 49.59;d=+24 22 04.3;m=3.87|r=04 03 09.38;d=+05 59 21.5;m=3.91|r=03 30 52.37;d=+12 56 12.1;m=4.14|r=03 46 19.56;d=+23 56 54.5;m=4.14|r=04 25 22.10;d=+22 17 38.3;m=4.21|r=04 35 39.23;d=+10 09 39.3;m=4.25|r=04 15 32.05;d=+08 53 32.7;m=4.27|r=04 38 09.40;d=+12 30 39.1;m=4.27|r=04 42 14.70;d=+22 57 25.1;m=4.27|r=04 26 18.39;d=+22 48 49.3;m=4.28|r=03 36 52.52;d=+00 24 10.2;m=4.29|r=03 45 12.48;d=+24 28 02.6;m=4.30|r=04 25 29.32;d=+17 55 40.8;m=4.30|r=05 32 12.75;d=+18 35 39.3;m=4.32|r=04 04 41.66;d=+22 04 55.4;m=4.36|r=04 26 20.67;d=+15 37 06.0;m=4.48|r=05 53 19.64;d=+27 36 44.2;m=4.56|r=05 03 05.70;d=+21 35 24.2;m=4.62|r=04 33 50.86;d=+14 50 40.2;m=4.65|r=04 39 16.45;d=+15 55 04.9;m=4.67|r=04 26 36.38;d=+14 42 49.9;m=4.69|r=04 24 05.69;d=+17 26 39.2;m=4.80|r=05 57 59.66;d=+25 57 14.1;m=4.81|r=04 13 56.39;d=+09 15 50.0;m=4.84|r=05 41 17.72;d=+16 32 03.1;m=4.84|r=05 27 38.08;d=+21 56 13.1;m=4.88|r=05 49 00.96;d=+24 34 03.2;m=4.88|r=05 49 32.94;d=+12 39 04.9;m=4.89|r=05 07 26.68;d=+18 38 42.0;m=4.91|r=04 17 15.69;d=+20 34 43.5;m=4.93|r=04 28 26.37;d=+16 21 34.7;m=4.96|r=05 19 16.59;d=+22 05 48.1;m=4.96|r=04 20 21.23;d=+27 21 03.4;m=4.97|r=05 24 25.31;d=+17 23 00.8;m=5.00|r=04 28 50.10;d=+13 02 51.5;m=5.02|r=03 49 11.20;d=+24 08 12.6;m=5.05|r=03 48 16.25;d=+11 08 36.1;m=5.08|r=04 39 09.20;d=+15 48 00.1;m=5.08|r=04 51 22.41;d=+18 50 23.8;m=5.08|r=04 23 51.84;d=+09 27 39.5;m=5.10|r=03 30 24.48;d=+11 20 11.3;m=5.14|r=04 06 36.40;d=+27 36 00.1;m=5.18|r=05 39 44.19;d=+25 53 49.7;m=5.18|r=04 07 00.52;d=+29 00 04.6;m=5.21|r=04 20 36.24;d=+15 05 43.8;m=5.26|r=04 25 24.94;d=+22 12 00.4;m=5.27|r=05 07 48.43;d=+20 25 06.4;m=5.28|r=05 47 42.90;d=+13 53 58.7;m=5.28|r=04 13 33.11;d=+07 42 57.7;m=5.29|r=04 03 44.60;d=+05 26 08.3;m=5.32|r=03 45 40.43;d=+06 03 00.1;m=5.34|r=04 19 36.69;d=+21 46 24.9;m=5.34|r=05 35 27.12;d=+24 02 22.7;m=5.37|r=04 22 34.93;d=+25 37 45.7;m=5.38|r=04 10 49.88;d=+26 28 51.7;m=5.39|r=04 30 37.30;d=+13 43 28.0;m=5.40|r=05 27 10.09;d=+17 57 44.2;m=5.40|r=03 44 48.20;d=+24 17 22.5;m=5.45|r=04 40 03.42;d=+12 11 51.5;m=5.45|r=04 04 21.67;d=+24 06 21.7;m=5.46|r=04 30 38.83;d=+15 41 31.0;m=5.47|r=05 29 16.49;d=+25 09 01.1;m=5.47|r=05 47 26.20;d=+17 43 44.9;m=5.47|r=04 19 26.08;d=+21 08 32.7;m=5.50|r=05 08 06.62;d=+24 15 54.7;m=5.50|r=04 09 09.90;d=+19 36 33.5;m=5.51|r=05 27 45.61;d=+15 52 26.8;m=5.52|r=04 27 17.45;d=+22 59 46.9;m=5.53|r=04 28 32.11;d=+01 22 51.1;m=5.53|r=05 37 03.71;d=+17 02 25.5;m=5.53|r=05 50 28.90;d=+14 18 20.5;m=5.54|r=03 39 51.14;d=+03 03 24.6;m=5.55|r=04 19 57.63;d=+14 02 06.9;m=5.58|r=04 30 08.53;d=+15 38 16.4;m=5.58|r=05 52 22.30;d=+14 10 18.5;m=5.60|r=03 56 52.03;d=+22 28 41.7;m=5.62|r=04 18 23.14;d=+21 34 45.8;m=5.64|r=04 23 25.00;d=+16 46 38.4;m=5.64|r=03 45 09.73;d=+24 50 21.7;m=5.66|r=03 52 00.22;d=+06 32 05.7;m=5.66|r=05 33 31.63;d=+18 32 24.8;m=5.67|r=03 42 18.94;d=+19 42 01.0;m=5.68|r=04 11 20.20;d=+05 31 22.9;m=5.71|r=04 22 03.45;d=+14 04 38.1;m=5.72|r=05 47 13.15;d=+14 29 18.3;m=5.72|r=03 32 35.93;d=+09 22 24.8;m=5.76|r=03 45 54.46;d=+24 33 16.6;m=5.76|r=05 28 01.60;d=+17 14 21.3;m=5.77|r=04 38 09.38;d=+16 02 00.2;m=5.78|r=04 57 48.65;d=+23 56 54.9;m=5.79|r=04 58 09.38;d=+25 03 01.9;m=5.79|r=05 07 55.43;d=+21 42 17.4;m=5.84|r=04 05 20.15;d=+22 00 33.2;m=5.90|r=04 28 23.34;d=+14 44 27.7;m=5.90|r=03 34 26.62;d=+24 27 52.1;m=5.95|r=05 46 45.49;d=+15 49 21.0;m=6.00|r=04 31 51.69;d=+15 51 05.9;m=6.01|r=03 57 03.80;d=+23 10 32.1;m=6.05|r=04 49 44.08;d=+15 54 15.3;m=6.09|r=05 23 37.72;d=+16 41 57.7;m=6.09|r=03 40 46.30;d=+25 19 46.3;m=6.11|r=03 43 47.14;d=+19 39 54.6;m=6.13|r=04 43 13.75;d=+24 05 20.3;m=6.18|r=05 26 05.72;d=+16 42 00.6;m=6.23|r=05 15 27.66;d=+22 17 05.5;m=6.26|r=03 47 20.90;d=+24 06 58.0;m=6.28|r=04 31 07.16;d=+15 06 18.6;m=6.28|r=04 15 46.21;d=+15 24 02.7;m=6.31|r=04 23 59.76;d=+24 18 03.7;m=6.34|r=03 46 02.89;d=+24 31 40.8;m=6.43|r=04 25 37.25;d=+15 56 27.9;m=6.44|r=03 48 56.91;d=+23 51 26.2;m=6.47|r=03 36 58.03;d=+23 12 40.0;m=6.72|r=04 59 44.27;d=+15 55 00.5;m=6.75|r=04 19 54.78;d=+16 31 21.6;m=6.85 stary[6]="r=07 45 19.36;d=+28 01 34.7;m=1.16|r=07 34 36.00;d=+31 53 19.1;m=1.90|r=06 37 42.70;d=+16 23 57.9;m=1.93|r=06 22 57.59;d=+22 30 49.9;m=2.87|r=06 43 55.93;d=+25 07 52.2;m=3.06|r=06 14 52.70;d=+22 30 24.6;m=3.31|r=06 45 17.43;d=+12 53 45.8;m=3.35|r=07 20 07.39;d=+21 58 56.4;m=3.50|r=07 44 26.87;d=+24 23 53.3;m=3.57|r=07 18 05.61;d=+16 32 25.7;m=3.58|r=06 52 47.34;d=+33 57 40.9;m=3.60|r=07 25 43.68;d=+27 47 53.8;m=3.78|r=07 04 06.54;d=+20 34 13.1;m=4.01|r=07 35 55.37;d=+26 53 45.6;m=4.06|r=06 28 57.79;d=+20 12 43.8;m=4.13|r=06 04 07.22;d=+23 15 49.1;m=4.16|r=07 29 06.61;d=+31 47 02.7;m=4.16|r=07 43 18.69;d=+28 53 02.7;m=4.23|r=07 11 08.39;d=+30 14 43.0;m=4.41|r=06 43 59.29;d=+13 13 41.3;m=4.49|r=06 54 38.59;d=+13 10 40.9;m=4.71|r=07 39 09.96;d=+34 35 04.7;m=4.89|r=07 46 07.49;d=+18 30 36.6;m=4.89|r=07 53 29.84;d=+26 45 57.1;m=4.97|r=07 29 48.78;d=+27 54 58.3;m=5.01|r=07 23 28.55;d=+25 03 02.2;m=5.04|r=07 39 28.59;d=+17 40 28.3;m=5.04|r=07 13 22.27;d=+16 09 32.6;m=5.07|r=07 29 20.46;d=+28 07 06.3;m=5.07|r=07 21 56.90;d=+20 26 37.4;m=5.09|r=07 47 30.34;d=+33 24 56.8;m=5.14|r=06 42 24.32;d=+17 38 43.9;m=5.20|r=07 02 24.78;d=+24 12 55.6;m=5.20|r=07 27 44.39;d=+21 26 44.0;m=5.20|r=07 33 36.50;d=+15 49 36.1;m=5.27|r=06 51 33.05;d=+21 45 40.4;m=5.28|r=07 44 06.92;d=+25 47 03.2;m=5.30|r=07 55 39.90;d=+19 53 02.6;m=5.38|r=06 44 45.46;d=+28 58 15.6;m=5.42|r=07 08 22.04;d=+15 55 51.3;m=5.47|r=07 38 32.84;d=+35 02 54.5;m=5.58|r=06 50 25.50;d=+13 24 47.5;m=5.68|r=07 00 15.82;d=+16 04 44.4;m=5.73|r=06 55 18.69;d=+25 22 32.3;m=5.73|r=06 09 43.99;d=+23 06 48.5;m=5.75|r=07 11 23.08;d=+26 51 24.0;m=5.75|r=07 15 57.18;d=+27 53 50.7;m=5.75|r=07 24 33.44;d=+27 38 16.1;m=5.77|r=06 11 32.31;d=+24 25 13.4;m=5.83|r=07 14 41.94;d=+24 53 06.7;m=5.84|r=07 12 26.39;d=+24 07 43.3;m=5.85|r=06 49 49.85;d=+16 12 10.5;m=5.85|r=07 26 56.33;d=+20 15 27.3;m=5.94|r=07 05 18.37;d=+22 38 14.9;m=6.00|r=06 16 19.05;d=+23 58 12.2;m=6.09|r=07 23 28.15;d=+22 56 43.6;m=6.17|r=07 48 33.65;d=+23 08 27.5;m=6.18|r=06 58 47.52;d=+26 04 51.1;m=6.20|r=06 27 56.69;d=+20 29 46.6;m=6.22|r=06 16 58.71;d=+23 44 27.3;m=6.24|r=06 32 18.52;d=+17 47 03.4;m=6.26|r=06 01 41.63;d=+22 24 03.8;m=6.36|r=06 31 37.44;d=+15 54 12.7;m=6.38|r=06 59 27.94;d=+25 54 51.1;m=6.40|r=06 41 20.90;d=+28 11 47.9;m=6.45|r=07 12 49.08;d=+27 13 30.2;m=6.46|r=06 45 54.20;d=+12 41 36.8;m=6.47|r=06 12 19.10;d=+22 54 30.7;m=6.51|r=07 45 09.34;d=+20 18 57.8;m=6.53|r=06 27 46.58;d=+20 47 22.6;m=6.54|r=06 18 54.43;d=+23 36 11.9;m=6.58|r=06 06 48.66;d=+23 38 19.0;m=6.67|r=06 36 02.12;d=+16 47 49.5;m=6.73|r=06 10 29.94;d=+22 59 52.4;m=6.88|r=06 19 19.30;d=+23 28 09.9;m=6.91|r=06 19 22.52;d=+23 16 28.2;m=6.95|r=07 12 49.38;d=+25 44 55.3;m=7.05|r=06 28 53.70;d=+20 14 20.0;m=8.00|r=06 27 45.94;d=+20 46 59.6;m=8.59 stary[7]="r=21 47 02.29;d=-16 07 35.6;m=2.85|r=20 21 00.65;d=-14 46 53.0;m=3.05|r=20 18 03.22;d=-12 32 41.5;m=3.58|r=21 40 05.34;d=-16 39 44.1;m=3.69|r=21 26 40.03;d=-22 24 41.0;m=3.77|r=21 05 56.78;d=-17 13 57.8;m=4.08|r=20 51 49.30;d=-26 55 08.9;m=4.12|r=20 46 05.77;d=-25 16 13.9;m=4.13|r=21 22 14.78;d=-16 50 04.4;m=4.27|r=20 17 38.86;d=-12 30 29.6;m=4.30|r=21 07 07.69;d=-25 00 20.7;m=4.49|r=21 28 43.32;d=-21 48 25.8;m=4.50|r=21 37 04.82;d=-19 27 57.6;m=4.51|r=21 42 39.42;d=-18 51 58.7;m=4.72|r=20 20 39.81;d=-12 45 32.6;m=4.77|r=20 28 51.62;d=-17 48 49.2;m=4.77|r=21 04 24.32;d=-19 51 17.8;m=4.82|r=21 53 17.58;d=-13 33 06.5;m=5.07|r=20 27 19.20;d=-18 12 42.1;m=5.08|r=21 45 00.25;d=-09 04 56.7;m=5.10|r=20 40 02.96;d=-18 08 19.0;m=5.15|r=21 41 32.93;d=-14 02 48.7;m=5.16|r=21 15 37.89;d=-20 39 06.1;m=5.17|r=20 39 16.32;d=-14 57 17.0;m=5.24|r=21 42 00.64;d=-23 15 45.5;m=5.24|r=20 19 23.60;d=-19 07 06.6;m=5.28|r=21 08 33.61;d=-21 11 36.7;m=5.30|r=21 15 44.83;d=-15 10 17.4;m=5.31|r=21 24 09.60;d=-20 51 05.6;m=5.38|r=21 17 57.28;d=-17 59 06.5;m=5.40|r=21 46 32.08;d=-11 21 57.4;m=5.57|r=21 34 51.07;d=-20 05 03.8;m=5.70|r=20 54 47.85;d=-17 55 22.3;m=5.78|r=21 27 14.83;d=-21 11 46.1;m=5.78|r=20 12 25.76;d=-12 37 01.3;m=5.84|r=20 18 01.38;d=-21 48 35.6;m=5.86|r=21 43 04.40;d=-14 23 59.1;m=5.88|r=20 46 09.97;d=-21 30 50.4;m=5.91|r=20 29 53.89;d=-18 34 58.7;m=5.94|r=21 44 00.98;d=-14 44 57.8;m=5.96|r=21 46 16.26;d=-09 16 33.4;m=6.00|r=21 00 51.78;d=-17 31 51.1;m=6.07|r=21 09 32.93;d=-20 33 22.8;m=6.25|r=20 59 36.13;d=-19 02 06.8;m=6.26|r=20 16 22.80;d=-12 20 13.5;m=6.30|r=20 11 57.90;d=-12 23 32.5;m=6.34|r=20 29 52.58;d=-18 35 10.2;m=6.74|r=20 37 21.16;d=-15 08 50.0;m=6.76|r=21 46 42.09;d=-11 41 52.2;m=7.01|r=21 18 15.64;d=-17 27 44.2;m=7.07 stary[8]="r=10 08 22.46;d=+11 58 01.9;m=1.36;f=32|r=10 19 58.16;d=+19 50 30.7;m=2.01;f=41|r=11 49 03.88;d=+14 34 20.4;m=2.14;f=94|r=11 14 06.41;d=+20 31 26.5;m=2.56;f=68|r=09 45 51.10;d=+23 46 27.4;m=2.97;f=17|r=11 14 14.44;d=+15 25 47.1;m=3.33;f=70|r=10 16 41.40;d=+23 25 02.4;m=3.43;f=36 stary[8] =stary[8] +"r=10 07 19.95;d=+16 45 45.6;m=3.48;f=30|r=09 41 09.12;d=+09 53 32.6;m=3.52;f=14|r=09 41 13.40;d=+09 54 35.0;m=3.70;f=14|r=10 19 58.60;d=+19 50 26.0;m=3.80;f=41|r=10 32 48.68;d=+09 18 23.7;m=3.84;f=47|r=09 52 45.96;d=+26 00 25.5;m=3.88;f=24|r=11 23 55.37;d=+10 31 46.9;m=4.00;f=78|r=11 21 08.25;d=+06 01 45.7;m=4.05;f=77|r=10 55 36.85;d=+24 44 59.1;m=4.30;f=54|r=11 36 56.93;d=-00 49 25.9;m=4.30;f=91|r=09 31 43.24;d=+22 58 05.0;m=4.32;f=4|r=10 07 54.32;d=+09 59 51.6;m=4.39;f=31|r=11 02 19.78;d=+20 10 47.1;m=4.42;f=60|r=11 16 39.76;d=-03 39 05.5;m=4.45;f=74|r=09 24 39.28;d=+26 10 56.8;m=4.47;f=1|r=11 47 59.23;d=+20 13 08.2;m=4.50;f=93|r=11 15 12.24;d=+23 05 43.9;m=4.56;f=72|r=11 05 01.23;d=+07 20 10.0;m=4.62;f=63|r=10 00 12.82;d=+08 02 39.4;m=4.68;f=29|r=11 01 49.67;d=-02 29 04.2;m=4.73;f=61|r=11 30 18.88;d=-03 00 12.5;m=4.77;f=87|r=10 19 44.31;d=+19 28 17.2;m=4.78;f=40|r=11 00 33.64;d=+03 37 03.1;m=4.84;f=58|r=11 27 56.23;d=+02 51 22.6;m=4.95;f=84|r=11 00 44.83;d=+06 06 05.4;m=4.98;f=59|r=09 31 56.79;d=+11 18 00.1;m=4.99;f=5|r=09 37 12.71;d=+06 50 08.8;m=5.00;f=10|r=09 31 57.58;d=+09 42 56.9;m=5.07;f=6|r=10 34 48.07;d=+06 57 13.0;m=5.07;f=48|r=11 17 17.37;d=+02 00 39.3;m=5.18;f=75|r=09 58 13.39;d=+12 26 41.4;m=5.26;f=27|r=11 40 47.11;d=+21 21 10.2;m=5.26;f=92|r=09 51 53.02;d=+24 23 44.9;m=5.29;f=22|r=11 15 51.90;d=+13 18 27.3;m=5.31;f=73|r=10 49 15.43;d=+10 32 42.9;m=5.32;f=53|r=09 43 43.90;d=+14 01 18.1;m=5.36;f=16|r=11 24 02.34;d=+01 24 27.9;m=5.39;f=79|r=09 28 27.38;d=+09 03 24.4;m=5.40;f=2|r=11 13 45.58;d=-00 04 10.2;m=5.40;f=69|r=10 16 40.75;d=+13 43 42.1;m=5.42;f=37|r=10 32 11.80;d=+14 08 14.0;m=5.43;f=46|r=10 53 43.76;d=-02 07 45.3;m=5.45|r=10 46 25.35;d=+14 11 41.3;m=5.49;f=52|r=10 46 24.49;d=+18 53 29.8;m=5.50;f=51|r=11 06 54.43;d=+01 57 20.6;m=5.52;f=65|r=11 55 40.53;d=+15 38 48.5;m=5.53;f=95|r=11 30 29.08;d=+18 24 35.1;m=5.54;f=86|r=11 25 36.46;d=+16 27 23.6;m=5.58;f=81|r=10 25 15.19;d=+08 47 05.8;m=5.61;f=44|r=09 43 33.27;d=+29 58 29.0;m=5.64;f=15|r=09 46 23.34;d=+11 48 36.0;m=5.67;f=18|r=10 35 02.19;d=+08 39 01.6;m=5.67;f=49|r=10 02 48.96;d=+21 56 57.4;m=5.68|r=11 08 49.08;d=+24 39 30.4;m=5.70;f=67|r=09 28 29.19;d=+08 11 18.1;m=5.72;f=3|r=09 37 02.59;d=+16 26 16.7;m=5.73;f=8|r=11 29 41.86;d=+15 24 48.2;m=5.74;f=85|r=11 34 22.06;d=+03 03 37.5;m=5.76;f=89|r=11 14 01.81;d=+08 03 39.4;m=5.79|r=09 46 10.04;d=+06 42 31.0;m=5.80|r=10 17 14.80;d=+23 06 23.2;m=5.81;f=39|r=09 56 26.03;d=+08 55 59.2;m=5.85;f=(10)|r=09 41 35.11;d=+31 16 40.2;m=5.90|r=11 18 54.98;d=+01 39 01.9;m=5.90;f=76|r=10 55 42.34;d=+00 44 13.0;m=5.91;f=55|r=10 56 01.48;d=+06 11 07.4;m=5.91;f=56|r=10 16 32.42;d=+23 30 10.8;m=5.95;f=35|r=11 03 36.63;d=-00 00 03.0;m=5.95;f=62|r=11 34 42.50;d=+16 47 48.9;m=5.95;f=90|r=10 27 38.99;d=+09 45 44.7;m=6.01;f=45|r=09 47 33.50;d=+11 25 44.0;m=6.02|r=09 58 07.62;d=+08 18 50.6;m=6.05;f=(11)|r=11 23 17.97;d=+00 07 55.4;m=6.05|r=10 23 00.46;d=+06 32 34.4;m=6.06;f=43|r=09 49 50.12;d=+21 10 46.0;m=6.10;f=20|r=10 53 25.04;d=-02 15 18.0;m=6.12|r=11 03 14.55;d=-00 45 07.4;m=6.12|r=10 21 50.32;d=+14 58 32.9;m=6.16;f=42|r=11 27 53.73;d=-01 41 59.8;m=6.23|r=09 41 38.50;d=+25 54 46.6;m=6.26;f=13|r=11 14 33s;d=+25 42 37?;m=6.27|r=11 31 45.14;d=+14 21 53.9;m=6.27;f=88|r=10 55 37.30;d=+24 44 56.0;m=6.30;f=54|r=10 52 36.10;d=-00 12 05.7;m=6.31|r=09 35 52.91;d=+14 22 46.5;m=6.32;f=7|r=11 25 50.10;d=+03 51 36.7;m=6.35;f=80|r=10 52 13.69;d=+01 01 29.9;m=6.37|r=10 46 05.68;d=+06 22 23.8;m=6.38;f=(37)|r=09 23 31.85;d=+25 10 58.2;m=6.41;f=(6)|r=10 11 38.19;d=+13 21 18.7;m=6.43;f=34|r=11 34 58.93;d=-04 21 40.2;m=6.43|r=09 47 25.99;d=+11 34 05.4;m=6.44;f=19|r=09 51 01.97;d=+13 03 58.5;m=6.45;f=23|r=11 35 03.79;d=+20 26 29.6;m=6.45|r=09 58 26.12;d=+27 45 32.6;m=6.48|r=11 07 39.72;d=+23 19 25.5;m=6.48;f=64|r=11 26 45.75;d=+03 00 45.6;m=6.49;f=83|r=09 56 31.36;d=+32 23 04.6;m=6.55;f=(18)|r=09 37 49.96;d=+24 40 13.1;m=6.61;f=9|r=09 38 01.31;d=+14 20 50.8;m=6.63;f=11|r=10 56 10.53;d=+00 25 58.6;m=6.65;f=57|r=11 07 04.91;d=+25 32 13.8;m=6.86;f=(52) EndSub Sub Shapes_InitLn shX=-1500 ' x offset shY=80 ' y offset hh="f=ell;x=346;y=92;w=28;h=61;angle=21;bc=#6E4021;pw=0|f=tri;x=332;y=140;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=204;bc=#6E4021;pw=0|f=ell;x=56;y=84;w=135;h=117;bc=#B48637;pw=0|f=rect;x=388;y=58;w=46;h=31;angle=7;bc=#B48637;pw=0|f=rect;x=377;y=102;w=47;h=20;angle=16;bc=#B48637;pw=0|f=rect;x=265;y=160;w=75;h=53;angle=344;bc=#916C2C;pw=0|f=ell;x=167;y=94;w=169;h=101;bc=#B48637;pw=0|f=rect;x=275;y=184;w=143;h=29;angle=354;bc=#916C2C;pw=0|f=rect;x=255;y=211;w=143;h=29;angle=354;bc=#B48637;pw=0|f=rect;x=249;y=170;w=75;h=53;angle=344;bc=#B48637;pw=0|f=rect;x=400;y=189;w=53;h=31;angle=36;bc=#916C2C;pw=0|f=rect;x=379;y=216;w=53;h=31;angle=36;bc=#B48637;pw=0|f=rect;x=122;y=310;w=53;h=33;angle=21;bc=#916C2C;pw=0|f=rect;x=101;y=220;w=103;h=32;angle=324;bc=#916C2C;pw=0|f=rect;x=74;y=280;w=100;h=30;angle=66;bc=#916C2C;pw=0|f=rect;x=122;y=324;w=53;h=33;angle=21;bc=#B48637;pw=0|f=rect;x=61;y=279;w=100;h=30;angle=66;bc=#B48637;pw=0|f=rect;x=132;y=168;w=67;h=71;angle=324;bc=#916C2C;pw=0|f=rect;x=88;y=218;w=103;h=32;angle=324;bc=#B48637;pw=0|f=rect;x=94;y=154;w=67;h=71;angle=324;bc=#B48637;pw=0|f=rect;x=142;y=90;w=96;h=88;angle=359;bc=#B48637;pw=0|f=tri;x=419;y=61;x1=9;y1=0;x2=0;y2=12;x3=19;y3=12;angle=279;bc=#816027;pw=0|f=ell;x=280;y=50;w=35;h=68;angle=17;bc=#94572D;pw=0|f=ell;x=229;y=76;w=61;h=28;angle=348;bc=#94572D;pw=0|f=ell;x=326;y=62;w=25;h=43;angle=355;bc=#94572D;pw=0|f=ell;x=308;y=11;w=35;h=54;angle=32;bc=#94572D;pw=0|f=ell;x=380;y=10;w=35;h=35;bc=#94572D;pw=0|f=ell;x=309;y=26;w=43;h=30;angle=28;bc=#B48637;pw=0|f=ell;x=325;y=20;w=92;h=94;bc=#B48637;pw=0|f=ell;x=389;y=88;w=39;h=18;angle=5;bc=#000000;pw=0|f=tri;x=421;y=85;x1=4;y1=0;x2=0;y2=17;x3=9;y3=17;angle=180;bc=#B48637;pw=0|f=tri;x=414;y=94;x1=4;y1=0;x2=0;y2=17;x3=9;y3=17;bc=#B48637;pw=0|f=tri;x=405;y=85;x1=4;y1=0;x2=0;y2=17;x3=9;y3=17;angle=180;bc=#B48637;pw=0|f=tri;x=397;y=92;x1=5;y1=0;x2=0;y2=19;x3=10;y3=19;bc=#B48637;pw=0|f=tri;x=390;y=43;x1=7;y1=0;x2=0;y2=18;x3=14;y3=18;angle=304;bc=#000000;pw=0|f=ell;x=365;y=1;w=39;h=22;bc=#94572D;pw=0|f=ell;x=336;y=0;w=43;h=38;bc=#94572D;pw=0|f=ell;x=302;y=54;w=41;h=70;bc=#94572D;pw=0|f=ell;x=323;y=84;w=28;h=61;angle=355;bc=#94572D;pw=0|f=ell;x=325;y=27;w=29;h=44;angle=21;bc=#94572D;pw=0|f=tri;x=374;y=17;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=193;bc=#94572D;pw=0|f=tri;x=348;y=32;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=165;bc=#94572D;pw=0|f=tri;x=338;y=58;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=156;bc=#94572D;pw=0|f=tri;x=326;y=132;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=190;bc=#94572D;pw=0|f=tri;x=308;y=111;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=190;bc=#94572D;pw=0|f=tri;x=289;y=100;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=190;bc=#94572D;pw=0|f=tri;x=262;y=89;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=215;bc=#94572D;pw=0|f=tri;x=220;y=81;x1=10;y1=0;x2=0;y2=27;x3=20;y3=27;angle=257;bc=#94572D;pw=0|f=ell;x=14.97;y=166.34;w=12.13;h=12.13;bc=#916C2C;pw=0|f=ell;x=15.02;y=160.89;w=12.26;h=12.26;bc=#926C2C;pw=0|f=ell;x=15.18;y=155.65;w=12.4;h=12.4;bc=#926D2C;pw=0|f=ell;x=15.43;y=150.59;w=12.53;h=12.53;bc=#936D2C;pw=0|f=ell;x=15.8;y=145.71;w=12.66;h=12.66;bc=#936E2C;pw=0|f=ell;x=16.3;y=140.99;w=12.8;h=12.8;bc=#946E2D;pw=0|f=ell;x=16.92;y=136.41;w=12.93;h=12.93;bc=#956F2D;pw=0|f=ell;x=17.69;y=131.97;w=13.06;h=13.06;bc=#956F2D;pw=0|f=ell;x=18.62;y=127.66;w=13.2;h=13.2;bc=#966F2D;pw=0|f=ell;x=19.7;y=123.45;w=13.33;h=13.33;bc=#96702D;pw=0|f=ell;x=20.96;y=119.35;w=13.46;h=13.46;bc=#97702E;pw=0|f=ell;x=22.4;y=115.32;w=13.6;h=13.6;bc=#98712E;pw=0|f=ell;x=24.04;y=111.37;w=13.73;h=13.73;bc=#98712E;pw=0|f=ell;x=25.87;y=107.48;w=13.86;h=13.86;bc=#99722E;pw=0|f=ell;x=27.92;y=103.64;w=14;h=14;bc=#99722E;pw=0|f=ell;x=30.18;y=99.82;w=14.13;h=14.13;bc=#9A722E;pw=0|f=ell;x=32.68;y=96.03;w=14.26;h=14.26;bc=#9A732F;pw=0|f=ell;x=35.42;y=92.25;w=14.4;h=14.4;bc=#9B732F;pw=0|f=ell;x=38.41;y=88.47;w=14.53;h=14.53;bc=#9C742F;pw=0|f=ell;x=41.66;y=84.66;w=14.66;h=14.66;bc=#9C742F;pw=0|f=ell;x=45.82;y=80.25;w=14.8;h=14.8;bc=#9D752F;pw=0|f=ell;x=48.87;y=75.89;w=14.93;h=14.93;bc=#9D7530;pw=0|f=ell;x=50.86;y=71.64;w=15.06;h=15.06;bc=#9E7530;pw=0|f=ell;x=51.86;y=67.58;w=15.2;h=15.2;bc=#9F7630;pw=0|f=ell;x=51.92;y=63.77;w=15.33;h=15.33;bc=#9F7630;pw=0|f=ell;x=51.11;y=60.27;w=15.46;h=15.46;bc=#A07730;pw=0|f=ell;x=49.47;y=57.15;w=15.6;h=15.6;bc=#A07730;pw=0|f=ell;x=47.08;y=54.48;w=15.73;h=15.73;bc=#A17831;pw=0|f=ell;x=43.98;y=52.32;w=15.86;h=15.86;bc=#A17831;pw=0|f=ell;x=40.25;y=50.75;w=16;h=16;bc=#A27931;pw=0|f=ell;x=35.92;y=49.81;w=16.13;h=16.13;bc=#A37931;pw=0|f=ell;x=31.07;y=49.59;w=16.26;h=16.26;bc=#A37931;pw=0|f=ell;x=25.75;y=50.14;w=16.4;h=16.4;bc=#A47A32;pw=0|f=ell;x=20.02;y=51.54;w=16.53;h=16.53;bc=#A47A32;pw=0|f=ell;x=13.94;y=53.85;w=16.66;h=16.66;bc=#A57B32;pw=0|f=ell;x=7.57;y=57.13;w=16.8;h=16.8;bc=#A67B32;pw=0|f=ell;x=0.97;y=61.45;w=16.93;h=16.93;bc=#A67C32;pw=0|f=ell;x=-5.82;y=66.88;w=17.06;h=17.06;bc=#A77C32;pw=0|f=ell;x=-12.71;y=73.49;w=17.2;h=17.2;bc=#A77C33;pw=0|f=ell;x=-19.67;y=81.33;w=17.33;h=17.33;bc=#A87D33;pw=0|f=ell;x=-23.18;y=86.57;w=17.46;h=17.46;bc=#A87D33;pw=0|f=ell;x=-25.81;y=91.89;w=17.6;h=17.6;bc=#A97E33;pw=0|f=ell;x=-27.56;y=97.18;w=17.73;h=17.73;bc=#AA7E33;pw=0|f=ell;x=-28.47;y=102.38;w=17.86;h=17.86;bc=#AA7F34;pw=0|f=ell;x=-28.55;y=107.4;w=18;h=18;bc=#AB7F34;pw=0|f=ell;x=-27.84;y=112.16;w=18.13;h=18.13;bc=#AB7F34;pw=0|f=ell;x=-26.35;y=116.57;w=18.26;h=18.26;bc=#AC8034;pw=0|f=ell;x=-24.11;y=120.56;w=18.4;h=18.4;bc=#AD8034;pw=0|f=ell;x=-21.14;y=124.03;w=18.53;h=18.53;bc=#AD8134;pw=0|f=ell;x=-17.46;y=126.91;w=18.66;h=18.66;bc=#AE8135;pw=0|f=ell;x=-13.11;y=129.12;w=18.8;h=18.8;bc=#AE8235;pw=0|f=ell;x=-8.09;y=130.57;w=18.93;h=18.93;bc=#AF8235;pw=0|f=ell;x=-2.43;y=131.18;w=19.06;h=19.06;bc=#AF8235;pw=0|f=ell;x=3.83;y=130.87;w=19.2;h=19.2;bc=#B08335;pw=0|f=ell;x=10.69;y=129.55;w=19.33;h=19.33;bc=#B18336;pw=0|f=ell;x=18.11;y=127.14;w=19.46;h=19.46;bc=#B18436;pw=0|f=ell;x=26.07;y=123.57;w=19.6;h=19.6;bc=#B28436;pw=0|f=ell;x=34.56;y=118.74;w=19.73;h=19.73;bc=#B28536;pw=0|f=ell;x=43.54;y=112.58;w=19.86;h=19.86;bc=#B38536;pw=0|f=ell;x=53;y=105;w=20;h=20;bc=#B48637;pw=0|f=ell;x=422;y=241;w=18;h=27;angle=342;bc=#B48637;pw=0|f=ell;x=410;y=245;w=17;h=27;angle=344;bc=#B48637;pw=0|f=ell;x=445;y=207;w=19;h=24;angle=334;bc=#916C2C;pw=0|f=ell;x=443;y=214;w=18;h=27;angle=342;bc=#916C2C;pw=0|f=ell;x=435;y=220;w=17;h=27;angle=344;bc=#916C2C;pw=0|f=ell;x=425;y=234;w=19;h=24;angle=334;bc=#B48637;pw=0|f=ell;x=172;y=318;w=18;h=27;angle=319;bc=#916C2C;pw=0|f=ell;x=170;y=332;w=18;h=27;angle=342;bc=#916C2C;pw=0|f=ell;x=167;y=327;w=19;h=30;angle=305;bc=#B48637;pw=0|f=ell;x=171;y=341;w=18;h=27;angle=319;bc=#B48637;pw=0|f=ell;x=160;y=346;w=18;h=27;angle=319;bc=#B48637;pw=0|f=ell;x=3;y=173;w=26;h=49;angle=12;bc=#94572D;pw=0|f=tri;x=8;y=206;x1=8;y1=0;x2=0;y2=26;x3=17;y3=26;angle=190;bc=#94572D;pw=0|f=tri;x=0;y=199;x1=6;y1=0;x2=0;y2=25;x3=12;y3=25;angle=197;bc=#94572D;pw=0|f=tri;x=2;y=206;x1=8;y1=0;x2=0;y2=33;x3=16;y3=33;angle=193;bc=#94572D;pw=0|f=tri;x=346;y=136;x1=7;y1=0;x2=0;y2=31;x3=15;y3=31;angle=197;bc=#6E4021;pw=0 h_=ldtext.Split (hh "|") EndSub Sub DrawGrids GraphicsWindow.PenWidth=1 GraphicsWindow.PenColor="DimGray" GraphicsWindow.BrushColor="DimGray" GraphicsWindow.FontSize=12 y1=0 ww=1 y2=GraphicsWindow.Height For ra=0 To 23 RADec2XY() ltx[ww]=Shapes.AddLine(x, y1, x, y2) LDShapes.ZIndex (ltx[ww],2222) raTxt=ra If wrap And raTxt < 0 Then raTxt=raTxt + 24 EndIf txx[ww]=Shapes.AddText(raTxt + "h") Shapes.Move(txx[ww], x, 5) ww=ww+1 EndFor x1=0 x2=GraphicsWindow.Width For dec=-40 To 40 Step 10 If dec > 0 Then dec=Text.Append("+", Math.Abs(dec)) EndIf RADec2XY() lii=Shapes.AddLine(x1, y, x2, y) LDShapes.ZIndex (lii,2222) txt=Shapes.AddText(dec) Shapes.Move(txt, x1, y) EndFor EndSub Sub RADec2XY ' param ra - right ascension ' param dec - declination ' return x, y x=Text.GetSubText(ra, 1, 2) If wrap And 12 < x Then x=x - 24 EndIf x=x + Text.GetSubText(ra, 4, 2) / 60 x=x + Text.GetSubText(ra, 7, 5) / 3600 x=offsetX - (x - raMin) * 3600 / 24 y=Text.GetSubText(dec, 2, 2) y=y + Text.GetSubText(dec, 5, 2) / 60 y=y + Text.GetSubText(dec, 8, 5) / 3600 y=y * Text.Append(Text.GetSubText(dec, 1, 1), "1") y=offsetY - y * 3600 / 360 EndSub Sub Shapes_Init shX=41 ' x offset shY=110 ' y offset h_="" h_[1]="f=ell;x=76;y=10;w=63;h=119;angle=23;bc=#2F559D;pw=0 h_[2]="f=tri;x=70;y=94;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=25;bc=#2F559D;pw=0 h_[3]="f=tri;x=108;y=0;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=199;bc=#000055;pw=0 h_[4]="f=ell;x=118;y=34;w=20;h=21;bc=#000055;pw=0 h_[5]="f=ell;x=74;y=40;w=12;h=32;angle=58;bc=#2F559D;pw=0 h_[6]="f=ell;x=121;y=72;w=15;h=40;angle=17;bc=#2F559D;pw=0 h_[7]="f=ell;x=342;y=195;w=63;h=119;angle=106;bc=#2F559D;pw=0 h_[8]="f=tri;x=304;y=210;x1=17;y1=0;x2=0;y2=60;x3=35;y3=60;angle=105;bc=#2F559D;pw=0 h_[9]="f=tri;x=401;y=258;x1=14;y1=0;x2=0;y2=36;x3=28;y3=36;angle=295;bc=#000055;pw=0 h_[10]="f=ell;x=397;y=243;w=20;h=21;bc=#000055;pw=0 h_[11]="f=ell;x=367;y=203;w=15;h=40;angle=112;bc=#2F559D;pw=0 h_[12]="f=ell;x=361;y=271;w=12;h=32;angle=58;bc=#2F559D;pw=0 h_[13]="f=line;x=43;y=130;x1=39;y1=0;x2=0;y2=72;pc=#2F559D;pw=8 h_[14]="f=line;x=0;y=201;x1=0;y1=74;x2=44;y2=0;pc=#2F559D;pw=8 h_[15]="f=line;x=2;y=238;x1=0;y1=35;x2=42;y2=0;pc=#2F559D;pw=8 h_[16]="f=line;x=41;y=242;x1=18;y1=31;x2=0;y2=0;pc=#2F559D;pw=8 h_[17]="f=line;x=56;y=271;x1=0;y1=1;x2=30;y2=0;pc=#2F559D;pw=8 h_[18]="f=line;x=82;y=232;x1=0;y1=38;x2=1;y2=0;pc=#2F559D;pw=8 h_[19]="f=line;x=83;y=230;x1=0;y1=6;x2=65;y2=0;pc=#2F559D;pw=8 h_[20]="f=line;x=143;y=230;x1=0;y1=0;x2=79;y2=7;pc=#2F559D;pw=8 h_[21]="f=line;x=217;y=234;x1=0;y1=2;x2=98;y2=0;pc=#2F559D;pw=8 EndSub Sub Shapes_Add j=1 Stack.PushValue("local", i) Stack.PushValue("local", x) Stack.PushValue("local", y) Shapes_CalcWidthAndHeight() s=scale For i=1 To Array.GetItemCount(h_) shp=h_[i] GraphicsWindow.PenWidth=shp["pw"] * s If shp["pw"] > 0 Then GraphicsWindow.PenColor=shp["pc"] EndIf If Text.IsSubText("rect|ell|tri|text", shp["f"]) Then GraphicsWindow.BrushColor=shp["bc"] EndIf If shp["f"]="rect" Then shpp=Shapes.AddRectangle(shp["w"] * s, shp["h"] * s) ElseIf shp["f"]="ell" Then shpp=Shapes.AddEllipse(shp["w"] * s, shp["h"] * s) ElseIf shp["f"]="tri" Then shpp=Shapes.AddTriangle(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s, shp["x3"] * s, shp["y3"] * s) ElseIf shp["f"]="line" Then shpp=Shapes.AddLine(shp["x1"] * s, shp["y1"] * s, shp["x2"] * s, shp["y2"] * s) EndIf LDShapes.ZIndex (shpp,zii) zii=zii+1 x=shp["x"] y=shp["y"] shp["rx"]=x shp["ry"]=y ffs[qi][j]=LDFastShapes.ShapeIndex(shpp) ldfastShapes.Move(ffs[qi][j], shX + x * s, shY + y * s) If Text.IsSubText("rect|ell|tri", shp["f"]) And (shp["angle"] <> 0) And (shp["angle"] <> "") Then ldfastShapes.Rotate(ffs[qi][j], shp["angle"]) EndIf 'h_[i]=shpp j=j+1 EndFor LDFastShapes.Update () shAngle=0 y=Stack.PopValue("local") x=Stack.PopValue("local") i=Stack.PopValue("local") EndSub Sub Shapes_CalcWidthAndHeight For i=1 To Array.GetItemCount(H_) shp=h_[i] If shp["f"]="tri" Or shp["f"]="line" Then xmin=shp["x1"] xmax=shp["x1"] ymin=shp["y1"] ymax=shp["y1"] If shp["x2"] < xmin Then xmin=shp["x2"] EndIf If xmax < shp["x2"] Then xmax=shp["x2"] EndIf If shp["y2"] < ymin Then ymin=shp["y2"] EndIf If ymax < shp["y2"] Then ymax=shp["y2"] EndIf If shp["f"]="tri" Then If shp["x3"] < xmin Then xmin=shp["x3"] EndIf If xmax < shp["x3"] Then xmax=shp["x3"] EndIf If shp["y3"] < ymin Then ymin=shp["y3"] EndIf If ymax < shp["y3"] Then ymax=shp["y3"] EndIf EndIf shp["w"]=xmax - xmin shp["h"]=ymax - ymin EndIf If i=1 Then shWidth=shp["x"] + shp["w"] shHeight=shp["y"] + shp["h"] Else If shWidth < shp["x"] + shp["w"] Then shWidth=shp["x"] + shp["w"] EndIf If shHeight < shp["y"] + shp["h"] Then shHeight=shp["y"] + shp["h"] EndIf EndIf h_[i]=shp EndFor EndSub Sub Shapes_Move Stack.PushValue("local", i) s=scale shX=x shY=y For i=1 To Array.GetItemCount(h_) shp=h_[i] _x=shp["rx"] _y=shp["ry"] shapes.Move(shp["obj"], shX + _x * s, shY + _y * s) EndFor i=Stack.PopValue("local") EndSub Sub Shapes_Initaq shX=384 ' x offset shY=315 ' y offset hh="f=ell;x=92;y=62;w=56;h=31;angle=30;bc=#204040;pw=0|f=ell;x=106;y=0;w=73;h=86;angle=32;bc=#204040;pw=0|f=ell;x=101;y=72;w=37;h=14;angle=28;bc=#102020;pw=0|f=tri;x=63;y=39;x1=31;y1=0;x2=0;y2=155;x3=63;y3=155;angle=38;bc=#204040;pw=0|f=ell;x=37;y=173;w=36;h=100;angle=10;bc=#204040;pw=0|f=ell;x=12;y=155;w=34;h=118;angle=17;bc=#204040;pw=0|f=ell;x=0;y=151;w=28;h=90;angle=24;bc=#204040;pw=0|f=ell;x=238;y=26;w=55;h=71;angle=28;bc=#204040;pw=0|f=rect;x=234;y=78;w=22;h=34;angle=32;bc=#204040;pw=0|f=rect;x=179;y=95;w=87;h=81;angle=31;bc=#204040;pw=0|f=rect;x=256;y=144;w=67;h=22;angle=53;bc=#204040;pw=0|f=rect;x=299;y=165;w=65;h=19;angle=348;bc=#204040;pw=0|f=rect;x=144;y=94;w=74;h=22;angle=334;bc=#204040;pw=0|f=rect;x=137;y=62;w=18;h=69;angle=358;bc=#204040;pw=0|f=rect;x=153;y=160;w=89;h=54;angle=19;bc=#204040;pw=0|f=rect;x=99;y=186;w=75;h=30;angle=341;bc=#204040;pw=0|f=rect;x=130;y=220;w=96;h=31;angle=328;bc=#204040;pw=0|f=ell;x=80;y=199;w=35;h=34;bc=#204040;pw=0|f=ell;x=117;y=247;w=35;h=39;bc=#204040;pw=0|f=rect;x=128;y=274;w=28;h=56;angle=345;bc=#204040;pw=0|f=rect;x=80;y=217;w=27;h=74;bc=#204040;pw=0|f=ell;x=248;y=49;w=14;h=14;bc=#102020;pw=0|f=ell;x=268;y=60;w=14;h=14;bc=#102020;pw=0|f=ell;x=258;y=17;w=21;h=22;bc=#204040;pw=0|f=ell;x=274;y=19;w=21;h=22;bc=#204040;pw=0|f=ell;x=285;y=32;w=21;h=22;bc=#204040;pw=0|f=ell;x=289;y=49;w=21;h=22;bc=#204040;pw=0|f=ell;x=241;y=21;w=21;h=22;bc=#204040;pw=0|f=ell;x=280;y=65;w=21;h=22;bc=#204040;pw=0|f=ell;x=229;y=35;w=21;h=22;bc=#204040;pw=0|f=ell;x=359;y=148;w=32;h=31;bc=#204040;pw=0|f=ell;x=357;y=155;w=13;h=73;angle=6;bc=#204040;pw=0|f=ell;x=385;y=162;w=14;h=78;angle=345;bc=#204040;pw=0|f=tri;x=58;y=270;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=265;bc=#204040;pw=0|f=tri;x=116;y=308;x1=17;y1=0;x2=0;y2=62;x3=35;y3=62;angle=261;bc=#204040;pw=0 h_=ldtext.Split (hh "|") EndSub Sub Shapes_Initcc shX=640 ' x offset shY=441 ' y offset h_="" h_[1]="f=rect;x=191;y=68;w=44;h=86;bc=#83809C;pw=0 h_[2]="f=tri;x=179;y=6;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=339;bc=#83809C;pw=0 h_[3]="f=tri;x=207;y=0;x1=8;y1=0;x2=0;y2=73;x3=17;y3=73;angle=343;bc=#83809C;pw=0 h_[4]="f=line;x=171;y=144;x1=26;y1=46;x2=0;y2=0;pc=#83809C;pw=16 h_[5]="f=line;x=193;y=188;x1=0;y1=0;x2=58;y2=24;pc=#83809C;pw=16 h_[6]="f=line;x=149;y=145;x1=21;y1=68;x2=0;y2=0;pc=#83809C;pw=16 h_[7]="f=line;x=102;y=200;x1=64;y1=6;x2=0;y2=0;pc=#83809C;pw=16 h_[8]="f=ell;x=1;y=82;w=97;h=99;bc=#83809C;pw=0 h_[9]="f=ell;x=59;y=72;w=144;h=87;angle=351;bc=#83809C;pw=0 h_[10]="f=tri;x=0;y=54;x1=39;y1=0;x2=0;y2=73;x3=79;y3=73;angle=173;bc=#83809C;pc=#000055;pw=4 h_[11]="f=ell;x=35;y=123;w=15;h=16;bc=#191970;pw=0 h_[12]="f=ell;x=210;y=93;w=15;h=16;bc=#191970;pw=0 h_[13]="f=tri;x=155;y=63;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=206;bc=#83809C;pw=0 h_[14]="f=tri;x=223;y=67;x1=20;y1=0;x2=0;y2=20;x3=41;y3=20;angle=164;bc=#83809C;pw=0 h_[15]="f=line;x=208;y=141;x1=0;y1=0;x2=8;y2=18;pc=#191970;pw=4 h_[16]="f=tri;x=192;y=151;x1=6;y1=0;x2=0;y2=38;x3=13;y3=38;angle=181;bc=#83809C;pw=0 h_[17]="f=tri;x=29;y=91;x1=24;y1=0;x2=0;y2=47;x3=48;y3=47;angle=172;bc=#83809C;pw=0 h_[18]="f=line;x=211;y=101;x1=0;y1=0;x2=12;y2=0;pc=#191970;pw=4 EndSub Sub Shapes_Initary shX=-200 ' x offset shY=133 ' y offset hh="f=ell;x=62;y=33;w=99;h=97;bc=#5E5E5E;pw=0|f=ell;x=0;y=59;w=67;h=37;angle=348;bc=#5E5E5E;pw=0|f=ell;x=45;y=80;w=2;h=0;bc=#5E5E5E;pw=0|f=ell;x=222;y=0;w=47;h=48;bc=#000000;pc=#5E5E5E;pw=16|f=ell;x=186;y=58;w=99;h=97;bc=#5E5E5E;pw=0|f=rect;x=107;y=44;w=127;h=98;angle=11;bc=#5E5E5E;pw=0|f=rect;x=68;y=139;w=103;h=17;angle=28;bc=#5E5E5E;pw=0|f=rect;x=196;y=147;w=70;h=16;angle=27;bc=#5E5E5E;pw=0|f=rect;x=192;y=164;w=70;h=16;angle=356;bc=#5E5E5E;pw=0|f=rect;x=218;y=141;w=70;h=16;angle=9;bc=#5E5E5E;pw=0|f=rect;x=238;y=172;w=70;h=16;angle=292;bc=#5E5E5E;pw=0|f=ell;x=218;y=36;w=37;h=54;angle=34;bc=#5E5E5E;pc=#000000;pw=4|f=ell;x=229;y=11;w=78;h=78;bc=#5E5E5E;pw=0|f=ell;x=255;y=51;w=20;h=20;bc=#000000;pw=0|f=line;x=218;y=71;x1=0;y1=4;x2=11;y2=0;pc=#000000;pw=4|f=tri;x=238;y=76;x1=40;y1=0;x2=0;y2=25;x3=80;y3=25;angle=288;bc=#5E5E5E;pw=0|f=ell;x=287;y=27;w=47;h=48;bc=#000000;pc=#5E5E5E;pw=16|f=line;x=284;y=49;x1=0;y1=0;x2=26;y2=9;pc=#000000;pw=4|f=line;x=284;y=49;x1=18;y1=32;x2=0;y2=0;pc=#000000;pw=4|f=tri;x=165;y=161;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0|f=tri;x=162;y=168;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0|f=tri;x=252;y=205;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=210;bc=#5E5E5E;pw=0|f=tri;x=246;y=203;x1=7;y1=0;x2=0;y2=27;x3=15;y3=27;angle=214;bc=#5E5E5E;pw=0|f=tri;x=179;y=160;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0|f=tri;x=182;y=153;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=294;bc=#5E5E5E;pw=0|f=rect;x=97;y=127;w=103;h=17;angle=12;bc=#5E5E5E;pw=0|f=tri;x=196;y=140;x1=6;y1=0;x2=0;y2=28;x3=13;y3=28;angle=133;bc=#5E5E5E;pw=0 h_=ldtext.Split (hh "|") EndSub Sub shpcnc shX=-1040 ' x offset shY=77 ' y offset hh="f=ell;x=60;y=44;w=126;h=181;bc=#661F1F;pc=#000055;pw=2|f=ell;x=54;y=99;w=21;h=21;bc=#661F1F;pc=#000055;pw=2|f=ell;x=56;y=145;w=21;h=21;bc=#661F1F;pc=#000055;pw=2|f=rect;x=73;y=22;w=27;h=23;angle=12;bc=#661F1F;pc=#000055;pw=2|f=rect;x=96;y=30;w=24;h=22;angle=21;bc=#661F1F;pc=#000055;pw=2|f=rect;x=49;y=209;w=29;h=22;bc=#661F1F;pc=#000055;pw=2|f=rect;x=70;y=207;w=24;h=19;angle=327;bc=#661F1F;pc=#000055;pw=2|f=tri;x=107;y=15;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=332;bc=#661F1F;pc=#000055;pw=2|f=tri;x=131;y=12;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=338;bc=#661F1F;pc=#000055;pw=2|f=tri;x=152;y=21;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=346;bc=#661F1F;pc=#000055;pw=2|f=tri;x=170;y=34;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=351;bc=#661F1F;pc=#000055;pw=2|f=tri;x=103;y=218;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2|f=tri;x=127;y=217;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2|f=tri;x=142;y=219;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2|f=tri;x=161;y=206;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=214;bc=#661F1F;pc=#000055;pw=2|f=tri;x=49;y=102;x1=7;y1=0;x2=0;y2=37;x3=14;y3=37;angle=290;bc=#661F1F;pc=#000055;pw=2|f=tri;x=49;y=122;x1=7;y1=0;x2=0;y2=36;x3=14;y3=36;angle=264;bc=#661F1F;pc=#000055;pw=2|f=rect;x=127;y=77;w=14;h=33;angle=351;bc=#661F1F;pc=#000055;pw=2|f=rect;x=141;y=74;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=rect;x=158;y=84;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=rect;x=169;y=96;w=14;h=33;angle=10;bc=#661F1F;pc=#000055;pw=2|f=rect;x=122;y=161;w=14;h=33;angle=7;bc=#661F1F;pc=#000055;pw=2|f=rect;x=136;y=162;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=rect;x=153;y=160;w=14;h=33;angle=352;bc=#661F1F;pc=#000055;pw=2|f=rect;x=167;y=150;w=14;h=33;angle=351;bc=#661F1F;pc=#000055;pw=2|f=rect;x=120;y=48;w=14;h=33;angle=338;bc=#661F1F;pc=#000055;pw=2|f=rect;x=139;y=46;w=14;h=33;angle=351;bc=#661F1F;pc=#000055;pw=2|f=rect;x=158;y=55;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=rect;x=173;y=67;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=rect;x=117;y=191;w=14;h=33;angle=12;bc=#661F1F;pc=#000055;pw=2|f=rect;x=136;y=194;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=rect;x=154;y=192;w=14;h=33;angle=7;bc=#661F1F;pc=#000055;pw=2|f=rect;x=170;y=181;w=14;h=33;bc=#661F1F;pc=#000055;pw=2|f=ell;x=70;y=99;w=114;h=68;bc=#661F1F;pc=#000055;pw=2|f=ell;x=14;y=0;w=50;h=102;angle=45;bc=#661F1F;pc=#000055;pw=2|f=ell;x=0;y=132;w=49;h=105;angle=342;bc=#661F1F;pc=#000055;pw=2|f=tri;x=16;y=34;x1=18;y1=0;x2=0;y2=66;x3=36;y3=66;angle=30;bc=#000055;pw=0|f=tri;x=13;y=130;x1=11;y1=0;x2=0;y2=73;x3=23;y3=73;angle=168;bc=#000055;pw=0|f=ell;x=54;y=99;w=21;h=21;bc=#33000000;pc=#000055;pw=2|f=ell;x=56;y=145;w=21;h=21;bc=#33000000;pc=#000055;pw=2 h_=ldtext.Split (hh "|") EndSub Sub Shapes_Initgmm shX=-840 ' x offset shY=-11 ' y offset hh="f=ell;x=34;y=69;w=54;h=52;bc=#A4825B;pw=0|f=ell;x=0;y=117;w=54;h=52;bc=#A4825B;pw=0|f=ell;x=30;y=144;w=41;h=61;angle=33;bc=#A4825B;pw=0|f=rect;x=109;y=201;w=44;h=21;bc=#A4825B;pw=0|f=rect;x=91;y=224;w=44;h=21;angle=4;bc=#A4825B;pw=0|f=rect;x=138;y=221;w=67;h=20;angle=43;bc=#A4825B;pw=0|f=rect;x=118;y=244;w=67;h=20;angle=43;bc=#A4825B;pw=0|f=rect;x=141;y=164;w=61;h=23;angle=335;bc=#A4825B;pw=0|f=rect;x=172;y=143;w=44;h=21;angle=335;bc=#A4825B;pw=0|f=rect;x=196;y=156;w=67;h=20;angle=43;bc=#A4825B;pw=0|f=rect;x=177;y=180;w=67;h=20;angle=57;bc=#A4825B;pw=0|f=ell;x=245;y=179;w=41;h=16;angle=333;bc=#A4825B;pw=0|f=ell;x=218;y=210;w=41;h=16;angle=349;bc=#A4825B;pw=0|f=ell;x=187;y=246;w=41;h=16;angle=349;bc=#A4825B;pw=0|f=ell;x=161;y=269;w=41;h=20;angle=7;bc=#A4825B;pw=0|f=rect;x=77;y=121;w=101;h=50;angle=39;bc=#A4825B;pw=0|f=rect;x=34;y=169;w=85;h=53;angle=38;bc=#A4825B;pw=0|f=rect;x=106;y=86;w=53;h=22;angle=348;bc=#A4825B;pw=0|f=rect;x=148;y=69;w=51;h=20;angle=325;bc=#A4825B;pw=0|f=tri;x=133;y=0;x1=11;y1=0;x2=0;y2=42;x3=23;y3=42;angle=305;bc=#624E37;pw=0|f=line;x=156;y=28;x1=0;y1=0;x2=89;y2=60;pc=#624E37;pw=4|f=tri;x=230;y=74;x1=12;y1=0;x2=0;y2=20;x3=24;y3=20;angle=307;bc=#624E37;pw=0|f=rect;x=248;y=84;w=25;h=28;angle=304;bc=#624E37;pw=0|f=tri;x=252;y=94;x1=15;y1=0;x2=0;y2=18;x3=30;y3=18;angle=307;bc=#000000;pw=0|f=rect;x=91;y=174;w=51;h=19;angle=358;bc=#A4825B;pc=#000000;pw=2|f=ell;x=130;y=169;w=29;h=25;bc=#A4825B;pw=0|f=rect;x=32;y=189;w=20;h=48;angle=350;bc=#A4825B;pw=0|f=rect;x=36;y=222;w=46;h=18;bc=#A4825B;pw=0|f=rect;x=64;y=241;w=9;h=0;bc=#A4825B;pw=0|f=rect;x=55;y=136;w=44;h=20;angle=324;bc=#A4825B;pw=0|f=rect;x=62;y=151;w=56;h=22;angle=74;bc=#A4825B;pc=#000000;pw=2|f=ell;x=86;y=169;w=23;h=23;angle=347;bc=#A4825B;pw=0|f=ell;x=77;y=87;w=42;h=63;angle=44;bc=#A4825B;pw=0|f=ell;x=73;y=221;w=27;h=23;angle=13;bc=#A4825B;pw=0|f=ell;x=103;y=116;w=61;h=64;angle=316;bc=#624E37;pw=0|f=ell;x=111;y=128;w=40;h=34;angle=313;bc=#A4825B;pw=0|f=rect;x=104;y=120;w=25;h=23;angle=315;bc=#A4825B;pw=0|f=ell;x=93;y=117;w=19;h=30;angle=318;bc=#624E37;pw=0|f=ell;x=108;y=102;w=19;h=30;angle=318;bc=#624E37;pw=0|f=line;x=118;y=134;x1=0;y1=0;x2=29;y2=27;pc=#624E37;pw=2|f=line;x=111;y=135;x1=0;y1=0;x2=29;y2=29;pc=#624E37;pw=2|f=line;x=121;y=128;x1=0;y1=0;x2=28;y2=27;pc=#624E37;pw=2|f=ell;x=89;y=119;w=15;h=29;angle=340;bc=#A4825B;pw=0|f=ell;x=113;y=95;w=15;h=29;angle=291;bc=#A4825B;pw=0|f=ell;x=184;y=40;w=26;h=33;angle=352;bc=#A4825B;pw=0|f=rect;x=107;y=130;w=22;h=9;angle=313;bc=#624E37;pw=0|f=rect;x=131;y=152;w=22;h=9;angle=315;bc=#624E37;pw=0|f=tri;x=126;y=106;x1=6;y1=0;x2=0;y2=10;x3=12;y3=10;angle=294;bc=#000000;pw=0|f=ell;x=68;y=74;w=26;h=19;angle=39;bc=#A4825B;pw=0|f=ell;x=2;y=152;w=26;h=19;angle=231;bc=#A4825B;pw=0|f=ell;x=60;y=84;w=13;h=13;bc=#000000;pw=0|f=ell;x=48;y=99;w=13;h=13;bc=#000000;pw=0|f=ell;x=32;y=122;w=13;h=13;bc=#000000;pw=0|f=ell;x=20;y=137;w=13;h=13;bc=#000000;pw=0 h_=ldtext.Split (hh "|") EndSub Sub Shapes_Init_tau shX=-500 ' x offset shY=64 ' y offset hh="f=ell;x=75;y=49;w=86;h=134;angle=24;bc=#000055;pc=#66411F;pw=16|f=rect;x=56;y=71;w=67;h=57;angle=24;bc=#000055;pw=0|f=ell;x=71;y=29;w=52;h=53;bc=#66411F;pw=0|f=ell;x=34;y=105;w=52;h=53;bc=#66411F;pw=0|f=ell;x=58;y=0;w=70;h=68;bc=#000055;pw=0|f=ell;x=0;y=107;w=73;h=75;bc=#000055;pw=0|f=ell;x=240;y=111;w=148;h=154;bc=#66411F;pw=0|f=rect;x=213;y=213;w=104;h=37;angle=334;bc=#66411F;pw=0|f=rect;x=202;y=265;w=105;h=29;angle=33;bc=#66411F;pw=0|f=rect;x=148;y=190;w=104;h=37;angle=358;bc=#66411F;pw=0|f=rect;x=113;y=245;w=105;h=29;angle=76;bc=#66411F;pw=0|f=ell;x=132;y=187;w=48;h=46;bc=#66411F;pw=0|f=ell;x=194;y=228;w=48;h=46;bc=#66411F;pw=0|f=ell;x=200;y=119;w=3;h=1;bc=#66411F;pw=0|f=rect;x=199;y=78;w=178;h=88;angle=351;bc=#66411F;pw=0|f=ell;x=117;y=83;w=105;h=120;angle=34;bc=#66411F;pc=#000055;pw=4|f=ell;x=183;y=123;w=23;h=24;bc=#000055;pw=0|f=ell;x=171;y=50;w=23;h=54;angle=42;bc=#66411F;pw=0|f=ell;x=108;y=163;w=23;h=54;angle=20;bc=#66411F;pw=0|f=ell;x=166;y=150;w=85;h=67;angle=315;bc=#66411F;pc=#000055;pw=4|f=ell;x=217;y=173;w=12;h=15;bc=#000055;pw=0|f=ell;x=193;y=197;w=11;h=16;angle=260;bc=#000055;pw=0|f=ell;x=179;y=136;w=30;h=68;angle=46;bc=#66411F;pw=0|f=tri;x=135;y=311;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=270;bc=#66411F;pw=0|f=tri;x=157;y=306;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=69;bc=#66411F;pw=0|f=tri;x=260;y=311;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=233;bc=#66411F;pw=0|f=tri;x=272;y=293;x1=34;y1=0;x2=0;y2=25;x3=68;y3=25;angle=32;bc=#66411F;pw=0|f=ell;x=321;y=44;w=73;h=67;bc=#000055;pw=0|f=ell;x=329;y=104;w=73;h=67;bc=#000055;pw=0|f=ell;x=325;y=155;w=74;h=70;bc=#000055;pw=0|f=ell;x=325;y=211;w=74;h=70;bc=#000055;pw=0 h_=ldtext.Split (hh "|") EndSub End>XDK566.sb< Start>XDM133.sb< '*************************************************** ' Chomper (SBC) Release 2 - online version ' Pacman-style game (BETA) 'Version 2.5.23.2013 ' 'Tony's Home-Made Software 2013 ' ' Designed & coded in BASIC by Anthony Yarrell (QBasicLover in the SB forums) ' Designed for Microsoft Small Basic 1.0 ' March 2013 ' 'Sprites created using Microsoft Paint 'Maze designed using Microsoft Excel ' '*************************************************** 'These variables control game play: BRAND_NEW_GAME = 0 PLAY_LEVEL = 1 ADVANCE_LEVEL = 2 REPLAY_LEVEL = 3 GAME_OVER = 4 DIAGNOSTIC = 5 gameState = BRAND_NEW_GAME 'Initialization: gameSpeed = 40 'Decrease if game runs too slowly mazeScale = 12 'Size of maze and distance between invisibele maze tiles. gameScreenHeight = 380 gamescreenWidth = 335 globalCycleCtr = 0 'Used for syncronization. Updated once per game loop cycle. initialCountDownTime = 80 'Amount of time (cycles) the monsters stay "frightened" gameScore = 0 gameLevel = 0 hasEatenEnergizer = "FALSE" hasEatenPellet = "FALSE" isTouching = "FALSE" ModeSwitchTime = 0 GraphicsWindow.KeyDown = keyboardHandler 'Game loop While (gameState <> GAME_OVER) start = Clock.ElapsedMilliseconds globalCycleCtr = globalCycleCtr + 1 If (gameState = BRAND_NEW_GAME) Then InitializeLookupTables() SetupGraphicsWindow() LoadBitmaps() InitializeSprites() SpriteArray[SBC][Lives] = 3 gameState = ADVANCE_LEVEL ElseIf (gameState = ADVANCE_LEVEL) Then SmallDelay() ModeSwitchCounter = 0 globalCycleCtr = 0 monstersEatenPerLevel = 0 selectedRotation = 0 'SBC goes through 4 max rotations. UpdateLevelState() 'Changes color of maze, sprite speed, etc. ConstructGameElements() splashTextColor = "white" splashText = "L E V E L : "+ gameLevel DisplayLevelSplash() SpriteArray[SBC][State] = NORMAL SmallDelay() gameState = PLAY_LEVEL sbcDirection = Dir_R ElseIf (gameState = PLAY_LEVEL) Then LeaveMonsterPenOneByOne() 'Each sprite has a counter that it uses to track when it reaches a tile while moving though the maze. 'When this counter reaches mazeScale, the sprite updates it info and draws. 'Each sprite also has a spritespeed variable that it uses to set its movement speed. For example, 'if spritespeed = 1 then updates will be done on each tick of the global counter. If spritespeed = 2 then 'updates will be done on every 2nd tick, which will slow down that sprite, etc. For Sprites = firstSprite to lastSprite IF Math.Remainder(globalCycleCtr,SpriteArray[Sprites][spriteSpeed])=0 Then Update() Draw() EndIf Endfor ElseIf (gameState = REPLAY_LEVEL) Then SmallDelay() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() ModeSwitchCounter = 0 globalCycleCtr = 0 selectedRotation=0 SpriteArray[SBC][Lives] = SpriteArray[sbc][Lives] - 1 gameState = PLAY_LEVEL sbcDirection = DIR_R 'SBC moves to the right when level starts. SmallDelay() If (SpriteArray[SBC][Lives] = 0) Then gameState = GAME_OVER splashText = "Game Over" DisplayLevelSplash() SmallDelay() Program.End() Endif EndIf 'End of state machine If/ElseIf ladder 'Controls overall game speed: delay = gameSpeed - (Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile 'End of game loop '*********************************************************************************** Sub SmallDelay Program.Delay(250) EndSub '******************************************************************************************* 'Updates various games elements (eg maze color, game speed, etc) as the player advances to a new level: '- gameSpeed: Overall speed of game. Game gets faster on each level. '- initialCountDownTime: amount of time that monsters stay afraid. Decreases on each level. Sub UpdateLevelState If math.Remainder(gameLevel,4) = 1 Then mazeBorderColor = "Cyan" ElseIf math.Remainder(gameLevel,4) = 2 then mazeBorderColor = "Red" Elseif math.Remainder(gameLevel,4) = 3 then mazeBorderColor = "midnightblue" Elseif math.Remainder(gameLevel,4) = 0 then mazeBorderColor = "magenta" EndIf gameLevel = gameLevel + 1 gameSpeed = gameSpeed - 2 If (gameSpeed <= 0) Then gameSpeed = 0 EndIf 'Give the player a new life on levels 4 and 8: If (gameLevel = 4 Or gameLevel = 8) Then SpriteArray[sbc][Lives]=SpriteArray[sbc][Lives] + 1 EndIf 'Reduce the amount of time that the monsters stay "Frightened" as game progresses. 'At much higher levels, the monsters won't stay frighened at all: initialCountDownTime = initialCountDownTime - 2 If initialCountDownTime <= 0 Then initialCountDownTime = 0 EndIf EndSub '******************************************************************************************* 'Dsplays a splash screen at the start of each level: Sub DisplayLevelSplash GraphicsWindow.FontSize = 16 GraphicsWindow.FontBold="true" GraphicsWindow.BrushColor = "white" l=Shapes.AddText(splashText) Shapes.Move(l,-200,210) Shapes.Animate(l,125,210,1000) For a = 1 To 6 SmallDelay() endfor Shapes.Animate(l,-200,210,1000) EndSub '******************************************************************************************* 'The variables Dir_L, Dir_U, Dir_R, Dir_D are used as indexes into the xModifier and yModifier lookup tables. 'For example, xModifier[L] & yModifier[L] produces -1 and 0 respectively. When added to XY or RC values this will cause 'the sprite to go left, etc: Sub KeyboardHandler keyPressed = GraphicsWindow.LastKey Dir_L = 1 Dir_U = 2 Dir_R = 3 Dir_D = 4 If (keyPressed = "Left") Then sbcDirection = Dir_L Elseif (keyPressed = "Right") Then sbcDirection = Dir_R Elseif (keyPressed = "Up") Then sbcDirection = Dir_U Elseif (keyPressed = "Down") Then sbcDirection = Dir_D Elseif (keyPressed = "Escape") Then gameState = GAME_OVER Endif EndSub '******************************************************************************************* Sub MoveSBC 'This routine moves SBC around the screen and causes SBC to stop at borders.It checks the maze 'locations adjacent to SBC's current location aganist the direction chosen by an arrow key press. 'If the new direction is possible (eg no borders in the way) SBC will go in the new direction. If 'the new direction is not possible, but the previous direction is, SBC will continue traveling in the 'direction it was moving in prior to the arrow key press. If neither direction is possible, SBC 'will stop moving: If Sprites=SBC Then canMoveInOldDirection="False" canMoveInNewDirection="False" 'Get maze data ahead of SBC: aheadDirX = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] aheadDirY = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] aheadDirData = Maze[aheadDirY][aheadDirX] 'Get maze data at location based on arrow key press: newDirX = SpriteArray[SBC][mazeCol] + xModifier[SbcDirection] newDirY = SpriteArray[SBC][mazeRow] + yModifier[SbcDirection] newDirData = Maze[newDirY][newDirX] 'The mazeTokens array holds data that represent ares that are NOT blocked by borders. For a = firstToken To lastToken If (mazeTokens[a] = newDirData) Then canMoveInNewDirection = "True" Goto _XIT_4Loop_Early EndIf If (mazeTokens[a] = aheadDirData) Then canMoveInOldDirection = "True" EndIf EndFor _XIT_4Loop_Early: 'If the new direction is possible, go in new direction: If (canMoveInNewDirection = "True") Then SpriteArray[SBC][DX] = xModifier[sbcDirection] SpriteArray[SBC][DY] = yModifier[sbcDirection] selectedRotation = rotationLookupTable[sbcDirection] EndIf 'If neither old nor new directions are possible, come to a stop: If (canMoveInNewDirection = "False" And canMoveInOldDirection = "False") Then SpriteArray[SBC][DX] = 0 SpriteArray[SBC][DY] = 0 EndIf SpriteArray[SBC][mazeCol] = SpriteArray[SBC][mazeCol] + SpriteArray[SBC][DX] SpriteArray[SBC][mazeRow] = SpriteArray[SBC][mazeRow] + SpriteArray[SBC][DY] EatPellet() EndIf EndSub '******************************************************************************************* Sub MoveMonstersTowardTarget 'This routine moves the monsters toward a target while allowing them to navigate around the maze 'borders. LL is a temporary array: INVALID = 9999 '9999 is used as an invalid flag because the total distance across the maze is 'much lower than 9999 pixels. Later, when the code calculates the distance 'between source to target, anything marked 9999 won't be considered. If (Sprites <> SBC) Then '<--SBC has his own movement routine (see MoveSBC) For a = 1 To 4 'step through XY/RC modifier table: SourceX = SpriteArray[Sprites][mazeCol] + xModifier[a] SourceY = SpriteArray[Sprites][mazeRow] + yModifier[a] targetX = SpriteArray[Sprites][targetCol] targetY = SpriteArray[Sprites][targetRow] For b = firstToken To lastToken 'If the maze area being examined is not a border then calculate the distance from that maze area ' to the target using the Manhattan Distance formula (SourceX-targetCol)+(SourceY-targetRow)... If mazeTokens[b]=Maze[SpriteArray[Sprites][mazeRow] + yModifier[a]][SpriteArray[Sprites][mazeCol]+ xModifier[a]] Then LL[a] = 1+(math.Abs(Sourcex-targetx) + math.Abs(Sourcey-targety)) Goto _XIT4 '...otherwise mark it as invalid because it's a border : Else LL[a] = INVALID EndIf EndFor _XIT4: EndFor 'For each maze area stored in the LL array, check to see if that was visited by the monster during previous 'game loop cycle. If so mark it INVALID, then save the monster's current maze location 'in VX, VY. These two steps will force the monster to travel in forward directions only (no reversing direction): For c = 1 To 4 If SpriteArray[Sprites][mazeCol] + xModifier[c] = SpriteArray[Sprites][VX] Then If SpriteArray[Sprites][mazeRow] + yModifier[c] = SpriteArray[Sprites][VY] Then LL[c] = INVALID EndIf EndIf EndFor SpriteArray[Sprites][VX] = SpriteArray[Sprites][mazeCol] SpriteArray[Sprites][VY] = SpriteArray[Sprites][mazeRow] 'Get the smallest number in temporary LL array, which will represent the direction to move in '1 = go left, 2 = go up, 3 = to right, 4 = go down: initialValue = LL[1] For ictr = 1 TO 4 If initialValue >= LL[ictr] THEN initialValue = LL[ictr] elementfound = ictr EndIf EndFor 'Set the movement direction. The xModifier/yModifier lookup tables eliminate the need for If/Then tests here: SpriteArray[Sprites][DX] = xModifier[elementfound] SpriteArray[Sprites][DY] = yModifier[elementfound] '** There is at least one circumstance where the monster finds a dead end - when the monster is in the 'monster pen at level start. In this instance, the monster's L, D, & R adjacent areas will be invalid 'due to being blocked by visible and invisible borders, and U is blocked because it will be added to the 'VX/VY variables after the first game cycle. When this happens the VX/VY variables must be deleted 'and on the next game cycle the monster will move out of dead end. ' if LL[elementfound] = INVALID Then SpriteArray[Sprites][DX] = 0 SpriteArray[Sprites][DY] = 0 SpriteArray[Sprites][VX] = 0 SpriteArray[Sprites][VY] = 0 EndIf 'Finally, move toward target: SpriteArray[Sprites][mazeCol] = (SpriteArray[Sprites][mazeCol] + SpriteArray[Sprites][dx]) SpriteArray[Sprites][mazeRow] = (SpriteArray[Sprites][mazeRow] + SpriteArray[Sprites][dy]) EndIf Endsub '******************************************************************************************* 'Detects when sprites touch each other and when sprites enter special areas of the maze: Sub CollisionDetect If Sprites <> SBC Then CheckRectangles() 'sets isTouching value to true if SBC is touching a monster. If (isTouching = "True") Then 'Monster dies if touching SBC while fightened and then monster returns to the monster pen: If (SpriteArray[Sprites][State] = FRIGHT) then ShowEatSplash() SpriteArray[Sprites][State] = DIE hasEatenMonster = "TRUE" 'SBC dies if touching monster when energizer is not active: ElseIf (SpriteArray[Sprites][State] = CHASE) or (SpriteArray[Sprites][State] = SCATTER)then gameState = REPLAY_LEVEL EndIf isTouching = "False" EndIf 'When monster reaches monster pen, get body back and leave: If SpriteArray[Sprites][mazeCol] = MonsterPenX and SpriteArray[Sprites][mazeRow]= MonsterPenY Then If SpriteArray[Sprites][State] = DIE then SpriteArray[Sprites][State] = EMERGE EndIf EndIf 'When monster has left monster pen, go back to chasing SBC: If SpriteArray[Sprites][mazeCol] = emergeX and SpriteArray[Sprites][mazeRow] = emergeY Then If SpriteArray[Sprites][State] = EMERGE then SpriteArray[Sprites][State] = CHASE EndIf EndIf EndIf EndSub '******************************************************************************************* 'Sets the targets that the monsters will move towards: Sub SetupMonsterTargets IF (Sprites <>SBC) then 'Sets ghosts to meander around the screen after SBC eats a power pellet: If SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][targetRow] = math.GetRandomNumber(maxMazeRows) SpriteArray[Sprites][targetCol] = math.GetRandomNumber(maxMazeCols) 'Sends the monsters back to monster pen after being eaten by SBC: ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][targetCol] = MonsterPenX SpriteArray[Sprites][targetRow] = MonsterPenY 'Makes the monsters leave the monster pen once inside: ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][targetCol] = emergeX SpriteArray[Sprites][targetRow] = emergeY 'If the monsters are scattering, each one goes to a different corner of the maze: Elseif (SpriteArray[Sprites][State] = SCATTER) Then If (Sprites = RedMonster) Then SpriteArray[RedMonster][targetCol] = 1 SpriteArray[RedMonster][targetRow] = 1 ElseIf (Sprites = PinkMonster) Then SpriteArray[PinkMonster][targetCol] = 100 SpriteArray[PinkMonster][targetRow] = 1 ElseIf (Sprites = BlueMonster) Then SpriteArray[BlueMonster][targetCol] = 1 SpriteArray[BlueMonster][targetRow] = 100 ElseIf (Sprites = OrangeMonster) Then SpriteArray[OrangeMonster][targetCol] = 100 SpriteArray[OrangeMonster][targetRow] = 100 EndIf 'If the monsters are chasing, each one uses a different technique for targeting or menencing SBC: Elseif (SpriteArray[Sprites][State] = CHASE) Then If (Sprites = RedMonster) Then 'Red monster pursues SBC directly: SpriteArray[RedMonster][targetCol] = SpriteArray[SBC][mazeCol] SpriteArray[RedMonster][targetRow] = SpriteArray[SBC][mazeRow] ElseIf (Sprites = PinkMonster) Then 'Pink monster tries to ambush/cut off SBC (***TO DO: needs to be enhanced***): SpriteArray[PinkMonster][targetCol] = SpriteArray[SBC][mazeCol] + (SpriteArray[SBC][DX]-1) SpriteArray[PinkMonster][targetRow] = SpriteArray[SBC][mazeRow] + (SpriteArray[SBC][DY]-1) ElseIf (Sprites = OrangeMonster) Then 'Orange monster wanders around the maze and is often just in the way (blocking): SpriteArray[OrangeMonster][targetCol] = math.GetRandomNumber(maxMazeCols) SpriteArray[OrangeMonster][targetRow] = math.GetRandomNumber(maxMazeRows) ElseIf (Sprites = BlueMonster) Then 'Blue monster considers red monster's coordinates and SBC's coordinates when determining how to move: 'Although the blue monster doesn't pursue directly, he causes inconvenience to SBC: 'TO DO: needs to be enhanced. SpriteArray[BlueMonster][targetCol] = math.abs(SpriteArray[SBC][mazeCol] + SpriteArray[RedMonster][mazeCol]) SpriteArray[BlueMonster][targetRow] = math.abs(SpriteArray[SBC][mazeRow] + SpriteArray[RedMonster][mazeRow]) EndIf EndIf ENDIF EndSub '******************************************************************************************* 'Animation manager. The animation frames are stored in the ImageArray 2D array. This routine 'sets the indexes into that array. FrameCtr + Offset is used as the index into ImageArray. 'When Offset = zero all sprites go through the normal 4-cycle animation sequence. When 'offset = 5, the monsters turn purple (Fright Mode), and when the offset = 6 the monsters turn dark gray '(Die Mode). Sub SetupAnimationSequence SpriteArray[SBC][LastFrame] = 4 SpriteArray[SBC][FirstFrame] = 1 SpriteArray[SBC][offset] = 0 If (Sprites <> SBC) Then If SpriteArray[Sprites][State] = CHASE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 ElseIf SpriteArray[Sprites][State] = SCATTER Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 ElseIf SpriteArray[Sprites][State] = FRIGHT Then SpriteArray[Sprites][offset] = 5 SpriteArray[Sprites][LastFrame] = 5 SpriteArray[Sprites][FirstFrame] = 5 ElseIf SpriteArray[Sprites][State] = DIE Then SpriteArray[Sprites][offset] = 6 SpriteArray[Sprites][LastFrame] = 6 SpriteArray[Sprites][FirstFrame] = 6 ElseIf SpriteArray[Sprites][State] = EMERGE Then SpriteArray[Sprites][offset] = 0 SpriteArray[Sprites][LastFrame] = 4 SpriteArray[Sprites][FirstFrame] = 1 Endif EndIf FlashMonsters() EndSub '******************************************************************************************* Sub EatPellet erasePelletFromScreen = "FALSE" hasEatenPellet = "FALSE" hasEatenEnergizer = "FALSE" mazeData = Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])] 'Pellet = mazeToken[1]. Energizer = mazeToken[2]: If (mazeData = mazeTokens[1] Or mazeData = mazeTokens[2]) Then Maze[(SpriteArray[SBC][mazeRow])][(SpriteArray[SBC][mazeCol])]=mazeTokens[0] 'empty this maze location pelletCount = pelletCount - 1 erasePelletFromScreen = "True" If (mazeData = mazeTokens[1]) Then hasEatenPellet = "TRUE" ElseIf (mazeData = mazeTokens[2]) then hasEatenEnergizer = "TRUE" monsterEatenCtr = 0 SetMonstersToFrightState() energizerTimer = ACTIVE energizerTime = initialCountDownTime EndIf If pelletCount <= 0 Then gameState = ADVANCE_LEVEL EndIf EndIf DoEnergizerTimer() EndSub '******************************************************************************************* 'Sets all monsters to FRIGHT state. VY & VX are zeroed out so that the monsters can switch 'directions. (MoveMonstersTowardTarget( ) normally restricts the monsters to forward-only movements): Sub SetMonstersToFrightState For ee = firstMonster to lastMonster if SpriteArray[ee][State] <> DIE then SpriteArray[ee][State] = FRIGHT shapes.SetOpacity(ImageArray[ee][5],100) SpriteArray[ee][VY] = 0 SpriteArray[ee][VX] = 0 EndIf Endfor EndSub '******************************************************************************************* 'Manages the count down timer that determines how long an energizer lasts. Sub DoEnergizerTimer If (energizerTimer = ACTIVE) Then If (energizerTime <> 0) Then energizerTime = energizerTime -1 Else energizerTimer = INACTIVE monsterEatenCtr=0 For mc = firstMonster to lastMonster If SpriteArray[mc][State] =FRIGHT then SpriteArray[mc][State] = CHASE EndIf Endfor Endif Endif EndSub '******************************************************************************************* 'Dispatch routine for erasing pellets/energizers from the screen: Sub ErasePellet pelletColor = GraphicsWindow.GetColorFromRGB(0,0,64) pelletX = SpriteArray[SBC][screenX] pelletY = SpriteArray[SBC][screenY] DrawEnergizer() EndSub '******************************************************************************************* 'Draws/erases an energizer Sub DrawEnergizer pelletSize = 10 xOffset = 2 + mazeScale/2 yOffset = 2 + mazeScale/2 DP() Endsub '******************************************************************************************* 'Draws/erases a pellet Sub DrawPellet pelletSize = 4 xOffset = 3 + mazeScale/2 yOffset = 3 + mazeScale/2 DP() EndSub '******************************************************************************************* Sub DP GraphicsWindow.BrushColor = pelletColor GraphicsWindow.FillEllipse(pelletX+xOffset, pelletY+yOffset, pelletSize, pelletSize) EndSub '******************************************************************************************* 'Removes sprites from the maze Sub ClearSpritesFromaze For r=firstSprite To lastSprite For t = 1 To 6 Shapes.move(ImageArray[r][t],-100,-100) EndFor EndFor EndSub '******************************************************************************************* 'Draws sprites on screen while advancing through the animation sequence setup by SetupAnimationSequence(). Sub DrawSprites 'To reduce flicker only draw sprites that are moving (SBC sometimes stops) If SpriteArray[Sprites][dx]<>0 Or SpriteArray[Sprites][dy]<>0 Then 'Get a reference to the current animation frame. We will hide it later: oldFrameCtr=SpriteArray[Sprites][FrameCtr] SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][frameCtr]+1+SpriteArray[Sprites][offset] 'Advance to next frame and check to see if all frames have been displayed: If SpriteArray[Sprites][frameCtr]>SpriteArray[Sprites][lastFrame] then SpriteArray[Sprites][frameCtr]=SpriteArray[Sprites][firstFrame] Endif 'Update screen coordinates: SpriteArray[Sprites][screenX]= SpriteArray[Sprites][screenX]+ SpriteArray[Sprites][DX] * 3 SpriteArray[Sprites][screenY]= SpriteArray[Sprites][screenY]+ SpriteArray[Sprites][DY] * 3 'Get reference to new animation frame and apply rotation (for SBC): newFrameCtr=SpriteArray[Sprites][frameCtr] if Sprites = SBC Then Shapes.Rotate(ImageArray[Sprites][newFrameCtr], selectedRotation) EndIf 'Finally, hide previous frame and show new animation frame: shapes.Move(ImageArray[Sprites][oldFrameCtr],-20,-20) Shapes.Move(ImageArray[Sprites][newFrameCtr], SpriteArray[Sprites][screenX], SpriteArray[Sprites][screenY]) EndIf If erasePelletFromScreen = "True" Then ErasePellet() EndIf EndSub '******************************************************************************************* 'This routine intializes general purpose global lookup tables. Sub InitializeLookupTables 'The xModifier & yModifier arrays are used to modify the XY screen coordinates and RC maze coordinates: xModifier[0] = 0 'Stop moving xModifier[1] =-1 'Move Left (when added to X) xModifier[2] = 0 ' xModifier[3] = 1 'Move Right (when added to X) xModifier[4] = 0 yModifier[0] = 0 'Stop moving yModifier[1] = 0 ' yModifier[2] =-1 'Move Up (when added to Y) yModifier[3] = 0 ' yModifier[4] = 1 'Move Down (when added to Y) 'rotationLookupTable holds the rotation angles for SBC. SbcDirection is used as an index: rotationLookupTable[1] = 180 rotationLookupTable[2] = 270 rotationLookupTable[3] = 0 rotationLookupTable[4] = 90 EndSub '******************************************************************************************* 'Sets up sprite data structure and establishes related variables: Sub InitializeSprites 'State variables for sprites: DIE = 0 NORMAL = 1 CHASE = 2 SCATTER = 3 FRIGHT = 4 EMERGE = 5 'State variables for energizer timer: ACTIVE = 1 INACTIVE = 0 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite: firstSprite = SBC lastSprite = PinkMonster firstMonster = RedMonster lastMonster = PinkMonster 'Variables for dimension #2: screenX = 1 'screen x coordinate screenY = 2 'screen y coordinate mazeCol = 3 'maze col mazeRow = 4 'maze row DX = 5 'x/col modifier DY = 6 'y/row modifier targetCol= 7 'maze target col targetRow= 8 'maze target row VX = 9 'visited maze col VY = 10 'visited maze row State = 11 Lives = 12 FrameCtr = 13 'Index into ImageArray[ ][ ] Offset = 14 FirstFrame = 15 LastFrame = 16 cycleCounter= 17 spriteSpeed= 18 'Initialize: For spriteCtr = firstSprite To lastSprite SpriteArray[spriteCtr][FirstFrame] = 1 SpriteArray[spriteCtr][LastFrame] = 4 SpriteArray[spriteCtr][FrameCtr] = 1 SpriteArray[spriteCtr][offset] = 4 SpriteArray[spriteCtr][DX] = 0 SpriteArray[spriteCtr][DY] = 0 SpriteArray[spriteCtr][VX] = 0 SpriteArray[spriteCtr][VY] = 0 SpriteArray[spriteCtr][targetCol] = 0 SpriteArray[spriteCtr][targetRow] = 0 SpriteArray[spriteCtr][State] = CHASE SpriteArray[spriteCtr][spriteSpeed] = 1 SpriteArray[spriteCtr][cycleCounter] = 1 Endfor EndSub '******************************************************************************************* Sub PositionSpritesInMaze 'Position SBC two tiles underneath Monster pen: SpriteArray[SBC][mazeCol] = 15 SpriteArray[SBC][mazeRow] = 24 'Position Red Monster outside & above Monster pen: SpriteArray[RedMonster][mazeCol] = 12 SpriteArray[RedMonster][mazeRow] = 12 'Position Blue, Orange and Pink Monsters inside Monster pen: SpriteArray[BlueMonster][mazeCol] = 12 SpriteArray[BlueMonster][mazeRow] = 15 SpriteArray[OrangeMonster][mazeCol] = 14 SpriteArray[OrangeMonster][mazeRow] = 16 SpriteArray[PinkMonster][mazeCol] = 16 SpriteArray[PinkMonster][mazeRow] = 15 'Set correct screen positions: For Sprites = firstSprite to lastSprite AdjustScreenCoords() EndFor EndSub '******************************************************************************************* 'Using maze RC values, calculate screen XYs: Sub AdjustScreenCoords SpriteArray[Sprites][screenX] = (SpriteArray[Sprites][mazeCol]) * mazeScale-12 SpriteArray[Sprites][screenY] = (SpriteArray[Sprites][mazeRow]) * mazeScale-4 EndSub '******************************************************************************************* Sub LoadBitmaps 'The sprite data structure is a 2D array. These variables are indexes into the 2nd dimension of that array. '(Dimension#1 slects the sprite, dimension #2 sets/gets properties of the particular sprite. 'Variables to select the sprites (dimension #1 of SpriteArray): SBC = 1 RedMonster = 2 BlueMonster = 3 OrangeMonster = 4 PinkMonster = 5 sWidth = mazeScale * 2 sHeight = mazeScale * 2 'ImageArray is a 2D array that holds references to the bitmaps used by the sprites. Dimension #1 is used 'to select the sprite, dimension #2 is used to select the bitmap. 'Load bitmaps for normal animation sequence: filePath = Program.Directory +"\" 'SBC animation frames ImageArray[SBC][1]=shapes.addimage("http://farm6.staticflickr.com/5470/8780993667_258f752378_o.jpg") ImageArray[SBC][2]=shapes.addimage("http://farm9.staticflickr.com/8534/8787570838_a74bbcb81e_o.jpg") ImageArray[SBC][3]=shapes.addimage("http://farm4.staticflickr.com/3744/8787570834_9f08ee0bd8_o.jpg") ImageArray[SBC][4]=shapes.addimage("http://farm9.staticflickr.com/8534/8787570838_a74bbcb81e_o.jpg") 'Red Monster animation frames ImageArray[RedMonster][1]=shapes.addimage("http://farm9.staticflickr.com/8120/8787570894_ef9a060cce_o.jpg") ImageArray[RedMonster][2]=shapes.addimage("http://farm9.staticflickr.com/8120/8787570894_ef9a060cce_o.jpg") ImageArray[RedMonster][3]=shapes.addimage("http://farm9.staticflickr.com/8120/8787570894_ef9a060cce_o.jpg") ImageArray[RedMonster][4]=shapes.addimage("http://farm9.staticflickr.com/8120/8787570894_ef9a060cce_o.jpg") 'Blue Monster animation frames ImageArray[BlueMonster][1]=shapes.addimage("http://farm8.staticflickr.com/7438/8787570752_1b3f0d62f4_o.jpg") ImageArray[BlueMonster][2]=shapes.addimage("http://farm8.staticflickr.com/7438/8787570752_1b3f0d62f4_o.jpg") ImageArray[BlueMonster][3]=shapes.addimage("http://farm8.staticflickr.com/7438/8787570752_1b3f0d62f4_o.jpg") ImageArray[BlueMonster][4]=shapes.addimage("http://farm8.staticflickr.com/7438/8787570752_1b3f0d62f4_o.jpg") 'Orange Monster animation frames ImageArray[OrangeMonster][1]=shapes.addimage("http://farm4.staticflickr.com/3746/8781438627_4a98b9b02e_o.jpg") ImageArray[OrangeMonster][2]=shapes.addimage("http://farm4.staticflickr.com/3746/8781438627_4a98b9b02e_o.jpg") ImageArray[OrangeMonster][3]=shapes.addimage("http://farm4.staticflickr.com/3746/8781438627_4a98b9b02e_o.jpg") ImageArray[OrangeMonster][4]=shapes.addimage("http://farm4.staticflickr.com/3746/8781438627_4a98b9b02e_o.jpg") 'Pink Monster animation frames ImageArray[PinkMonster][1]=shapes.addimage("http://farm4.staticflickr.com/3783/8780993729_113597c60e_o.jpg") ImageArray[PinkMonster][2]=shapes.addimage("http://farm4.staticflickr.com/3783/8780993729_113597c60e_o.jpg") ImageArray[PinkMonster][3]=shapes.addimage("http://farm4.staticflickr.com/3783/8780993729_113597c60e_o.jpg") ImageArray[PinkMonster][4]=shapes.addimage("http://farm4.staticflickr.com/3783/8780993729_113597c60e_o.jpg") For s= 1 to 5 'Load bitmaps for FRIGHT Mode: ImageArray[s][5]=shapes.addimage("http://farm4.staticflickr.com/3816/8781443919_e9d35b6318_o.jpg") 'Load bitmaps for DIE mode: ImageArray[s][6]=shapes.addimage("http://farm8.staticflickr.com/7356/8788021974_accb126e3f_o.jpg") Shapes.SetOpacity(ImageArray[s][6],75) Endfor ClearSpritesFromaze() EndSub ''******************************************************************************************* 'Loads maze pattern into maze array, counts the number of pellets added to maze, and gets the 'maze XY coordinates for special areas. Also creates and populates the mazeToken[ ] lookup table: ' Sub LoadMaze M[1] = "oooooooooooooooooooooooooooo" M[2] = "o............oo............o" M[3] = "o.oooo.ooooo.oo.ooooo.oooo.o" M[4] = "o*oooo.ooooo.oo.ooooo.oooo*o" M[5] = "o.oooo.ooooo.oo.ooooo.oooo.o" M[6] = "o..........................o" M[7] = "o.oooo.oo.oooooooo.oo.oooo.o" M[8] = "o.oooo.oo.oooooooo.oo.oooo.o" M[9] = "o......oo...+oo+...oo......o" M[10] = "oooooo.ooooo+oo+ooooo.oooooo" M[11] = "oooooo.ooooo+oo+ooooo.oooooo" M[12] = "++++oo.oo++++E+++++oo.oo++++" M[13] = "oooooo.oo+oooA!ooo+oo.oooooo" M[14] = "oooooo.oo+o+BMC+#o+oo.oooooo" M[15] = "LTTTTT.+++o+#+#+#o+++.SSSSSR" M[16] = "oooooo.oo+o+#+#+#o+oo.oooooo" M[17] = "oooooo.oo+oooooooo+oo.oooooo" M[18] = "++++oo.oo++++++++++oo.oo++++" M[19] = "oooooo.oo+oooooooo+oo.oooooo" M[20] = "oooooo.oo+oooooooo+oo.oooooo" M[21] = "o............oo............o" M[22] = "o.oooo.ooooo.oo.ooooo.oooo.o" M[23] = "o.oooo.ooooo.oo.ooooo.oooo.o" M[24] = "o*..oo................oo..*o" M[25] = "ooo.oo.oo.oooooooo.oo.oo.ooo" M[26] = "ooo.oo.oo.oooooooo.oo.oo.ooo" M[27] = "o......oo....oo....oo......o" M[28] = "o.oooooooooo.oo.oooooooooo.o" M[29] = "o.oooooooooo.oo.oooooooooo.o" M[30] = "o..........................o" M[31] = "oooooooooooooooooooooooooooo" maxMazeRows = Array.GetItemCount(M) maxMazeCols = Text.GetLength(M[1]) 'mazeTokens[ ] hold tokens that represent walkable space in the maze: firstToken = 0 lastToken = 5 mazeTokens[0]= "+" mazeTokens[1]= "." mazeTokens[2]= "*" mazeTokens[3] = "Z" 'Place holder for top door token (A) mazeTokens[4] = "Z" 'Place holder for left door token (B) mazeTokens[5] = "Z" 'Place holder for right door token (C) 'Load the maze pattern into the maze[ ] [ ] array: For rows = 1 To maxMazeRows For cols = 1 To maxMazeCols maze[rows][cols] = Text.GetSubText(M[rows], cols, 1) If maze[rows][cols] = mazeTokens[1] Or maze[rows][cols] = mazeTokens[2] Then pelletCount = pelletCount + 1 EndIf 'Special areas: If Maze[rows][cols] ="M" Then 'DIE mode target Monster Pen tile Maze[rows][cols] = mazeTokens[0] monsterpenX = cols MonsterPenY = rows ElseIf Maze[rows][cols] ="E" Then 'Emerge mode target tile Maze[rows][cols] = mazeTokens[0] emergeX = cols emergeY = rows ElseIf Maze[rows][cols] ="L" Then 'Left tunnel tile Maze[rows][cols] = mazeTokens[0] leftTunnelX = cols leftTunnelY = rows ElseIf Maze[rows][cols] ="R" Then 'Right tunnel tile Maze[rows][cols] = mazeTokens[0] rightTunnelX = cols rightTunnelY = rows ElseIf Maze[rows][cols] ="S" Then 'Right slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld1X = cols sld1Y = rows ElseIf Maze[rows][cols] ="T" Then 'Left slow-down tunnel tile Maze[rows][cols] = mazeTokens[0] sld2X = cols sld2Y = rows EndIf EndFor EndFor 'Delete the temporary array holding the maze structure: M="" EndSub '******************************************************************************************* 'Steps through maze[ ] [ ] and draws the pattern on screen: '<--TO DO: Change x and y to MazeScreenX and MazeScreenY Sub DrawMaze x = 0 y = 8 GraphicsWindow.BackgroundColor=mazeBorderColor bordersize = 10 For rows = 1 To maxMazeRows For cols = 1 To maxMazeCols mazeData = Maze[rows][cols] if mazeData<>"o" Then GraphicsWindow.BrushColor=GraphicsWindow.GetColorFromRGB(0,0,64) GraphicsWindow.FillRectangle(x,y,mazeScale+bordersize,mazeScale+bordersize) EndIf if mazeData="A" Or mazeData="!" Then GraphicsWindow.PenColor="white" GraphicsWindow.PenWidth=4 GraphicsWindow.drawline(x,y+mazeScale,x+mazeScale+bordersize,y+mazeScale) Endif x=x + mazeScale EndFor x=0 y = y + mazeScale EndFor 'Draw pellets: '<---TO DO: Put into seperate routine x = 0 y = 8 For rows = 1 To maxMazeRows For cols = 1 To maxMazeCols mazeData = Maze[rows][cols] If mazeData="." Then pelletColor = "white" pelletX=x pelletY=y DrawPellet() elseIf mazeData="*" Then pelletColor = "white" pelletX=x pelletY=y DrawEnergizer() EndIf x=x + mazeScale EndFor x=0 y = y + mazeScale EndFor EndSub '******************************************************************************************* 'There are three invisible borders that keep the blue, pink and orange ghosts in the monster pen 'and also keeps the monsters from getting back in unless they are in EMERGE or DIE modes. 'The doors are "opened" by adding their tokens to the mazeToken[ ] array and extending the lastToken pointer. 'The doors are "closed" by resetting the lastToken pointer: Sub CloseDoors mazeTokens[3] = "Z" mazeTokens[4] = "Z" mazeTokens[5] = "Z" EndSub '******************************************************************************************* Sub OpenLeftDoor mazeTokens[4] = "B" EndSub '******************************************************************************************* Sub OpenRightDoor mazeTokens[5] = "C" EndSub '******************************************************************************************* Sub OpenTopDoor mazeTokens[3] = "A" EndSub '******************************************************************************************* 'This routines causes the monsters to leave the monster pen one-by-one after a certain number of 'cycles have past. This done at game start, on each new level and when a level is replayed . 'There are 3 invisivle "doors" that keep the monsters caged in. Whenever a monster enteres 'DIE or EMERGE modes, the doors open to let the monster enter or exit the pen. 'The doors remain closed for any monster in CHASE, FRIGHT, or SCATTER modes to keep them 'from re-entering the case prematurely. The same holds for Chomper's NORMAL mode. ' 'See OpenCloseDoors() for additional info. Sub LeaveMonsterPenOneByOne If globalCycleCtr = 150 then SpriteArray[OrangeMonster][state] = EMERGE ElseIf globalCycleCtr = 300 Then SpriteArray[PinkMonster][state] = EMERGE Elseif globalCycleCtr = 450 Then SpriteArray[BlueMonster][state] = EMERGE EndIf EndSub '******************************************************************************************* 'Dispatches update-related routines: Sub Update SpriteArray[Sprites][cycleCounter]=SpriteArray[Sprites][cycleCounter]+3 'Do updates when a sprite reaches a new tile. Distance between tiles is set by MazeScale: if (SpriteArray[Sprites][cycleCounter] > mazeScale) Then MoveSBC() SetupMonsterTargets() DoChaseScatterFrightCycles() SetupSpriteSpeed() OpenCloseDoors() MoveMonstersTowardTarget() CheckGoThroughTunnels() SpriteArray[Sprites][cycleCounter]=1 ScoreAndBonusManager() EndIf Endsub '******************************************************************************************* 'Displaches draw-related routines: Sub Draw SetupAnimationSequence() DrawSprites() CollisionDetect() CheckGoThroughTunnels() Endsub '******************************************************************************************* 'Ensures that sprites are moving at correct speed: Sub SetupSpriteSpeed If SpriteArray[Sprites][state] = CHASE Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = FRIGHT Then SpriteArray[Sprites][spriteSpeed] = 2 ElseIf SpriteArray[Sprites][state] = NORMAL Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = DIE Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = SCATTER Then SpriteArray[Sprites][spriteSpeed] = 1 ElseIf SpriteArray[Sprites][state] = EMERGE Then SpriteArray[Sprites][spriteSpeed] = 3 EndIf EndSub '******************************************************************************************* 'Can't speed up maze drawing, so black out the game screen and then construct maze and position 'bitmaps underneath the black cover: Sub ConstructGameElements BlackOutGameScreen() LoadMaze() DrawMaze() ClearSpritesFromaze() InitializeSprites() PositionSpritesInMaze() RemoveBlackScreen() EndSub '******************************************************************************************* 'Causes the monsters to flash briefly as a warning to the player that the monsters are about 'to swtich from Fright to Chase states: '***BUG ??: This routine doesn't work well with Silverlight*** Sub FlashMonsters If (energizerTimer = ACTIVE) And (SpriteArray[Sprites][State] = FRIGHT) Then If (energizerTime < 20) Then If (Math.Remainder(energizerTime,3)=0) Then shapes.SetOpacity(ImageArray[sprites][5],100) 'Visible Else shapes.SetOpacity(ImageArray[sprites][5],10) 'Faint EndIf EndIf EndIf EndSub '********************************************************************************* 'Allows game to cage in or release monsters from monsters from the monster pen based 'on state. Monsters should not be allowed to re-enter the pen unless they have been 'eaten by SBC (DIE state) or emerging from the monster pen during level start/restart 'or after being eating by SBC (EMERGE state). ' 'SBC should not be allowed to enter the monster pen ever (NORMAL state): Sub OpenCloseDoors If SpriteArray[Sprites][State] = CHASE Or SpriteArray[Sprites][State] = FRIGHT Or SpriteArray[Sprites][State] = NORMAL Then CloseDoors() 'bug fix below to prevent monsters from getting stuck in the monster pen: if SpriteArray[Sprites][mazeCol]=MonsterPenX And SpriteArray[Sprites][mazeRow]=MonsterPenY Then OpenTopDoor() EndIf ElseIf SpriteArray[Sprites][State] = DIE Then CloseDoors() OpenTopDoor() ElseIf SpriteArray[Sprites][State] = EMERGE Then CloseDoors() OpenTopDoor() OpenLeftDoor() OpenRightDoor() EndIf EndSub '******************************************************************************* 'Bounding Box collision detection routine from "Beginning Microsoft Small Basic", 9-30 Sub CheckRectangles isTouching = "False" Object1X=SpriteArray[sbc][screenX] Object1Y=SpriteArray[sbc][screenY] Object2X=SpriteArray[Sprites][screenX] Object2Y=SpriteArray[Sprites][screenY] If ((Object1X + 12 +sWidth - 12) > Object2X +12) Then If (Object1X +12 < (Object2X+12 + sWidth - 12)) Then If ((Object1Y+12 + sHeight - 12) > Object2Y+12) Then If (Object1Y+12 < (Object2Y+12 + sHeight - 12)) Then isTouching = "True" EndIf EndIf EndIf EndIf EndSub '************************************************************************ 'Allows sprites to travel through tunnels and causes the monsters to slow down at tunnel entrances: sub CheckGoThroughTunnels If Sprites <> SBC Then if (SpriteArray[Sprites][mazecol]=sld1X And SpriteArray[Sprites][mazeRow]=sld2Y) or (SpriteArray[Sprites][mazecol]=sld2X And SpriteArray[Sprites][mazeRow]=sld2Y) Then SpriteArray[Sprites][spriteSpeed]=4 EndIf endif If SpriteArray[Sprites][mazeCol] = rightTunnelX and SpriteArray[Sprites][mazeRow] = rightTunnelY Then SpriteArray[Sprites][mazeCol] = leftTunnelX SpriteArray[Sprites][mazeRow] = leftTunnelY AdjustScreenCoords() ElseIf SpriteArray[Sprites][mazeCol] = leftTunnelX and SpriteArray[Sprites][mazeRow] = leftTunnelY Then SpriteArray[Sprites][mazeCol] = rightTunnelX SpriteArray[Sprites][mazeRow] = rightTunnelY AdjustScreenCoords() EndIf EndSub '******************************************************************** 'Shows the per-monster points at the location where the monster was eaten: Sub ShowEatSplash GraphicsWindow.BrushColor="white" GraphicsWindow.FontName="Arial" o=shapes.AddText(monsterPts +(monsterEatenCtr * monsterPts)) osx = SpriteArray[Sprites][screenX] - sWidth osy = SpriteArray[Sprites][screenY] + sHeight Shapes.Move(o,osx,osy) SmallDelay() Shapes.Remove(o) EndSub '******************************************************************************************* sub SetupGraphicsWindow GraphicsWindow.Title="Small Basic Chomper" GraphicsWindow.Width= gamescreenWidth GraphicsWindow.Height=gameScreenHeight+10 GraphicsWindow.BackgroundColor="black" GraphicsWindow.CanResize="false" GraphicsWindow.FontSize = 13 GraphicsWindow.BrushColor="black" GraphicsWindow.FillRectangle(0,gameScreenHeight+5,gamescreenWidth+10,30) GraphicsWindow.FillRectangle(0,0,gamescreenWidth+10,15) GraphicsWindow.FontBold = "true" GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(1,0,"SCORE: ") GraphicsWindow.DrawText(125,0,"LEVEL: ") GraphicsWindow.DrawText(250,0,"LIVES: ") GraphicsWindow.BrushColor="white" GraphicsWindow.DrawText(0,gameScreenHeight+4, "Small Basic CHOMPER Release 2 - by Anthony Yarrell") scoreShape=Shapes.AddText(gameScore) livesShape=Shapes.AddText(SpriteArray[sbc][Lives]) levelShape=Shapes.AddText(gameLevel) Shapes.Move(scoreShape,60,0) Shapes.Move(levelShape,180,0) Shapes.Move(livesShape,320,0) endsub '******************************************************************************************* Sub DisplayScore Shapes.SetText(scoreShape,gamescore) EndSub '******************************************************************************************* Sub DisplayLives Shapes.SetText(livesShape,SpriteArray[sbc][lives]) EndSub '******************************************************************************************* Sub DisplayLevel Shapes.SetText(levelShape,gameLevel) EndSub '******************************************************************************************* Sub BlackoutGameScreen GraphicsWindow.BrushColor="black" blkScreen = Shapes.AddRectangle(gamescreenWidth+10, gameScreenHeight+10) Endsub '******************************************************************************************* Sub RemoveBlackScreen Shapes.Remove(blkScreen) EndSub '************************************************************************** Sub ScoreAndBonusManager monsterBonusPts = 1000 'Points given to player for eating 4 monsters in succession. monsterPts = 200 'Points player gets when he/she eats a monster.' monsterPtsMuliplier = 2 'Causes player to get bonus points when monsters are eaten in succession. pelletScore = 25 'Points player gets for eating a normal pellet. energizerScore = 100 'Points player gets for eating a power pellet 'Calculate score for pellets or energizers that were eaten: If hasEatenEnergizer = "TRUE" Then gameScore = gameScore + energizerScore hasEatenEnergizer = "FALSE" ElseIf hasEatenPellet = "TRUE" then gameScore = gameScore + pelletScore hasEatenPellet = "FALSE" EndIf 'Count monsters eaten per level: If energizerTimer = ACTIVE Then If hasEatenMonster="True" Then monsterEatenCtr = monsterEatenCtr + 1 monstersEatenPerLevel = monstersEatenPerLevel + 1 hasEatenMonster="False" EndIf Else monsterEatenCtr=0 EndIf 'Update score based on number of monsters eaten: If monsterEatenCtr = 4 Then gameScore = gameScore + monsterBonusPts monsterEatenCtr=0 EndIf If monstersEatenPerLevel = 16 Then SpriteArray[sbc][Lives] = SpriteArray[sbc][Lives] + 1 monstersEatenPerLevel = 0 gameScore = gameScore + (monsterEatenCtr * monsterPts) EndIf DisplayLevel() DisplayLives() DisplayScore() EndSub '************************************************************* 'This routines causes to the monsters to alternate between 'Chase and Scatter modes after a number of cycles have passed. 'The timing is generated randomly to make it difficult for the 'player to determine when the mode switch will happen. 'This makes it harder for SBC to avoid the monsters or reach the 'energizers. 'See SetMonsterTargets() to see what corners each monster goes 'to during SCATTER mode. Sub DoChaseScatterFrightCycles ModeSwitchCounter=ModeSwitchCounter+1 If (ModeSwitchCounter > ModeSwitchTime) Then If SpriteArray[sprites][state] = CHASE then SpriteArray[sprites][state] = SCATTER EndIf EndIf If (ModeSwitchCounter > (ModeSwitchTime + 200)) Then If SpriteArray[sprites][state] = SCATTER Then SpriteArray[sprites][state] = CHASE EndIf EndIf If ModeSwitchCounter > (ModeSwitchTime + 250) Then ModeSwitchCounter=0 ModeSwitchTime = Math.GetRandomNumber(100) EndIf EndSub End>XDM133.sb< Start>XDM400.sb< ' Small Basic Command List, how to use. ' This is not sufficient. Please confirm this yourself. By NaochanON . 2011/8/9 ' $ mark shows error occurred on my PC(NaochanON). Check it on your PC. ' '
' GameKeyboard AltDown not checked yet ' GameKeyboard CapsLockOn not checked yet ' GameKeyboard CtrlDown not checked yet ' GameKeyboard LastKey not checked yet ' GameKeyboard NumLockOn not checked yet ' GameKeyboard ScrollLockOn not checked yet ' GameKeyboard ShiftDown not checked yet ' GameKeyboard IsKeyDown not checked yet ' GameKeyboard KeyDown not checked yet ' GameKeyboard KeyUp not checked yet ' GameMouse IsLeftButtonDown not checked yet ' GameMouse IsMiddleButtonDown not checked yet ' GameMouse IsRightButtonDown not checked yet ' GameMouse IsX1ButtonDown not checked yet ' GameMouse IsX2ButtonDown not checked yet ' GameMouse LastScrollingChange not checked yet ' GameMouse MouseX MX=GameMouse.MouseX ' GameMouse MouseY MY=GameMouse.MouseY ' GameMouse ChangeCursor GameMouse.ChangeCursor("Hand") ' GameMouse HideCursor GameMouse.HideCursor() ' GameMouse LoadCursor cursol1=GameMouse.LoadCursor("c:/cursol1.bmp") ' GameMouse RemoveCursorFromMemory GameMouse.RemoveCursorFromMemory(cursol1) ' GameMouse SetCursorOfElement not checked yet ' GameMouse ShowCursor GameMouse.ShowCursor() ' GameMouse MouseDown GameMouse.MouseDown=OnmouseDownn ' GameMouse MouseMove GameMouse.MouseMove=OnmouseMove ' GameMouse MouseUp not checked yet ' GameMouse MouseWheel not checked yet ' GameWindow BackgroundColor not checked yet ' GameWindow CanResize not checked yet ' GameWindow FlowDirection not checked yet ' GameWindow FullScreenMode not checked yet ' GameWindow GameBrushColor not checked yet ' GameWindow GamePenColor not checked yet ' GameWindow GamePenWidht not checked yet ' GameWindow Height not checked yet ' GameWindow Icon not checked yet ' GameWindow IsEnabled not checked yet ' GameWindow IsFocused not checked yet ' GameWindow IsVisible not checked yet ' GameWindow LastEventSource not checked yet ' GameWindow Left not checked yet ' GameWindow MaxHeight not checked yet ' GameWindow MaxWidth not checked yet ' GameWindow MinHeight not checked yet ' GameWindow MinWidth not checked yet ' GameWindow Theme not checked yet ' GameWindow Title not checked yet ' GameWindow Top not checked yet ' GameWindow Topmost not checked yet ' GameWindow Width not checked yet ' GameWindow WindowState not checked yet ' GameWindow WindowStyle not checked yet ' GameWindow Clear not checked yet ' GameWindow Close not checked yet ' GameWindow Focus not checked yet ' GameWindow Hide not checked yet ' GameWindow RemoveElement not checked yet ' GameWindow Show not checked yet ' GameWindow Closing not checked yet ' GameWindow GotFocus not checked yet ' GameWindow LostFocus not checked yet ' GameWindow Moved not checked yet ' GameWindow SizeChanged not checked yet ' GraphicsWindow BackgroundColor GraphicsWindow.BackgroundColor=Dialogs.AskForColor() ' GraphicsWindow BrushColor GraphicsWindow.BrushColor="Navy" ' GraphicsWindow CanResize GraphicsWindow.CanResize="true" ' GraphicsWindow FontBold GraphicsWindow.FontBold="true" ' GraphicsWindow FontItalic GraphicsWindow.FontItalic="true" ' GraphicsWindow FontName GraphicsWindow.FontName="coorie new" ' GraphicsWindow FontSize GraphicsWindow.FontSize=20 ' GraphicsWindow Height GraphicsWindow.Height=Desktop.Height-50 ' GraphicsWindow LastKey not checked yet ' GraphicsWindow LastText not checked yet ' GraphicsWindow Left GraphicsWindow.Left=20 ' GraphicsWindow MouseX MX=GraphicsWindow.MouseX ' GraphicsWindow MouseY MY=GraphicsWindow.MouseY ' GraphicsWindow PenColor GraphicsWindow.PenColor="red" ' GraphicsWindow PenWidth GraphicsWindow.PenWidth=3 ' GraphicsWindow Title GraphicsWindow.Title="Small Basic Sample" ' GraphicsWindow Top GraphicsWindow.Top=desktop.Height-20 ' GraphicsWindow Width GraphicsWindow.Width=Desktop.Width-100 ' GraphicsWindow Clear GraphicsWindow.Clear() ' GraphicsWindow DrawBoundText GraphicsWindow.DrawBoundText(100,50,80,"test test test test ") ' GraphicsWindow DrawEllipse GraphicsWindow.DrawEllipse(50,60,40,30) ' GraphicsWindow DrawImage GraphicsWindow.DrawImage(img1,100,150) ' GraphicsWindow DrawLine GraphicsWindow.DrawLine(100,150,200,250) ' GraphicsWindow DrawRectangle GraphicsWindow.DrawRectangle(10,250,230,50) ' GraphicsWindow DrawResizedImage GraphicsWindow.DrawResizedImage(img1,80,100,80,90) ' GraphicsWindow DrawText GraphicsWindow.DrawText(100,200,"test test test") ' GraphicsWindow DrawTriangle GraphicsWindow.DrawTriangle(50,40,100,80,130,60) ' GraphicsWindow FillEllipse GraphicsWindow.FillEllipse(50,40,100,80) ' GraphicsWindow FillRectangle GraphicsWindow.FillRectangle(50,40,100,80) ' GraphicsWindow FillTriangle GraphicsWindow.FillTriangle(50,40,100,80,130,60) ' GraphicsWindow GetColorFromRGB color=GraphicsWindow.GetColorFromRGB(50,256,123) ' GraphicsWindow GetPixel color=GraphicsWindow.GetPixel(50,150) ' GraphicsWindow GetRandomColor color=GraphicsWindow.GetRandomColor() ' GraphicsWindow Hide GraphicsWindow.Hide() ' GraphicsWindow SetPixel GraphicsWindow.SetPixel(100,150,"blue") ' GraphicsWindow Show GraphicsWindow.Show() ' GraphicsWindow ShowMessage GraphicsWindow.ShowMessage("Hellow","message") ' GraphicsWindow KeyDown not checked yet ' GraphicsWindow KeyUp not checked yet ' GraphicsWindow MouseDown GraphicsWindow.MouseDown=OnmouseDown ' GraphicsWindow MouseMove GraphicsWindow.MouseMove=OnmouseMove ' GraphicsWindow MouseUp GraphicsWindow.MouseUp=OnmouseUp ' GraphicsWindow TextInput GraphicsWindow.TextInput=OnTextInput ' GWPlus Icon not checked yet ' GWPlus IsEnabled not checked yet ' GWPlus IsFocused not checked yet ' GWPlus MaxHeight GWPlus.MaxHeight=450 ' GWPlus MaxWidth GWPlus.MaxWidth=400 ' GWPlus MinHeight not checked yet ' GWPlus MinWidth not checked yet ' GWPlus WindowStyle not checked yet ' Hardware CPUBit CPBIT=Hardware.CPUBit ' Hardware CPUCores CPData=Hardware.CPUCores ' Hardware CPULogicalProcessors CPData=Hardware.CPULogicalProcessors ' Hardware CPUManufacturer CPData=Hardware.CPUManufacturer ' Hardware CPUName CPData=Hardware.CPUName ' Hardware CPUSpeed CPData=Hardware.CPUSpeed ' Hardware DiskDrives CPData=Hardware.DiskDrives ' Hardware GPUName CPData=Hardware.GPUName ' Hardware HardDrives CPData=Hardware.HardDrives ' Hardware IP CPData=Hardware.ip ' $ Hardware PhysicalMemory error occurred ' ImageList GetHeightOfImage a=ImageList.GetHeightOfImage(img1) ' ImageList GetWidthOfImage a=ImageList.GetWidthOfImage(img1) ' ImageList LoadImage img1=ImageList.LoadImage(url) ' Math Pi X1=Math.pi ' MathPlus Pi same as above mentioned ' Math Abs X1=Math.Abs(-12.34) ' MathPlus Abs same as above mentioned ' Math ArcCos x1=math.ArcCos(0.34) ' MathPlus ACos same as above mentioned ' Math ArcSin x1=math.ArcSin(0.34) ' MathPlus ASin same as above mentioned ' Math ArcTan x1=math.Arctan(1.34) ' MathPlus ATan same as above mentioned ' MathPlus ATan2 not checked yet ' Math Ceiling x1=Math.Ceiling (4.34) ' MathPlus Ceiling same as above mentioned ' Math Cos x1=Math.Cos (0.34) ' MathPlus Cos same as above mentioned ' MathPlus Cosh X1=MathPlus.cosh(0.8) ' Math Floor x1=Math.Floor (6.34) ' MathPlus Floor same as above mentioned ' Math GetDegrees x1=Math.GetDegrees (0.34) ' MathPlus GetDegrees same as above mentioned ' Math GetRadians x1=Math.GetRadians(45) ' MathPlus GetRadians same as above mentioned ' Math GetRandomNumber x1=Math.GetRandomNumber(10) ' MathPlus GetRandomNumber same as above mentioned ' MathPlus IsNumber x1=MathPlus.IsNumber(123.5) ' MathPlus IsNumberNegative x1=MathPlus.IsNumberNegative(-123.5) ' Math Log x1=Math.log(123.5) ' MathPlus Log same as above mentioned ' Math Max x1=Math.max(211,125) ' MathPlus Max same as above mentioned ' Math Min x1=Math.min(211,125) ' MathPlus Min same as above mentioned ' Math NaturalLog x1=Math.NaturalLog(125) ' MathPlus NaturalLog same as above mentioned ' Math Power x1=Math.Power(10,5) X1=100000 ' MathPlus Power same as above mentioned ' Math Remainder x1=Math.Remainder(113,5) ' MathPlus Remainder same as above mentioned ' Math Round x1=Math.Round(113.45) ' MathPlus Round same as above mentioned ' MathPlus RoundWithDecimals not checked yet ' Math Sin x1=Math.sin(1.45) ' MathPlus Sin same as above mentioned ' MathPlus Sinh X1=MathPlus.sinh(0.64) ' Math SquareRoot x1=Math.SquareRoot(145) ' MathPlus SquareRoot same as above mentioned ' Math Tan x1=math.Tan(0.9) ' MathPlus Tan same as above mentioned ' MathPlus Tanh x1=MathPlus.Tanh(1.4) ' MathPlus ToNumber not checked yet ' Media CreateMediaPlayer mplay1=Media.CreateMediaPlayer(pgdf,50,40,500,380) ' Media GetLength TextWindow.WriteLine(Media.GetLength(mplay1)) ' Media GetMedia TextWindow.WriteLine(Media.GetMedia(mplay1)) ' Media GetPosition not checked yet ' Media GetSpeedRatio not checked yet ' Media GetStretchMode not checked yet ' Media GetVolume not checked yet ' Media Pause Media.Pause(mplay1) GFK353 ' Media Play Media.Play(mplay1) ' Media PlayFromPosition not checked yet ' Media Resume Media.Resume(mplay1) GFK353 ' Media SetMedia Media.SetMedia(mplay1,pgdf) ' pgdf=program.Directory+"/HeyJude.mp4" ' Media SetPosition not checked yet ' Media SetSpeedRatio not checked yet ' Media SetStretchMode not checked yet ' Media SetVolume not checked yet ' Media Stop Media.Stop(mplay1) GFK353 ' Mouse IsLeftButtonDown a=GameMouse.IsLeftButtonDown ' Mouse IsRightButtonDown b=GameMouse.IsRightButtonDown ' Mouse MouseX MX=Mouse.MouseX ' Mouse MouseY MY=Mouse.MouseY ' Mouse HideCursor Mouse.HideCursor() ' Mouse ShowCursor Mouse.ShowCursor() ' The following line could be harmful and has been automatically commented. ' ' MusicFile PlayTime b=MusicFile.PlayTime(program.Directory+"/HeyJude.mp4") ' Network DownLoadFile Dfile1=Network.DownloadFile(url) ' Network GetWebPageContents not checked yet ' NetworkClient IsConnected a=NetworkClient.IsConnected ' NetworkClient LastReceivedText a=NetworkClient.LastReceivedText ' NetworkClient Connect NetworkClient.Connect(IP,PortNo,name,password) ' NetworkClient DisConnect NetworkClient.Disconnect() ' NetworkClient SendMessage NetworkClient.SendMessage("Hellow") ' NetworkClient MessageReceived NetworkClient.MessageRecieved=OnNetReceived ' NetworkPlus CurrentHostName not checked yet ' NetworkPlus IsConnectedToNetwork not checked yet ' NetworkPlus LastError not checked yet ' NetworkPlus DownloadFile NetworkPlus.DownloadFile (url,pgdf) ' NetworkPlus GetWebPageContents NetworkPlus.GetWebPageContents (url) ' NetworkPlus IsIPAddress not checked yet ' NetworkPlus IsValidPort not checked yet ' NetworkPlus Ping not checked yet ' NetworkPlus UploadFile NetworkPlus.UploadFile(pgdf,Turl) ' NetworkServer Clients clients=NetworkServer.Clients ' NetworkServer LastMessageSendedClient not checked yet ' NetworkServer LastRecievedMessage not checked yet ' NetworkServer LastRecievedPassword not checked yet ' NetworkServer LastRecievedUsername not checked yet ' NetworkServer AllowLatestUserToConnect not checked yet ' NetworkServer Disable NetworkServer.Disable() ' NetworkServer Enable NetworkServer.Enable(Port) ' NetworkServer RemoveClient NetworkServer.RemoveClient(client) ' NetworkServer SendMessage NetworkServer.SendMessage(Client,"Hellow") ' NetworkServer SendMessageToAll NetworkServer.SendMessageToAll("Hellow") ' NetworkServer MessageRecieved NetworkServer.MessageRecieved=OnNetReceived ' NetworkServer SomeoneTryConnect not checked yet ' OperatingSystemApplicationData not checked yet ' OperatingSystemCurrentCulture not checked yet ' OperatingSystemCurrentUICulture not checked yet ' OperatingSystemDesktop a=OperatingSystem.Desktop ' OperatingSystemEnviromentVariables a=OperatingSystem.EnviromentVariables ' OperatingSystemIdleTime a=OperatingSystem.IdleTime ' OperatingSystemIs64BitProgram a=OperatingSystem.Is64BitProgram ' OperatingSystemLastInputTime a=OperatingSystem.LastInputTime ' OperatingSystemMachineName a=OperatingSystem.MachineName ' OperatingSystemOSName a=OperatingSystem.OSName ' OperatingSystemOSVersion a=OperatingSystem.OSVersion ' OperatingSystemPersonal a=OperatingSystem.Personal ' OperatingSystemProgramData a=OperatingSystem.ProgramData ' OperatingSystemProgramFiles a=OperatingSystem.ProgramFiles ' OperatingSystemProgramFilesx86 a=OperatingSystem.ProgramFilesx86 ' OperatingSystemStartMenu a=OperatingSystem.StartMenu ' OperatingSystemStartUp a=OperatingSystem.StartUp ' OperatingSystemTemp a=OperatingSystem.Temp ' OperatingSystemUpTime a=OperatingSystem.UpTime ' OperatingSystemUserName a=OperatingSystem.UserName ' OperatingSystemCloseDiskDrive OperatingSystem.CloseDiskDrive("E:") ' OperatingSystemGetEnvironmentVariable not checked yet ' OperatingSystemHibernate not checked yet ' OperatingSystemLock not checked yet ' OperatingSystemLogOff OperatingSystem.LogOff() ' OperatingSystemOpenDiskDrive OperatingSystem.OpenDiskDrive("E:") ' OperatingSystemRestart not checked yet ' OperatingSystemSetEnvironmentVariable OperatingSystem.SetEnvironmentVariable(Variable, Value) ' OperatingSystemShutdown OperatingSystem.Shutdown() ' OperatingSystemStandBy OperatingSystem.StandBy() ' PictureTools DrawingColor PictureTools.DrawingColor="Blue" ' PictureTools DrawingPenWidht PictureTools.DrawingPenWidht=4 ' PictureTools AddEllipse PictureTools.AddEllipse(image0,50,20,20,20,"True") ' PictureTools AddImage image2=PictureTools.AddImage(image0,image1,50,40,45,45) ' PictureTools AddLine image5=PictureTools.AddLine(image4,45,50,90,80) ' PictureTools AddPie not checked yet ' PictureTools AddPolygon image3=PictureTools.AddPolygon(image2,pointarray,100,80,"true") ' PictureTools AddRectangle image4=PictureTools.Addrectangle(image3,45,50,90,80,"true") ' PictureTools AddText c=PictureTools.AddText(Image5,60,70,"Test","coorie new",15, "true","false") ' PictureTools AddTriangle image1=PictureTools.Addtriangle(Image0,60,70,100,135,143,90,"false") ' PictureTools ConvertImageToSting a=PictureTools.ConvertImageToSting(image3) ' PictureTools ConvertStringToImage b=PictureTools.ConvertStringToImage(a) ' PictureTools CreateImage image0=PictureTools.CreateImage(400,350) ' PictureTools GrayScale image4=PictureTools.GrayScale(image3) ' PictureTools InvertImage image5=PictureTools.InvertImage(image3) ' PictureTools LoadImage image6=PictureTools.LoadImage(url) 'url=program.directory+"/GaGa.bmp" ' PictureTools RemoveImageFromMemory PictureTools.RemoveImageFromMemory(image5) ' PictureTools ResizeImage image7=PictureTools.ResizeImage(image6,350,380) ' PictureTools RotateFlipImage image8=PictureTools.rotateFlipImage(image7,"R90FY") ' PictureTools SaveImage PictureTools.SaveImage(image8,url2) 'ur2l=program.directory+"/RGaGa.bmp" ' PictureTools ScaleImage image9=PictureTools.ScaleImage(image8,0.8,0.5) ' PictureTools SetBrightness not checked yet ' PictureTools SetColors not checked yet ' PictureTools SetContrast not checked yet ' PictureTools SetGamma not checked yet ' PictureTools SetTransparencyColor not checked yet ' $ PictureTools CropImage image3=PictureTools.CropImage(image2,10,30,130,150) ' sometimes Error occurs ' Margin…. " Left, Top, Right, Bottom " is not correct. Actually " Left, Top, Top&Right, Bottom " ' $ PictureTools TakeScreenShot image10=PictureTools.TakeScreenShot(0,80,50,300) ' error occurred on my PC ' Margin…. " Left, Right,Top, Bottom " is not correct. Actually " Left, Top&Right,Bottom, Bottom " ' Printing ActivePrintFont not checked yet ' Printing ActivePrintFontColor not checked yet ' Printing ActivePrintFontName not checked yet ' Printing ActivePrintFontSize not checked yet ' Printing LastError not checked yet ' Printing CreatePointFont not checked yet ' Printing DeletePointFont not checked yet ' Printing Print Printing.Print(image10,"") ' Printing PrintPreview Printing.PrintPreview(image10,"") ' Printing ScanImage not checked yet ' Printing SetFontUsingDialog not checked yet ' Process GetProcess a=Process.GetProcesses() ' Process Start Process.start("print.bat") ' Process Stop not checked yet ' Program ArgumentCount not checked yet ' Program Directory url=Program.Directory+"/gaga.bmp" ' Program Delay Program.Delay(1000) ' Program End Program.End() ' Program GetArgument not checked yet ' ProgramPlus ArgumentCount not checked yet ' ProgramPlus FileToOpen not checked yet ' ProgramPlus ProgramDirectory not checked yet ' ProgramPlus Subs not checked yet ' ProgramPlus Variables not checked yet ' ProgramPlus CallSub not checked yet ' ProgramPlus Delay not checked yet ' ProgramPlus End not checked yet ' ProgramPlus Exit not checked yet ' ProgramPlus GetArgument a=ProgramPlus.GetArgument(1) ' ProgramPlus GetValueOfVariable not checked yet ' ProgramPlus RegisterFileExtension not checked yet ' ProgramPlus Restart not checked yet ' ProgramPlus SetValueOfVariable not checked yet ' SecondTimer Interval secondTimer.Interval = 1000 ' SecondTimer Pause SecondTimer.Pause() ' SecondTimer Resume SecondTimer.Resume() ' SecondTimer Tick secondTimer.Tick = ShowTime ' Security IsRunnedAsAdministrator not checked yet ' Security Decrypt not checked yet ' Security Encrypt not checked yet ' Security FastDecrypt not checked yet ' Security FastEncrypt not checked yet ' Security GenerateChecksum not checked yet ' Security GenerateEasyPassword not checked yet ' Security GenerateHash not checked yet ' Security GeneratePassword not checked yet ' Security RestartAsAdministrator not checked yet ' Shapes AddEllipse a=Shapes.AddEllipse(200,180) ' Shapes AddImage c=Shapes.AddImage(b) ' Shapes Addline d=shapes.AddLine(20,50,100,60) ' Shapes AddRectangle b=shapes.AddRectangle(400,50) ' Shapes AddText e=shapes.AddText("Hellow") ' Shapes AddTriangle f=shapes.AddTriangle(10,20,50,60,80,25) ' Shapes Animate Shapes.animate(f,100,100,600) ' Shapes GetLeft a=Shapes.GetLeft(shapes.AddRectangle(400,50)) ' $ Shapes GetOpacity b=Shapes.GetOpacity(a) ' error occurred on my PC ' Shapes GetTop a=Shapes.Gettop(shapes.AddRectangle(400,50)) ' Shapes HideShape Shapes.HideShape(f) ' Shapes Move Shapes.Move(e,100,150) ' Shapes Remove Shapes.Remove(a) ' Shapes Rotate Shapes.Rotate(a,45) ' Shapes SetOpacity Shapes.SetOpacity(a,45) ' Shapes SetText Shapes.SetText(e,"Hellow Nice") ' Shapes ShowShape Shapes.ShowShape(e) ' Shapes Zoom Shapes.Zoom(a,1.5,2) ' SoundPlus CreateSoundPlayer mp=SoundPlus.CreateSoundPlayer(url) ' SoundPlus GetLength XL=soundplus.GetLength(mp) ' SoundPlus GetPosition XP=soundplus.GetPosition(mp) ' SoundPlus GetSound Fpath=soundplus.GetSound(mp) ' SoundPlus GetSpeedRatio x1=soundplus.GetSpeedRatio(mp) ' SoundPlus GetVolume XV=soundplus.GetVolume(mp) ' SoundPlus Octave x1=soundplus.Octave ' Sound Pause Sound.Pause(url) ' SoundPlus Pause same as above mentioned ' Sound Play Sound.Play(url) ' url="C:/sound/Hellow.wav" ' SoundPlus Play same as above mentioned ' Sound PlayAndWait Sound.PlayAndWait(url) ' SoundPlus PlayAndWait same as above mentioned ' SoundPlus PlayAsterisk soundplus.PlayAsterisk() ' $ SoundPlus PlayBeep soundplus.PlayBeep(15000,500) ' doesn't work ' Sound PlayBellRing Sound.PlayBellRing() QVK058 ' SoundPlus PlayBellRing same as above mentioned ' Sound PlayBellRingAndWait Sound.PlayBellRingAndWait() ' SoundPlus PlayBellRingAndWait same as above mentioned ' SoundPlus PlayBep soundplus.PlayBep() ' Sound Playchime Sound.PlayChime() QVK058 ' SoundPlus PlayChime same as above mentioned ' Sound PlayChimeAndwait Sound.PlayChimeAndWait() ' SoundPlus PlayChimeAndWait same as above mentioned ' Sound PlayClick Sound.PlayClick() QVK058 ' SoundPlus PlayClick same as above mentioned ' Sound PlayClickAndWait Sound.PlayClickAndWait() ' SoundPlus PlayClickAndWait same as above mentioned ' SoundPlus PlayExclamation soundplus.PlayExclamation() ' SoundPlus PlayFromPosition not checked yet ' SoundPlus PlayHand soundplus.PlayHand() ' Sound PlayMusic Sound.PlayMusic("G8O1F8O1A8O1B8O2C8O2D8O2F8O2E-8O5E8O5G8O5"TXZ747 ' SoundPlus PlayMusic same as above mentioned ' $ SoundPlus PlayQuestion soundplus.PlayQuestion() 'doesn't work ' SoundPlus RemoveSoundPlayer soundplus.RemoveSoundPlayer(mp) ' SoundPlus Resume soundplus.Resume(url) ' SoundPlus SetSound not checked yet ' SoundPlus SetSpeedRatio not checked yet ' SoundPlus SetVolume not checked yet ' Sound Stop Sound.Stop(url) ' SoundPlus Stop same as above mentioned ' Speech Pause not checked yet ' Speech Resume not checked yet ' Speech Speak not checked yet ' Speech SpeakAndWait not checked yet ' Speech SpeakToWavFile not checked yet ' Speech SynthesisSpeed not checked yet ' Speech SynthesisVoice not checked yet ' Speech Speed not checked yet ' Speech Volume not checked yet ' Stack GetCount not checked yet ' Stack PopValue not checked yet ' Stack PushValue not checked yet ' Text Append Text.Append(" ","3456") ' TextPlus Append same as above mentioned ' Text ConvertToLowerCase a=Text.ConvertToLowerCase("TEXT") ' TextPlus ConvertToLowerCase same as above mentioned ' Text ConvertToUpperCase b=Text.ConvertToUpperCase("text") ' TextPlus ConvertToUpperCase same as above mentioned ' Text EndsWith b=Text.EndsWith("Text get with text","text") --> b="True" ' TextPlus EndsWith same as above mentioned ' Text GetCharacter b=Text.GetCharacter(65) ---> b="A" ' TextPlus GetCharacter same as above mentioned ' Text GetCharacterCode b=Text.GetCharactercode("A") --> b=65 ' TextPlus GetCharacterCode same as above mentioned ' Text GetIndexOf b=Text.GetIndexOf("Text get with text","with") --> b=10 ' TextPlus GetIndexOf same as above mentioned ' Text GetLength b=Text.GetLength("Text get with text") --> b=19 ' TextPlus GetLength same as above mentioned ' Text GetSubtext b=Text.GetSubText("Text get with text",6,3) --> b="get" ' TextPlus GetSubText same as above mentioned ' Text GetSubtextToEnd b=Text.GetSubTextToEnd("Text get with text",13) --> "h text" ' TextPlus GetSubTextToEnd same as above mentioned ' TextPlus InsertSubText a=TextPlus.InsertSubText("same as mentioned","above ",9) ' TextPlus IsDigit a=TextPlus.IsDigit("1") ' --> a="True" ' TextPlus IsEmpty a=TextPlus.IsEmpty("") ' --> a="True" ' TextPlus IsLetter a=TextPlus.IsLetter("K") ' --> a="True" ' TextPlus IsLower a=TextPlus.IsLower("K") ' --> a="False" ' TextPlus IsNumber a=TextPlus.IsNumber("K") ' --> a="False" ' Text IsSubText b=Text.IsSubText("Text get with text","wit") --> b="True" ' TextPlus IsSubText same as above mentioned ' TextPlus IsUpper a=TextPlus.IsUpper("T") ' TextPlus RemoveSubText a=TextPlus.RemoveSubText("Text get with text",6,8) --> "Text text" ' TextPlus ReplaceSubText a=TextPlus.ReplaceSubText("Text get with","ext","") --> "T get with" ' Text StartsWith b=Text.StartsWith("Text get with text","get") --> b="False" ' TextPlus StartsWith same as above mentioned ' TextBoxFocus GetFocus not checked yet ' TextBoxFocus IsFocus not checked yet ' TextBoxFocus SetFocus not checked yet ' TextWindow BackgroundColor TextWindow.BackgroundColor="white" ' TextWindowPlus BackgroundColor same as above mentioned ' TextWindow Clear TextWindow.Clear() ' TextWindowPlus Clear same as above mentioned ' TextWindow CursorLeft c=TextWindow.CursorLeft ' TextWindowPlus CursorLeft same as above mentioned ' TextWindow CursorTop c=TextWindow.CursorTop ' TextWindowPlus CursorTop same as above mentioned ' TextWindowPlus CursorVisible b=TextWindowPlus.CursorVisible ' TextWindowPlus DisableCloseButton TextWindowPlus.DisableCloseButton() ' you'd better not to use this ' TextWindow ForegroundColor TextWindow.ForegroundColor="red" ' TextWindowPlus ForegroundColor same as above mentioned ' TextWindowPlus Height b=TextWindowPlus.Height ' TextWindow Hide TextWindow.Hide() ' TextWindowPlus Hide same as above mentioned ' TextWindowPlus LargestHeight b=TextWindowPlus.LargestHeight --> b=40 ' TextWindowPlus LargestWidth b=TextWindowPlus.LargestWidth --> b=170 ' TextWindow Left b=TextWindow.Left ' TextWindowPlus Left same as above mentioned ' TextWindowPlus Maximize TextWindowPlus.Maximize() ' TextWindowPlus Minimize TextWindowPlus.Minimize() ' TextWindow Pause TextWindow.Pause() ' TextWindowPlus Pause same as above mentioned ' TextWindow PauseIfVisible TextWindow.PauseIfVisible() ' TextWindowPlus PauseIfVisible same as above mentioned ' TextWindow PauseWithoutMessage TextWindow.PauseWithoutMessage() ' TextWindowPlus PauseWithoutMessage same as above mentioned ' TextWindow Read c=TextWindow.Read() Textwindow.writeline? ' TextWindowPlus Read same as above mentioned ' $ TextWindow ReadKey Not exists ? ' TextWindow ReadNumber b=TextWindow.ReadNumber() ' TextWindowPlus ReadNumber same as above mentioned ' TextWindowPlus ResetColors TextWindowPlus.ResetColors() ' TextWindowPlus Restore TextWindowPlus.Restore() ' TextWindowPlus SetIcon TextWindowPlus.SetIcon(iconfilepath) ' TextWindow Show TextWindow.Show() ' TextWindowPlus Show same as above mentioned ' TextWindow Title TextWindow.Title="Text Test" ' TextWindowPlus Title same as above mentioned ' TextWindow Top b=TextWindow.Top ' TextWindowPlus Top same as above mentioned ' TextWindowPlus TopMost b=TextWindowPlus.TopMost ' TextWindowPlus Width b=TextWindowPlus.width ' TextWindow Write TextWindow.Write("Text get with text") ' TextWindowPlus Write same as above mentioned ' TextWindow WriteLine TextWindow.WriteLine( a ) ' TextWindowPlus WriteLine same as above mentioned ' Timer Interval Timer.Interval = 1000 ' Timer Pause Timer.Pause() ' Timer resume Timer.Resume() ' Timer Tick Timer.Tick = ShowTime ' Turtle Angle a=Turtle.Angle ' Turtle Speed Turtle.Speed=5 ' Turtle X Turtle.x=50 ' Turtle Y Turtle.y=60 ' Turtle Hide Turtle.Hide() ' Turtle Move Turtle.Move(30) ' Turtle MoveTo Turtle.MoveTo(70,45) ' Turtle PenDown Turtle.PenDown() ' Turtle PenUp Turtle.PenUp() ' Turtle Show Turtle.Show() ' Turtle Turn Turtle.Turn(45) ' Turtle TurnLeft Turtle.TurnLeft() ' Turtle TurnRight Turtle.TurnRight() ' End>XDM400.sb< Start>XDM902.sb< 'some stuff to compile before test message = "hello world" someText = "1=azd;2=4hg1m;3= ;4=?!l" CreateContainerContent() PreTestCompilation() 'this produced the good old: Other task is running error @ 1st run start = Clock.ElapsedMilliseconds For i = Array.GetItemCount(testContainer) To 1 Step -1 EndFor TextWindow.Write("result 1: ") TextWindow.WriteLine(Clock.ElapsedMilliseconds - start) start = Clock.ElapsedMilliseconds For i = Array.GetItemCount(testContainer) To 1 Step -1 EndFor TextWindow.Write("result 1.1: ") TextWindow.WriteLine(Clock.ElapsedMilliseconds - start) start = Clock.ElapsedMilliseconds For i = 1 To Array.GetItemCount(testContainer) EndFor TextWindow.Write("result 1.2: ") TextWindow.WriteLine(Clock.ElapsedMilliseconds - start) start = Clock.ElapsedMilliseconds For j = Array.GetItemCount(testContainer) To 1 Step -1 k = 1 EndFor TextWindow.Write("result 2: ") TextWindow.WriteLine(Clock.ElapsedMilliseconds - start) cache = Array.GetItemCount(testContainer) start = Clock.ElapsedMilliseconds For i = 1 To cache EndFor TextWindow.Write("result 3: ") TextWindow.WriteLine(Clock.ElapsedMilliseconds - start) start = Clock.ElapsedMilliseconds For i = 1 To cache EndFor TextWindow.Write("result 3.1: ") TextWindow.WriteLine(Clock.ElapsedMilliseconds - start) Sub CreateContainerContent For i = 1 To 10000 If Math.Remainder(i, 2) = 0 Then testContainer[i] = Math.GetRandomNumber(9) Else testContainer[i] = someText[Math.GetRandomNumber(Array.GetItemCount(someText))] EndIf EndFor EndSub Sub PreTestCompilation TextWindow.WriteLine(message) TextWindow.Hide() GraphicsWindow.Show() GraphicsWindow.DrawBoundText(10, 10, 50, message) Program.Delay(2000) GraphicsWindow.Hide() TextWindow.Clear() EndSub End>XDM902.sb< Start>XDP525.sb< 'Program: Names 'by Martin Menze ' 'Use LitDev Extentions ' '06/2015 GraphicsWindow.Show() 'Before do anny thinks show the graphic window. It is a old Small Basic bug. '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Events 'Events can start a Subroutine. This program use the following events. '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ GraphicsWindow.KeyUp = KeyUp 'Start Sub KeyUp if a key was uped. Controls.ButtonClicked = ButtonClicked 'Start Sub ButtonClickes if a button was clicked. '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Initialisation '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ Initialisation() 'All objects, variable and so on will define in the subroutine Initialisation. '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Main Program '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ Controls.ShowControl(ArrTextBox[VarNumFirstName])'Show the texbox to input the first name. VarInputIndex = VarNumFirstName 'Fill the variable VarInputIndex with the same value it is in the variable VarNumFirstName. It is 1. LDFocus.SetFocus(ArrTextBox[VarInputIndex]) 'Set the fokus to the textbox to input the first name. The cursor is blinking in this text box. SetFocus() 'Start the subroutine SetFocus. Fokus() 'Start the subroutine Fokus. While VarEndOfProgram = F 'Begin of the main loop. Lopp in the main loop as long as the variable VarEndOfProgram is equal F. F is "False". Fokus() 'Start the subroutine Fokus. CheckEvents() 'Start the subroutine CheckEvents EndWhile 'End of the main loop. Program.End() 'The End of this Program. '▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ 'Subroutines '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄���▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine Fokus 'Notize the value form the last name of the textbox in the variable VarOldFocus. 'Notize the value from the actual name of the textbox in the variable VarFokus. 'Is the Focus changed then identify in a loop the name of the actual textbox. 'Has it found, set the loop variable of the end value. This optimize the loop cycle. 'Start the subroutine Set Focus. '______________________________________________________________________ Sub Fokus 'Begin of subroutine Fokus VarOldFokus = VarFokus VarFokus = LDFocus.GetFocus() 'Get the name of the object with the actualy focus. If VarFokus <> VarOldFokus Then 'If the focus was changed do the folowing. For i = VarNumFirstName To VarNumLastInput 'Loop as long as i is the same as VarNumLastInput. Begin with i equal the same as in VarNumFirstName If VarFokus = ArrTextBox[i] Then 'Is the Name of the actual object the same as the textbox VarOldInputIndex = VarInputIndex 'Put the value from variable VarInputIndex into the variable VarOldInputIndex VarInputIndex = i 'Put the value from variable i into the variable VarInputIndex SetFocus() 'Start the subroutine SetFocus. EndIf 'End the last If EndFor 'If the value from i equal VarNumLastInput it is the end of the loop else the add 1 to the vallue of i. EndIf 'End the last if EndSub 'Fokus 'go back to the next line after the Start of the subroutine Fokus() '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine CheckEvents 'The subroutine CheckEvents check the events skips for events. 'Was a button clicked it start the subroutine WichButtonWasClicked. 'Was a key pressed and key uped then start the subroutine WichKeyWasPressed. '______________________________________________________________________ Sub CheckEvents If VarButtonClicked = T Then VarButtonClicked = F VarLastClickedButton = Controls.LastClickedButton WichButtonWasClicked() EndIf If VarKeyUP = T Then VarKeyUP = F VarLastKey = GraphicsWindow.LastKey WichKeyWasUped() EndIf EndSub 'CheckEvents '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine WhichButtonWasClicked 'There are 3 buttons (Next, Save and Exit). 'Was clicked Next then start the subroutines SetFocusToNextTextBox and SetFocus. 'Was clicked Save then start the subroutines SetFocustoToNextTextBox and SetFocus. ' Start the subroutine DataToDatabase and ClearObjects. At last by button Save ' to set the focus to the first text box. ' Was clicked Exit then put T (True) to the variable VarEndOfProgram. So the main loop will ended '______________________________________________________________________ Sub WichButtonWasClicked If VarLastClickedButton = ArrButton[VarNumNextField] Then SetFocusToNextTextBox() SetFocus() ElseIf VarLastClickedButton = ArrButton[VarNumSave] Then SetFocusToNextTextBox() SetFocus() ArrData[VarNumLastName] = LDText.Trim(ArrData[VarNumLastName]) If ArrData[VarNumLastName] = "" Then GraphicsWindow.ShowMessage("Please input a last name. ", " No save without last name.") VarMessage = "Data: " + ArrData[VarNumFirstName] + " " + ArrData[VarNumLastName] + " was not saved." LDFocus.SetFocus(ArrTextBox[VarNumLastName]) Else DataToDatabase() VarMessage = "Data: " + ArrData[VarNumFirstName] + " " + ArrData[VarNumLastName] + " was saved." ClearObjects() LDFocus.SetFocus(ArrTextBox[VarNumFirstName]) EndIf ShowMessage() ElseIf VarLastClickedButton = ArrButton[VarNumExit] Then VarEndOfProgram = T EndIf EndSub 'WichButtonWasClicked Sub ShowMessage Shapes.SetText(MessageShape, VarMessage) Shapes.ShowShape(MessageShape) EndSub 'ShowMessage '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine WhichKeyWasUped 'Was it key Return, then start the subroutine SetFocusToNextTextBox. The same doing by key 'Tab (Tabulator). 'By the combination of key tab and a shift key (right or left) the variable VarInputIndex substract 1. 'Is this lower then 1 the value will set with the last number ob text boxes. At last the Focus set in 'the actualy text box. '______________________________________________________________________ Sub WichKeyWasUped If VarLastKey = "Return" Then SetFocusToNextTextBox() ElseIf VarLastKey = "Tab" Then If GraphicsWindow.LastKey = "RightShift" or GraphicsWindow.LastKey = "LeftShift" Then VarInputIndex = VarInputIndex - 1 If VarInputIndex < 1 Then VarInputIndex = VarNumLastInput EndIf SetFocus() Else SetFocusToNextTextBox() EndIf EndIf SetFocus() Shapes.HideShape(MessageShape) EndSub 'WichKeyWasUped '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine SetFocus 'Put the Input from the text box into the array for database data. 'hide the old objects and shows the actualy objects. '______________________________________________________________________ Sub SetFocus ArrData[VarOldInputIndex] = Controls.GetTextBoxText(ArrTextBox[VarOldInputIndex]) Controls.HideControl(ArrTextBox[VarOldInputIndex]) Shapes.SetText(ArrDataShape[VarOldInputIndex], ArrData[VarOldInputIndex]) Shapes.ShowShape(ArrDataShape[VarOldInputIndex]) Shapes.HideShape(ArrDataShape[VarInputIndex]) Controls.SetTextBoxText(ArrTextBox[VarInputIndex], ArrData[VarInputIndex]) Controls.ShowControl(ArrTextBox[VarInputIndex]) LDFocus.SetFocus(ArrTextBox[VarInputIndex]) EndSub 'SetFocus '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine SetFocutToNextTextBox 'Add 1 to the value of the variable VarInputIndex. Is this greater as the last text box number then set ' it to the first input number VarNumFirstName. 'At last start the subroutine SetFocus. '______________________________________________________________________ Sub SetFocusToNextTextBox VarInputIndex = VarInputIndex + 1 If VarInputIndex > VarNumLastInput Then VarInputIndex = VarNumFirstName EndIf SetFocus() EndSub 'SetFocusToNextTextBox '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine DataToDatabase 'For database data it is not possible to write a ' into a database. If there one ' replace it with two ' 'then it will be functions. 'Set the variable command with the sql-command to put the data FirstName and LastName into 'the database. 'At last show all data from the table Names in the liestView. '______________________________________________________________________ Sub DataToDatabase For i = VarNumFirstName To VarNumLastInput LDText.Replace(ArrData[i], "'", "''") EndFor command = "BEGIN TRANSACTION;" command = command + "INSERT INTO Names(FirstName,LastName)" command = command + "VALUES('"+ArrData[VarNumFirstName]+"','"+ArrData[VarNumLastName]+"');" command = command + "COMMIT;" LDDataBase.Command(database,command) LDDataBase.Query(database, "SELECT * FROM Names;", listView, "False") EndSub 'DataToDatabase '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯��¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine ClearObjects 'Set nothing in the database data shape, in the text box and in the variable for the database data. '______________________________________________________________________ Sub ClearObjects For i = VarNumFirstName to VarNumLastInput Shapes.SetText(ArrDataShape[i], "") Controls.SetTextBoxText(ArrTextBox[i], "") ArrData[i] = "" EndFor EndSub 'ClearObjects '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine KeyUp 'By event KeyUP set the event skip to T equal "True" '______________________________________________________________________ 'Event Subroutines Sub KeyUp VarKeyUP = T EndSub 'KeyUp '¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯��¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 'Subroutine ButtonClicked 'By event ButtonClicked set the event skip to T equal "True" '______________________________________________________________________ Sub ButtonClicked VarButtonClicked = T EndSub 'ButtonClicked Sub Initialisation '████████████████████████████ 'Initialisation '████████████████████████████ '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Variables '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Bolen T = "True" F = "False" 'Program controls VarEndOfProgram = F VarButtonClicked = F VarKeyUP = F VarNumInputIndex = 1 'Varible Input VarNumFirstName = 1 VarNumLastName = 2 VarNumLastInput = 2 VarNumTabText = 80 'Variable Button VarNumNextField = 1 VarNumSave = 2 VarNumExit = 3 VarLastButton = 3 '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Array '▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ 'Position on Desktop VarXPositionShape[VarNumFirstName] = 10 VarYPositionShape[VarNumFirstName] = 10 VarXPositionShape[VarNumLastName] = 10 VarYPositionShape[VarNumLastName] = 30 VarXPositionButton[VarNumNextField] = 10 VarXPositionButton[VarNumSave] = 110 VarXPositionButton[VarNumExit] = 210 'Data ArrData[VarNumFirstName] = "" ArrData[VarNumLastName] = "" 'Text ArrInputText[VarNumFirstName] = "First name" ArrInputText[VarNumLastName] = "Last name" ArrTextButton[VarNumNextField] = "Next" ArrTextButton[VarNumSave] = "Save" ArrTextButton[VarNumExit] = "Exit" 'Schapes, TextBoxes and the array with the Database data For i = VarNumFirstName To VarNumLastInput 'Set a new shape and fill it with the text to put out before the text boxes. ArrShape[i] = Shapes.AddText(ArrInputText[i]+":") 'Set the shape to her position Shapes.Move(ArrShape[i], VarXPositionShape[i], VarYPositionShape[i]) 'Set a new shape with database data and fill it with nothing. ArrDataShape[i] = Shapes.AddText("") 'Hide the database data shape Shapes.HideShape(ArrDataShape[i]) 'Set the shape to her position Shapes.Move(ArrDataShape[i], VarXPositionShape[i]+VarNumTabText, VarYPositionShape[i]) 'Set a new text box on his position. ArrTextBox[i] = Controls.AddTextBox(VarXPositionShape[i]+VarNumTabText-6, VarYPositionShape[i]-3) 'Hide the text box. Controls.HideControl(ArrTextBox[i]) EndFor MessageShape = Shapes.AddText("") Shapes.HideShape(MessageShape) Shapes.Move(MessageShape, 5, GraphicsWindow.Height - 30) 'Button For i = VarNumNextField To VarLastButton 'Set a new button on his position ArrButton[i] = Controls.AddButton(ArrTextButton[i], VarXPositionButton[i], GraphicsWindow.Height -65) EndFor 'Database 'Create a new list view listView = LDDataBase.AddListView(GraphicsWindow.Width,GraphicsWindow.Height-200) 'Set the list view on his position. Controls.Move(listView, 0, 100) 'Set a fullpath for a database datFile = Program.Directory+"\database.db" 'Is it a new database, so create it with a new table and table fields. Other wise open it. ' The following line could be harmful and has been automatically commented. ' If LDFile.Exists(datFile) = F Then database = LDDataBase.ConnectSQLite(datFile) command = "BEGIN TRANSACTION;" 'The databse table Names has the fields Id with the field definition PRIMARY KEY, FirstName and LastName both with the field defination TEXT. command = command + "CREATE TABLE Names(Id INTEGER PRIMARY KEY, FirstName TEXT, LastName TEXT);" command = command + "COMMIT;" LDDataBase.Command(database,command) Else database = LDDataBase.ConnectSQLite(datFile) EndIf EndSub 'Initialisation End>XDP525.sb< Start>XDQ106.sb< count = LDIOWarrior.Initialise() TextWindow.WriteLine(count+" Devices Found") If (count > 0) Then TextWindow.WriteLine("Name "+LDIOWarrior.GetName(1)) TextWindow.WriteLine("PID "+LDIOWarrior.GetPID(1)) TextWindow.WriteLine("Report Size "+LDIOWarrior.GetReportSize(1)) TextWindow.WriteLine("Special Report Size "+LDIOWarrior.GetSpecialReportSize(1)) TextWindow.WriteLine("SerialNumber "+LDIOWarrior.GetSerialNumber(1)) TextWindow.WriteLine("Version "+LDIOWarrior.GetVersion(1)) data = "" For i = 1 To LDIOWarrior.GetReportSize(1) data[i] = 0 EndFor For i = 0 To 255 data[2] = i result = LDIOWarrior.Write(1,0,data) Program.Delay(10) EndFor data = "" For i = 1 To LDIOWarrior.GetSpecialReportSize(1) data[i] = 0 EndFor data[1] = 4 data[2] = 1 LDIOWarrior.Write(1,1,data) data[1] = 5 data[2] = 3 data[3] = 40 data[4] = 1 data[5] = 15 LDIOWarrior.Write(1,1,data) data[1] = 5 data[2] = 1 data[3] = 15 LDIOWarrior.Write(1,1,data) data[1] = 5 data[2] = 1 data[3] = 6 LDIOWarrior.Write(1,1,data) txt = "Hello World" nChars = Text.GetLength(txt) data[1] = 5 nCurr = 0 While (nCurr < nChars) If (nCurr+6 > nChars) Then nNow = nChars-nCurr Else nNow = 6 EndIf data[2] = 128+nNow For i = 1 To nNow char = Text.GetSubText(txt,nCurr+i,1) data[2+i] = Text.GetCharacterCode(char) EndFor LDIOWarrior.Write(1,1,data) nCurr = nCurr+6 EndWhile EndIf LDIOWarrior.Detatch() End>XDQ106.sb< Start>XDR666.sb< GraphicsWindow.BackgroundColor="tan GraphicsWindow.PenWidth=0 GraphicsWindow.brushColor="blue LDEvents.MouseWheel=www GraphicsWindow.Width=500 GraphicsWindow.Height=230 ss=1 n6=6 For k=1 To 1000 Step .05 GraphicsWindow.Title=k+"; "+ldmath.FixDecimal( n6 2) ox=0 oy=0 i=1 For x=0 To 25 Step .1 y=0 y1=0 For n=1 To n6 y=y+(1/n)*Math.cos(n*x+k/n) y1=y1+(1/n)*Math.sin(n*x+k/n+Math.Remainder(n 2)*Math.pi/2) EndFor sh[i][1]=x*20 sh[i][2]=y*10+200 sh1[i][1]=x*20 sh1[i][2]=y1*10+150 i=i+1 EndFor sh[i][1]=x*20 sh[i][2]=230 sh1[i][1]=x*20 sh1[i][2]=230 i=i+1 sh[i][1]=0 sh[i][2]=230 sh1[i][1]=0 sh1[i][2]=230 Shapes.Remove(pp1) GraphicsWindow.BrushColor="teal pp1=LDShapes.AddPolygon(sh1) GraphicsWindow.BrushColor="tan Shapes.Remove(pp) pp=LDShapes.AddPolygon(sh) Program.Delay(30) EndFor Sub www n6=n6+LDEvents.LastMouseWheelDelta/3 'ldGraphicsWindow.Reposition(ss ss 0 ss*40 0) EndSub End>XDR666.sb< Start>XDR888.sb< GraphicsWindow.BackgroundColor ="teal GraphicsWindow.Width =1300 GraphicsWindow.Height=700 GraphicsWindow.Left=10 GraphicsWindow.Top=10 GraphicsWindow.BrushColor="white GraphicsWindow.Title="FontEffects tt= LDText.Split ("G H O S T B U S T E R S" " ") ff=ldtext.Split("Arial;Calibri;Corbel;Engravers MT;Jokerman;Maiandra GD;Rockwell" ";") fx=array.GetItemCount (ff) GraphicsWindow.FontName="Arial GraphicsWindow.FontSize =77 For x=1 To Array.GetItemCount (tt) tx[x]=Shapes.AddText (tt[x]) ldShapes.centre (tx[x] 50+x*70 50) LDShapes.AnimateOpacity (tx[x] 1500 0) LDShapes.AnimateZoom (tx[x] 750 0 1.5 1.5) LDShapes.AnimateRotation (tx[x] 2500 5) LDEffect.DropShadow (tx[x] "") Program.Delay (250) EndFor Timer.Interval=500 Timer.Tick=ttt Sub ttt h=Math.GetRandomNumber (12) c=math.GetRandomNumber (fx) LDShapes.Font (tx[h] ff[c] 150 "false" "false") ldShapes.centre (tx[h] 50+h*70 200) LDShapes.PenColour (tx[h] LDColours.HSLtoRGB (Math.GetRandomNumber (359) 1 .75)) EndSub End>XDR888.sb< Start>XDS207.sb< Initialize() While "True" Repeat = 1 TextWindow.Write("logo>") Input = TextWindow.Read() If Text.StartsWith(Text.ConvertToLowerCase(Input), "repeat") Then Repeat() EndIf If Text.GetLength(Input) <> 0 Then For i = 1 to Repeat _CharactersToParse = Input Parse() ExcuteLineOfInput() EndFor EndIf EndWhile Program.End() Sub Initialize GraphicsWindow.Width=800 GraphicsWindow.Height=600 GraphicsWindow.BackgroundColor = "LightGray" GraphicsWindow.Title = "Logo - by Joseph Fischetti" GraphicsWindow.Clear() GraphicsWindow.Show() GraphicsWindow.PenColor="black" Turtle.Speed = 10 Turtle.X = GraphicsWindow.Width/2 Turtle.Y = GraphicsWindow.Height/2 TextWindow.Show() EndSub Sub Repeat Repeat = 0 PosL = Text.GetIndexOf(Input, "[") PosR = Text.GetIndexOf(Input, "]") If PosL > 0 then If PosR > PosL then _CharactersToParse = Text.GetSubText(Input,7,PosL-7) Input = Text.GetSubText(Input,PosL+1,PosR-PosL-1) Parse() t = Stack.PopValue(_ParseStack) If Stack.GetCount(_ParseStack) = 0 then If t > 0 then Repeat = t EndIf Else For i = 1 To Stack.GetCount(_ParseStack) t = Stack.PopValue(_ParseStack) EndFor EndIf Endif EndIf If Repeat = 0 then TextWindow.WriteLine("ERROR") EndIf EndSub Sub ExcuteLineOfInput While Stack.GetCount(_ParseStack) > 0 _Arg1 = Text.ConvertToLowerCase(Stack.PopValue(_ParseStack)) If _Arg1 = "st" then Turtle.Show() ElseIf _Arg1 = "ht" then Turtle.Hide() ElseIf _Arg1 = "cs" then GraphicsWindow.Clear() Turtle.X = GraphicsWindow.Width/2 Turtle.Y = GraphicsWindow.Height/2 Turtle.Angle=0 ElseIf _Arg1 = "pu" then Turtle.PenUp() ElseIf _Arg1 = "pd" then Turtle.PenDown() ElseIf _Arg1 = "fd" then Get2Arg() If _Arg2<> "" then Turtle.Move(_Arg2) EndIf ElseIf _Arg1 = "bk" then Get2Arg() If _Arg2<> "" then Turtle.Move(-_Arg2) EndIf ElseIf _Arg1 = "rt" then Get2Arg() If _Arg2<> "" then Turtle.Turn(_Arg2) EndIf ElseIf _Arg1 = "lt" then Get2Arg() If _Arg2<> "" then Turtle.Turn(-_Arg2) EndIf Else TextWindow.WriteLine("ERROR") EndIf EndWhile EndSub Sub Get2Arg _Arg2 = "" If Stack.GetCount(_ParseStack)>0 Then _Arg2 = Stack.PopValue(_ParseStack) If _Arg2 > 0 then Else _Arg2 = "" TextWindow.WriteLine("ERROR") EndIf Else TextWindow.WriteLine("ERROR") EndIf EndSub Sub Parse _CharactersToStack = _CharactersToParse _CharacterStack = "Characters"" PushCharactersOnStack() _CharacterCount = Stack.GetCount(_CharacterStack) _ParseStack = "BackwardArguments" _Arg = "" For _i = 1 To _CharacterCount _Char = Stack.PopValue(_CharacterStack) If _Char <> " " Then _Arg = Text.Append(_Char, _Arg) ElseIf _Char = " " Then If Text.GetLength(_Arg)>0 then Stack.PushValue(_ParseStack,_Arg) _Arg = "" EndIf ElseIf _i = _CharacterCount Then If Text.GetLength(_Arg)>0 then Stack.PushValue(_ParseStack,_Arg) EndIf EndIf EndFor If _Char <> " " then Stack.PushValue(_ParseStack,_Arg) EndIf EndSub Sub PushCharactersOnStack _Len = Text.GetLength(_CharactersToStack) For _i = 1 to _Len Stack.PushValue(_CharacterStack, Text.GetSubText(_CharactersToStack,_i,1)) EndFor EndSub End>XDS207.sb< Start>XDS296.sb< 'carImage = ImageList.LoadImage(Program.Directory+"\car.png") LDGraphicsWindow.State = 2 carImage = ImageList.LoadImage("http://litdev.co.uk/game_images/car.png") MakeCar() MakeObstacles() LDPhysics.SetGravity(0,0) While ("True") start = Clock.ElapsedMilliseconds UpdateUser() LDPhysics.DoTimestep() UpdateInfo() delay = 20-(Clock.ElapsedMilliseconds-start) If (delay > 0) Then Program.Delay(delay) EndIf EndWhile Sub UpdateUser If (LDUtilities.KeyDown("Left")) Then LDPhysics.TurnTire(car,-400) EndIf If (LDUtilities.KeyDown("Right")) Then LDPhysics.TurnTire(car,400) EndIf If (LDUtilities.KeyDown("Up")) Then LDPhysics.MoveTire(car,250) EndIf If (LDUtilities.KeyDown("Down")) Then LDPhysics.MoveTire(car,-250) EndIf If (LDUtilities.KeyDown("Space")) Then LDPhysics.BrakeTire(car) EndIf EndSub Sub UpdateInfo If (Clock.ElapsedMilliseconds-startCrash > 1000) Then 'Keep crash info up for 1 sec info = LDPhysics.GetTireInformation(car) If (info["Crash"] > 0) Then GraphicsWindow.Title = "***** CRASH ("+info["Crash"]+") *****" startCrash = Clock.ElapsedMilliseconds ElseIf (info["Skid"] > properties["AntiSkid"]) Then GraphicsWindow.Title = "***** SKID *****" Else GraphicsWindow.Title = "" EndIf EndIf EndSub Sub MakeCar LDPhysics.LoadImagesAsCircles = "False" car = Shapes.AddImage(carImage) LDPhysics.AddMovingShape(car,0.8,0.05,1) LDPhysics.SetPosition(car,GraphicsWindow.Width/2,GraphicsWindow.Height/2,0) LDPhysics.SetTire(car) 'Reduced skid from default (3) and reduced drag resistance from default (0.05) properties = LDPhysics.GetTireProperties(car) properties["AntiSkid"] = 10 properties["Drag"] = 0.01 LDPhysics.SetTireProperties(car,properties) EndSUb Sub MakeObstacles LDPhysics.LoadImagesAsCircles = "True" For i = 1 To 5 cone = Shapes.AddEllipse(40,40) LDPhysics.AddMovingShape(cone,1,0,10) LDPhysics.SetPosition(cone,100+Math.GetRandomNumber(GraphicsWindow.Width-200),100+Math.GetRandomNumber(GraphicsWindow.Height-200),0) LDPhysics.SetDamping(cone,1,1) 'Sticky cones EndFor EndSub End>XDS296.sb< Start>XDS880.sb< 'Circle of squares - Placing shapes around a center point. -- Complements of codingCat aka Matthew L. Parets: No rights resevered as long as no money trades hands blckCnt = 100 'Number of blocks to create blckSiz = 40 radious = 275 'Size of the circle GraphicsWindow.BackgroundColor = "Black" GraphicsWindow.BrushColor = "White" GraphicsWindow.Width = 600 GraphicsWindow.Height = 600 GraphicsWindow.Show() angleStep = 360 / blckCnt ' Amount of space (angle count) between shapes centerx = GraphicsWindow.Width/2 - blckSiz/2 'Find the center of the circle - offset will need to be nudged with different sized shapes centery = GraphicsWindow.Height/2 - blckSiz/2 For i = 1 To blckCnt baseAngle = baseAngle + angleStep 'update the angle to match its position around the circle angle[i] = baseAngle 'Store the shapes angle GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor() blck[i] = Shapes.AddRectangle(blckSiz,blckSiz) 'Create the shape radAngle = Math.GetRadians(angle[i]) x = Math.Cos(radAngle) * radious + centerx y = Math.Sin(radAngle) * radious + centery Shapes.Move(blck[i],x,y) 'Place the shape on the circle EndFor End>XDS880.sb< Start>XDT681.sb< 'Constant do not change Constant() 'Handling all events EventHandling() 'Gui and s.o. Initialisation() While ("True") If (activated = 1) Then iWin = LDWindows.LastActivated setWin() activated = 0 EndIf If clicked = 1 Then For i = 1 To numWin If (Controls.LastClickedButton = hide[i]) Then iWin = id[i] setWin() GraphicsWindow.Hide() iWin = 0 setWin() ElseIf (Controls.LastClickedButton = show[i]) Then iWin = id[i] setWin() GraphicsWindow.Show() If clicked = 1 Then ReactionForItemSelect() EndIf EndIf EndFor clicked = 0 EndIf 'If a window was closed revert to main window If (closed = 1) Then iWin = 0 setWin() closed = 0 EndIf EndWhile Program.End() '---------------------------------------------------------------------------------------------------------------------------- Sub RoutineLD3DView EndSub Sub RoutineLDArray EndSub Sub RoutineLDBits EndSub Sub RoutineLDBlueTooth EndSub Sub RoutineLDCall EndSub Sub RoutineLDChart EndSub Sub RoutineLDClient EndSub Sub RoutineLDClipboard EndSub Sub RoutineLDColours EndSub Sub RoutineLDCommPort EndSub Sub RoutineLDController EndSub Sub RoutineLDControls EndSub Sub RoutineLDCursors EndSub Sub RoutineLDDataBase EndSub Sub RoutineLDDateTime EndSub Sub RoutineLDDebug EndSub Sub RoutineLDDialogs EndSub Sub RoutineLDDictionary EndSub Sub RoutineLDEffect EndSub Sub RoutineLDEmail EndSub Sub RoutineLDEncryption EndSub Sub RoutineLDEvents EndSub Sub RoutineLDFastArray EndSub Sub RoutineLDFastShapes EndSub Sub RoutineLDFigures EndSub Sub RoutineLDFile EndSub Sub RoutineLDFocus EndSub Sub RoutineLDftp EndSub Sub RoutineLDGraph EndSub Sub RoutineLDGraphicsWindow EndSub Sub RoutineLDHID EndSub Sub RoutineLDImage EndSub Sub RoutineLDInline EndSub Sub RoutineLDIOWarrior EndSub Sub RoutineLDList EndSub Sub RoutineLDLogic EndSub Sub RoutineLDMath EndSub Sub RoutineLDMathX EndSub Sub RoutineLDMatrix EndSub Sub RoutineLDMusic EndSub Sub RoutineLDNetwork EndSub Sub RoutineLDPhysics EndSub Sub RoutineLDProcess EndSub Sub RoutineLDQueue EndSub Sub RoutineLDRegex EndSub Sub RoutineLDResources EndSub Sub RoutineLDScrollBars EndSub Sub RoutineLDSearch EndSub Sub RoutineLDServer EndSub Sub RoutineLDSettings EndSub Sub RoutineLDShape TextWindow.WriteLine("RoutineLDShape") gradient[1] = "Red" gradient[2] = "Yellow" gradient[3] = "Blue" For i = 1 To 5 ellipse[i] = Shapes.AddEllipse(100,100) Shapes.Move(ellipse[i], 20+120*(i-1),20) EndFor LDShapes.BrushShape(ellipse[1],LDShapes.BrushGradient(gradient,"H")) LDShapes.BrushShape(ellipse[2],LDShapes.BrushGradient(gradient,"V")) LDShapes.BrushShape(ellipse[3],LDShapes.BrushGradient(gradient,"DD")) LDShapes.BrushShape(ellipse[4],LDShapes.BrushGradient(gradient,"DU")) LDShapes.BrushShape(ellipse[5],LDShapes.BrushGradient(gradient,"")) gradient[1] = "Blue" gradient[2] = "White" gradient[3] = "YellowGreen" brush = LDShapes.BrushGradient(gradient,"V") LDGraphicsWindow.BackgroundBrushGradient(brush) brush = LDShapes.BrushGradient(gradient,"H") LDShapes.BrushRectangle(brush,50,300,100,100) LDShapes.BrushEllipse(brush,200,300,100,100) LDShapes.BrushRoundedRectangle(brush,350,300,100,100,20) 'A star For i = 1 To 10 Step 2 angle = (i-0.5)*2*Math.Pi/10 points[i][1] = 550-70*Math.Cos(angle) points[i][2] = 350-70*Math.Sin(angle) angle = (i+0.5)*2*Math.Pi/10 points[i+1][1] = 550-30*Math.Cos(angle) points[i+1][2] = 350-30*Math.Sin(angle) EndFor LDShapes.BrushPolygon(brush,points) EndSub Sub RoutineLDShell EndSub Sub RoutineLDSort EndSub Sub RoutineLDSound EndSub Sub RoutineLDSpeech EndSub Sub RoutineLDStatistics EndSub Sub RoutineLDStopwatch EndSub Sub RoutineLDText EndSub Sub RoutineLDTextWindow EndSub Sub RoutineLDTimer EndSub Sub RoutineLDTranslate EndSub Sub RoutineLDUnits EndSub Sub RoutineLDUtilities EndSub Sub RoutineLDWaveForm EndSub Sub RoutineLDWebCam EndSub Sub RoutineLDWindows EndSub Sub RoutineLDxml EndSub Sub RoutineLDZip EndSub Sub ReactionForItemSelect if clicked = 1 Then If iWin = 1 Then RoutineLD3DView() ElseIf iWin = 2 Then RoutineLDArray() ElseIf iWin = 3 Then RoutineLDBits() ElseIf iWin = 4 Then RoutineLDBlueTooth() ElseIf iWin = 5 Then RoutineLDCall() ElseIf iWin = 6 Then RoutineLDChart() ElseIf iWin = 7 Then RoutineLDClient() ElseIf iWin = 8 Then RoutineLDClipboard() ElseIf iWin = 9 Then RoutineLDColours() ElseIf iWin = 10 Then RoutineLDCommPort() ElseIf iWin = 11 Then RoutineLDController() ElseIf iWin = 12 Then RoutineLDControls() ElseIf iWin = 13 Then RoutineLDCursors() ElseIf iWin = 14 Then RoutineLDDataBase() ElseIf iWin = 15 Then RoutineLDDateTime() ElseIf iWin = 16 Then RoutineLDDebug() ElseIf iWin = 17 Then RoutineLDDialogs() ElseIf iWin = 18 Then RoutineLDDictionary() ElseIf iWin = 19 Then RoutineLDEffect() ElseIf iWin = 20 Then RoutineLDEmail() ElseIf iWin = 21 Then RoutineLDEncryption() ElseIf iWin = 22 Then RoutineLDEvents() ElseIf iWin = 23 Then RoutineLDFastArray() ElseIf iWin = 24 Then RoutineLDFastShapes() ElseIf iWin = 25 Then RoutineLDFigures() ElseIf iWin = 26 Then RoutineLDFile() ElseIf iWin = 27 Then RoutineLDFocus() ElseIf iWin = 28 Then RoutineLDftp() ElseIf iWin = 29 Then RoutineLDGraph() ElseIf iWin = 30 Then RoutineLDGraphicsWindow() ElseIf iWin = 31 Then RoutineLDHID() ElseIf iWin = 32 Then RoutineLDImage() ElseIf iWin = 33 Then RoutineLDInline() ElseIf iWin = 34 Then RoutineLDIOWarrior() ElseIf iWin = 35 Then RoutineLDList() ElseIf iWin = 36 Then RoutineLDLogic() ElseIf iWin = 37 Then RoutineLDMath() ElseIf iWin = 38 Then RoutineLDMathX() ElseIf iWin = 39 Then RoutineLDMatrix() ElseIf iWin = 40 Then RoutineLDMusic() ElseIf iWin = 41 Then RoutineLDNetwork() ElseIf iWin = 42 Then RoutineLDPhysics() ElseIf iWin = 43 Then RoutineLDProcess() ElseIf iWin = 44 Then RoutineLDQueue() ElseIf iWin = 45 Then RoutineLDRegex() ElseIf iWin = 46 Then RoutineLDResources() ElseIf iWin = 47 Then RoutineLDScrollBars() ElseIf iWin = 48 Then RoutineLDSearch() ElseIf iWin = 49 Then RoutineLDServer() ElseIf iWin = 50 Then RoutineLDSettings() ElseIf iWin = 51 Then RoutineLDShape() ElseIf iWin = 52 Then RoutineLDShell() ElseIf iWin = 53 Then RoutineLDSort() ElseIf iWin = 54 Then RoutineLDSound() ElseIf iWin = 55 Then RoutineLDSpeech() ElseIf iWin = 56 Then RoutineLDStatistics() ElseIf iWin = 57 Then RoutineLDStopwatch() ElseIf iWin = 58 Then RoutineLDText() ElseIf iWin = 59 Then RoutineLDTextWindow() ElseIf iWin = 60 Then RoutineLDTimer() ElseIf iWin = 61 Then RoutineLDTranslate() ElseIf iWin = 62 Then RoutineLDUnits() ElseIf iWin = 63 Then RoutineLDUtilities() ElseIf iWin = 64 Then RoutineLDWaveForm() ElseIf iWin = 65 Then RoutineLDWebCam() ElseIf iWin = 66 Then RoutineLDWindows() ElseIf iWin = 67 Then RoutineLDxml() ElseIf iWin = 68 Then RoutineLDZip() EndIf EndIf EndSub 'ReactionForItemSelect Sub Initialisation numWin = Array.GetItemCount(C) gww = 300 gwh = 700 GraphicsWindow.BackgroundColor = "White" GraphicsWindow.BrushColor = "SteelBlue" GraphicsWindow.Top = 5 GraphicsWindow.Left = 5 GraphicsWindow.Width = gww GraphicsWindow.Height = gwh LDScrollBars.Add(gww-100, 10+30*(numWin)) LDGraphicsWindow.Height = gwh 'Create the main window with buttons to show other windows For i = 1 To numWin show[i] = Controls.AddButton(C[i],10,10+30*(i-1)) EndFor 'Create some windows and close button and hide initially For i = 1 To numWin id[i] = LDWindows.Create() GraphicsWindow.Title = C[i] GraphicsWindow.BackgroundColor = "White" GraphicsWindow.BrushColor = "DarkGray" hide[i] = Controls.AddButton("Close",5,5) GraphicsWindow.MouseDown = OnMouseDown LDGraphicsWindow.ExitOnClose = "False" LDGraphicsWindow.Closing = OnClosing EndFor For i = 1 To numWin iWin = id[i] setWin() GraphicsWindow.Hide() EndFor 'Set the main window as active iWin = 0 LDWindows.CurrentID = iWin LDGraphicsWindow.Closing = OnClosing EndSub 'Initialisation Sub EventHandling LDGraphicsWindow.Closing = OnClosing LDWindows.Activated = OnActivated Controls.ButtonClicked = OnButtonClicked EndSub 'EventHandling Sub Constant T = "True" F = "False" C[1] = " 1 LD3DView" C[2] = " 2 LDArray" C[3] = " 3 LDBits" C[4] = " 4 LDBlueTooth" C[5] = " 5 LDCall" C[6] = " 6 LDChart" C[7] = " 7 LDClient" C[8] = " 8 LDClipboard" C[9] = " 9 LDColours" C[10] = "10 LDCommPort" C[11] = "11 LDController" C[12] = "12 LDControls" C[13] = "13 LDCursors" C[14] = "14 LDDataBase" C[15] = "15 LDDateTime" C[16] = "16 LDDebug" C[17] = "17 LDDialogs" C[18] = "18 LDDictionary" C[19] = "19 LDEffect" C[20] = "20 LDEmail" C[21] = "21 LDEncryption" C[22] = "22 LDEvents" C[23] = "23 LDFastArray" C[24] = "24 LDFastShapes" C[25] = "25 LDFigures" C[26] = "26 LDFile" C[27] = "27 LDFocus" C[28] = "28 LDftp" C[29] = "29 LDGraph" C[30] = "30 LDGraphicsWindow" C[31] = "31 LDHID" C[32] = "32 LDImage" C[33] = "33 LDInline" C[34] = "34 LDIOWarrior" C[35] = "35 LDList" C[36] = "36 LDLogic" C[37] = "37 LDMath" C[38] = "38 LDMathX" C[39] = "39 LDMatrix" C[40] = "40 LDMusic" C[41] = "41 LDNetwork" C[42] = "42 LDPhysics" C[43] = "43 LDProcess" C[44] = "44 LDQueue" C[45] = "45 LDRegex" C[46] = "46 LDResources" C[47] = "47 LDScrollBars" C[48] = "48 LDSearch" C[49] = "49 LDServer" C[50] = "50 LDSettings" C[51] = "51 LDShapes" C[52] = "52 LDShell" C[53] = "53 LDSort" C[54] = "54 LDSound" C[55] = "55 LDSpeech" C[56] = "56 LDStatistics" C[57] = "57 LDStopwatch" C[58] = "58 LDText" C[59] = "59 LDTextWindow" C[60] = "60 LDTimer" C[61] = "61 LDTranslate" C[62] = "62 LDUnits" C[63] = "63 LDUtilities" C[64] = "64 LDWaveForm" C[65] = "65 LDWebCam" C[66] = "66 LDWindows" C[67] = "67 LDxml" C[68] = "68 LDZip" LDGraphicsWindow.ExitOnClose = F EndSub 'Constants 'When a window gets focus switch to it Sub OnActivated activated = 1 EndSub 'Change background colour on current window (not main window since no event registered for this window) Sub OnMouseDown xM = GraphicsWindow.MouseX yM = GraphicsWindow.MouseY gw = GraphicsWindow.Width gh = GraphicsWindow.Height EndSub 'Handle X pressed Sub OnClosing If (iWin = 0) Then result = LDDialogs.Confirm("Closing this window will end the session?","Warning") If (result = "Yes") Then Program.End() Else LDGraphicsWindow.CancelClose = "True" EndIf Else result = LDDialogs.Confirm("Do you really want to close this window?","Warning") If (result = "Yes") Then LDGraphicsWindow.CancelClose = "False" closed = 1 Else LDGraphicsWindow.CancelClose = "True" EndIf EndIf EndSub 'Show and hide windows on button clicks Sub OnButtonClicked clicked = 1 EndSub 'Set the window and make it topmost when we change a window. Sub setWin LDWindows.CurrentID = iWin LDWindows.Active = iWin EndSub End>XDT681.sb< Start>XDW587-0.sb< 'Set Image image = ImageList.LoadImage("http://public.bay.livefilestore.com/y1p6zsS1F5jFqH_wxDAaa4RE5_WsCx_HZ43f1S0Ec98XsEZsGlEO8t0Qo1gj5RNpaNJ9RWBSpelg-sGGgh5kAb24g/bee_icon3.png") sprite = Shapes.AddImage(image) imageWidth = ImageList.GetWidthOfImage(image) imageHeight = ImageList.GetHeightOfImage(image) 'Corners GraphicsWindow.BrushColor = "Red" For i = 1 To 4 Shapes.Remove(corner[i]) corner[i] = Shapes.AddEllipse(8,8) EndFor 'Set bounding box boundingBox = Shapes.AddRectangle(imageWidth,imageHeight) Shapes.SetOpacity(boundingBox,50) 'Start keybourd events GraphicsWindow.KeyDown = OnKeyDown GraphicsWindow.KeyUp = OnKeyUp 'Initialise varaibles xPos = 100 yPos = 100 scale = 1 rotate = 0 key = "" While ("True") 'Get mouse position xPos = GraphicsWindow.MouseX yPos = GraphicsWindow.MouseY 'Rotate and scale If (key = "Right") Then rotate = rotate+3 ElseIf (key = "Left") Then rotate = rotate-3 ElseIf (key = "Up") Then scale = scale+0.1 ElseIf (key = "Down") Then scale = scale-0.1 EndIf 'Update image Shapes.Zoom(sprite,scale,scale) Shapes.Rotate(sprite,rotate) Shapes.Move(sprite,xPos-imageWidth/2,yPos-imageHeight/2) 'Update bounding box with a shape Shapes.Zoom(boundingBox,scale,scale) Shapes.Rotate(boundingBox,rotate) Shapes.Move(boundingBox,xPos-imageWidth/2,yPos-imageHeight/2) 'Bounding box coordinates - only if you really want them radius = Math.SquareRoot(imageWidth*imageWidth+imageHeight*imageHeight)/2*scale coordX[1] = xPos - radius*Math.Cos(Math.GetRadians(rotate-135)) coordY[1] = yPos - radius*Math.Sin(Math.GetRadians(rotate-135)) coordX[2] = xPos - radius*Math.Cos(Math.GetRadians(rotate-45)) coordY[2] = yPos - radius*Math.Sin(Math.GetRadians(rotate-45)) coordX[3] = xPos - radius*Math.Cos(Math.GetRadians(rotate+45)) coordY[3] = yPos - radius*Math.Sin(Math.GetRadians(rotate+45)) coordX[4] = xPos - radius*Math.Cos(Math.GetRadians(rotate+135)) coordY[4] = yPos - radius*Math.Sin(Math.GetRadians(rotate+135)) For i = 1 To 4 Shapes.Move(corner[i],coordX[i]-4,coordY[i]-4) EndFor 'Delay for smooth running Program.Delay(100) EndWhile Sub OnKeyDown key = GraphicsWindow.LastKey EndSub Sub OnKeyUp key = "" EndSub End>XDW587-0.sb< Start>XFF651.sb< ' Dart Board ' Version 0.1 ' Copyright © 2018 Nonki Takahashi. The MIT Licnese. ' Last update 2018-03-12 GraphicsWindow.Title = "Dart Board" Init() r = 150 GraphicsWindow.BrushColor = "Black" GraphicsWindow.FillEllipse(x1 - r, y1 - r, 2 * r, 2 * r) GraphicsWindow.PenWidth = 8 GraphicsWindow.PenColor = "#CC0000" r = 124 GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 64 GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 128 GraphicsWindow.BrushColor = "LemonChiffon" GraphicsWindow.PenWidth = 8 GraphicsWindow.PenColor = "#006600" param = "x=" + x1 + ";y=" + y1 + ";da=6;" For a = 9 To 351 Step 18 n = n + 1 _a = Math.GetRadians(a) x2 = x1 + r * Math.Sin(_a) y2 = y1 - r * Math.Cos(_a) If Math.Remainder(n, 2) = 0 Then GraphicsWindow.FillTriangle(x1, y1, x2, y2, x3, y3) param["a1"] = a - 108 param["a2"] = a - 90 param["r"] = 124 GW_DrawArc() param["r"] = 64 GW_DrawArc() EndIf x3 = x2 y3 = y2 EndFor GraphicsWindow.PenColor = "Gray" GraphicsWindow.PenWidth = 2 For a = 9 To 351 Step 18 _a = Math.GetRadians(a) x2 = x1 + r * Math.Sin(_a) y2 = y1 - r * Math.Cos(_a) GraphicsWindow.DrawLine(x1, y1, x2, y2) EndFor GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 120 GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 68 GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 60 GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 10 GraphicsWindow.BrushColor = "#006600" GraphicsWindow.FillEllipse(x1 - r, y1 - r, 2 * r, 2 * r) GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) r = 5 GraphicsWindow.BrushColor = "#CC0000" GraphicsWindow.FillEllipse(x1 - r, y1 - r, 2 * r, 2 * r) GraphicsWindow.DrawEllipse(x1 - r, y1 - r, 2 * r, 2 * r) GraphicsWindow.BrushColor = "Gray" GraphicsWindow.FontName = "Trebuchet MS" fs = 16 GraphicsWindow.FontSize = fs score = "1=20;2=1;3=18;4=4;5=13;6=6;7=10;8=15;9=2;10=17;" score = score + "11=3;12=19;13=7;14=16;15=8;16=11;17=14;18=9;19=12;20=5;" r = 140 i = 1 For a = 0 To 342 Step 18 s = score[i] dx = Text.GetLength(s) / 2 * fs * 0.6 _a = Math.GetRadians(a) x = x1 + r * Math.Sin(_a) - dx y = y1 - r * Math.Cos(_a) - fs / 2 GraphicsWindow.DrawText(x, y, s) i = i + 1 EndFor Sub Init gw = 598 gh = 428 GraphicsWindow.Width = gw GraphicsWindow.Height = gh x1 = gw / 2 y1 = gh / 2 EndSub Sub GW_DrawArc ' GraphicsWindow | Draw arc ' param["x"] - center x coordinate [px] ' param["y"] - center y coordinate [px] ' param["r"] - radius [px] ' param["a1"] - start angle [°] ' param["a2"] - end angle [°] ' param["da"] - delta (step) angle [°] ' param["ct"] - cap type ("Round" for round, otherwise for flat) Stack.PushValue("local", local) Stack.PushValue("local", a) local["pw"] = GraphicsWindow.PenWidth local["bc"] = GraphicsWindow.BrushColor GraphicsWindow.BrushColor = GraphicsWindow.PenColor For a = param["a1"] To param["a2"] Step param["da"] local["rad"] = Math.GetRadians(a) local["x2"] = param["x"] + param["r"] * Math.Cos(local["rad"]) local["y2"] = param["y"] + param["r"] * Math.Sin(local["rad"]) If param["a1"] <> a Then GraphicsWindow.DrawLine(local["x1"], local["y1"], local["x2"], local["y2"]) EndIf If ((param["a1"] <> a) And (a <> param["a2"])) Or Text.ConvertToLowerCase(param["ct"]) = "round" Then GraphicsWindow.PenWidth = 0 GraphicsWindow.FillEllipse(local["x2"] - local["pw"] / 2, local["y2"] - local["pw"] / 2, local["pw"], local["pw"]) GraphicsWindow.PenWidth = local["pw"] EndIf local["x1"] = local["x2"] local["y1"] = local["y2"] EndFor GraphicsWindow.BrushColor = local["bc"] a = Stack.PopValue("local") local = Stack.PopValue("local") EndSub End>XFF651.sb< Start>XFG526.sb< uncompressedFile = Program.Directory+"/compress_this.txt" compressedFile = Program.Directory+"/compressed.txt" ' The following line could be harmful and has been automatically commented. ' uncompressed = File.ReadContents(uncompressedFile) compress() ' The following line could be harmful and has been automatically commented. ' File.WriteContents(compressedFile,compressed) uncompress() TextWindow.WriteLine(uncompressed) Sub compress 'A working copy txt = uncompressed nkeys = 0 'Number of keys (repeated strings) keys = "" 'Replace any repeated stings with a key and record the keys in an array pattern = "