none
Challenge of the Month - April 2017

    General discussion

  • These challenges are intended for people who are learning to program for the first time or for those returning to programming who want to start using Small Basic.  Some will be easy, some will be hard - but they will all make you think, and more importantly be GREAT FUN!

    Please post your solutions / partial solutions / questions / feedback etc. into this thread that will remain 'sticky' for the month.  The only rule is that your solution must use standard Small Basic methods (no extensions).

    It would be good if people could post their problems with these challenges so that a discussion can start so that everyone can learn from each other.

    We may extend these challenges over into a second month if solutions and questions are still coming in.

    Text Challenge

    • Use the TextWindow to write a program to list all files in user input folder
    • List the files sorted by name alphabetically, or by file type

    Turtle Challenge

    • Write a Turtle program to move the turtle in a figure of 8

    Physics Challenge

    • Whire a program with some weighing scales to weigh shapes that can be dropped on the scales
    • Perhaps try a sea-saw type scales to balance weights added to each side


    Weighing Scales

    Maths Challenge

    • Write a program to calculate the prime factors of a number


    Graphisc Challenge

    • Write a program to show an animated (rotating) windmill

    lytham windmill museum more museum indiana lytham windmill windmill ...

    Do you have an idea for a future challenge? Please post it here!

    Thursday, March 30, 2017 5:52 PM
    Moderator

All replies

  • hello this is Dumty ID BLD217 draw and Animate Humty

    ' mahreen miangul
    ' Dumty Animation ApRil 2017
    GraphicsWindow.Width = 1288
    GraphicsWindow.Height = 666
    GraphicsWindow.BackgroundColor = "skyblue"

     ' Dumty
    '
    scale = 2.8
    x0 = 150 * scale
    y0 = 50 * scale
    GraphicsWindow.PenWidth = 0
    GraphicsWindow.PenWidth = 1
    ' Ears
    GraphicsWindow.BrushColor = "Bisque"
    oEarLeft= Shapes.AddEllipse(20 * scale, 25 * scale)
    Shapes.Move(oEarLeft, x0, y0)
    Shapes.Rotate(oEarLeft, -45)
    oEarRight = Shapes.AddEllipse(20 * scale, 25 * scale)
    Shapes.Move(oEarRight, x0 + 60 * scale, y0 + 22)
    Shapes.Rotate(oEarRight, 45)
    ' Chest
    GraphicsWindow.BrushColor = "darkslategray"
    oChest = Shapes.AddEllipse(40 * scale, 25 * scale)
    Shapes.Move(oChest, x0 + 45, y0 + 68 * scale)
    ' Body
    GraphicsWindow.BrushColor = "Bisque"
    oBody = Shapes.AddEllipse(60 * scale, 45 * scale)
    Shapes.Move(oBody, x0 + 6 * scale, y0 + 80 * scale)
    ' Legs
    GraphicsWindow.BrushColor = "darkslategray"
    oLegLeft = Shapes.AddEllipse(30 * scale, 15 * scale)
    Shapes.Move(oLegLeft, x0 + 5 * scale, y0 + 128 * scale)
    Shapes.Rotate(oLegLeft, 120)
    oLegRight = Shapes.AddEllipse(30 * scale, 15 * scale)
    Shapes.Move(oLegRight, x0 + 30 * scale, y0 + 128 * scale)
    Shapes.Rotate(oLegRight, -80)
    ' Feets
    GraphicsWindow.BrushColor = "darkslategray"
    oFootLeft = Shapes.AddEllipse(25 * scale, 15 * scale)
    Shapes.Move(oFootLeft, x0 - 10 * scale, y0 + 140.5 * scale)
    Shapes.Rotate(oFootLeft, 5)
    oFootRight = Shapes.AddEllipse(25 * scale, 15 * scale)
    Shapes.Move(oFootRight, x0 + 22 * scale, y0 + 145.5 * scale)
    Shapes.Rotate(oFootRight, -5)
    ' Sholders
    GraphicsWindow.BrushColor = "darkslategray"
    oSholderLeft = Shapes.AddEllipse(40 * scale, 15 * scale)
    Shapes.Move(oSholderLeft, x0 - 10 * scale, y0 + 76 * scale)
    Shapes.Rotate(oSholderLeft, -60)
    oSholderRight = Shapes.AddEllipse(45 * scale, 15 * scale)
    Shapes.Move(oSholderRight, x0 + 40 * scale, y0 + 76 * scale)
    Shapes.Rotate(oSholderRight, 60)
    ' Arms
    GraphicsWindow.BrushColor = "darkslategray"
    oArmLeft = Shapes.AddEllipse(20 * scale, 10 * scale)
    Shapes.Move(oArmLeft, x0 - 15 * scale, y0 + 94.5 * scale)
    Shapes.Rotate(oArmLeft, 20)
    oArmRight = Shapes.AddEllipse(20 * scale, 10 * scale)
    Shapes.Move(oArmRight, x0 + 68 * scale, y0 + 94.5 * scale)
    Shapes.Rotate(oArmRight, -20)
    ' Face
    GraphicsWindow.BrushColor = "bisque"
    oFace = Shapes.AddEllipse(75 * scale, 75 * scale)
    Shapes.Move(oFace, x0 + scale, y0)
    ' Nose
    GraphicsWindow.BrushColor = "darkslategray"
    GraphicsWindow.pencolor = "red"
    GraphicsWindow.penwidth = 4
    oNose = Shapes.AddTriangle(0, 0, 8 * scale, 0, 4 * scale, 3 * scale)
    Shapes.Move(oNose, x0 + 16 * scale, y0 + 22 * scale)
    ' Eyes
    GraphicsWindow.BrushColor = "darkslategray"
    GraphicsWindow.PenColor = "red"'"DimGray"
    GraphicsWindow.PenWidth = 2
    oEyeLeft = Shapes.AddEllipse(11 * scale, 7 * scale)
    Shapes.Move(oEyeLeft, x0 + 7 * scale, y0 + 12 * scale)
    Shapes.Rotate(oEyeLeft, -60)
    oEyeRight = Shapes.AddEllipse(11 * scale, 7 * scale)
    Shapes.Move(oEyeRight, x0 + 22 * scale, y0 + 12 * scale)
    Shapes.Rotate(oEyeRight, 60)
    GraphicsWindow.PenWidth = 2
    GraphicsWindow.BrushColor = "snow"
    GraphicsWindow.PenColor = "red"'"DimGray"
    GraphicsWindow.PenWidth = 2
    oEyeLeft2 = Shapes.AddEllipse(4 * scale, 4 * scale)
    Shapes.Move(oEyeLeft2, x0 + 12 * scale, y0 + 11 * scale)
    oEyeRight2 = Shapes.AddEllipse(4 * scale, 4 * scale)
    Shapes.Move(oEyeRight2, x0 + 24 * scale, y0 + 11 * scale)
    ' Mouth
    GraphicsWindow.PenColor = "darkslategray"
    GraphicsWindow.PenWidth = 2
    oMouthLeft = Shapes.AddLine(0, 1.5 * scale, 4 * scale, 0)
    Shapes.Move(oMouthLeft, x0 + 16 * scale, y0 + 26.5 * scale)
    oMouthRight = Shapes.AddLine(0, 0, 4 * scale, 1.5 * scale)
    Shapes.Move(oMouthRight, x0 + 20 * scale, y0 + 26.5 * scale)

    ' Blink start
    While "True"
      Program.Delay(2900)
      Shapes.HideShape(oEyeLeft2)
      Shapes.HideShape(oEyeRight2)
      Program.Delay(100)
      Shapes.ShowShape(oEyeLeft2)
      Shapes.ShowShape(oEyeRight2)
    EndWhile

           from mussa-maina with love        
    • Edited by mussamaina Friday, March 31, 2017 6:15 AM text mistake
    Friday, March 31, 2017 6:14 AM
  • Graphisc Challenge

    • Write a program to show an animated (rotating) windmill   QPB316   

    Friday, March 31, 2017 3:24 PM
    Answerer
  • 8 shape turte: BXZ895
    Friday, March 31, 2017 9:03 PM
  • nice work nao, but a design correction about windmill. the mill cannot spin by this frame and wind only. it's the off state of mill. when it's needed to spin, bags are put on this frame, like socks on foot. then the wind can rotate the mill. when the winds are too strong, bags are removed to protect the mill, and the wind blows through the frame but cannot rotate it.

    so i added sock in characteristic dutch orange colors, and some flowers too.nice to note that u added river, as it's the drain water from windmills, as they are used in holland to pump water to sea to make more land. updated id: QPB316-0

    • Edited by Tryhest Saturday, April 01, 2017 3:35 AM
    Saturday, April 01, 2017 2:45 AM
  • Tryhest  nice!

    I reffered La Mancha's windmills .

    This is new version. 4 ducks move around.  QPB316-2

    * added bags.

     


    • Edited by NaochanONEditor Saturday, April 01, 2017 6:03 AM change code,photo
    Saturday, April 01, 2017 5:29 AM
    Answerer
  • In Dutch the "bags" are called sails (zeilen)

    Jan [ WhTurner ] The Netherlands

    Sunday, April 02, 2017 10:41 AM
    Answerer
  • hello when I move the sprite the cannon does not work now the cannon is moving and firing but the sprite has stoped working i am not that bad what am i doing wrong
    GraphicsWindow.BackgroundColor="skyblue"

    MakeSprite()
    dx=-5
    dy=0
    by=2  '  ball speed Y-direction

    cannon1_x = 644
    cannon1_y = 566
    sprite1_x = 0
    sprite1_y = 20
    GraphicsWindow.KeyDown = moveCannon
    GraphicsWindow.Width = "1288"
    GraphicsWindow.Height = "666"
    GraphicsWindow.Show()
    cannon = Shapes.AddRectangle(50,100)
    Shapes.Move(cannon, cannon1_x, cannon1_y)
    GraphicsWindow.BrushColor="Black"
    Ball=Shapes.AddEllipse(40,40)
    Shapes.Move(Ball,cannon1_x+5,cannon1_y+30)
    Shapes.HideShape(Ball)
    Timer.interval=500
    Timer.tick=OnTimerTick
    Flag="True"
    movesprite()
    Sub Movesprite
    While "True"
      For movesprite = 1 To GraphicsWindow.Width-50
        Program.Delay(15)
      EndFor  
     
      For movesprite = GraphicsWindow.Width-50 To 1 Step -1
        Program.Delay(15)
      EndFor
    EndWhile
    EndSub
     
    Sub OnTimerTick
      Timer.Pause()
      If movesprite > (GraphicsWindow.width/2)-15 And movesprite < (GraphicsWindow.Width/2)+15 then
      movesprite() 'rests balloon back to beginning
      EndIf
        Shapes.HideShape(Ball)
        Shapes.Move(Ball,cannon1_x+5,cannon1_y+30)
      EndSub
    GraphicsWindow.KeyDown = OnKeyDown
    While "True" '<------------
    TrainMove="True" '<------------
    While TrainMove '<------------
      For i=1 To 13
        Shapes.Move(ell[i],Shapes.GetLeft(ell[i])+ddx,shapes.GetTop(ell[i])+ddy)
        Shapes.Move(rec[i],Shapes.GetLeft(rec[i])+ddx,shapes.GetTop(rec[i])+ddy)
        Shapes.Move(Tri[i],Shapes.GetLeft(Tri[i])+ddx,shapes.GetTop(Tri[i])+ddy)
      EndFor
      If Shapes.GetLeft(ell[1])<-200 Then
        moveright()
      EndIf
      If Shapes.GetLeft(ell[1])>1200 then    'WhT
        ddx=-ddx                             'WhT
      EndIf                                  'WhT
      If shoot Then '<------------   
        TX= Shapes.GetLeft(Tri[4])+230 '<------------
        TY= Shapes.Gettop(Tri[4])+385 '<------------
        If bY<-100 then '<------------
          shoot="False"'<------------
        EndIf  '<-------
          Hit="True" '<------------
          TrainMove="False" '<------------
        EndIf  '<------------
      Program.Delay(20)
      endwhile
      Program.Delay(1500) '<------------
    endwhile
    Sub moveright
      el1y=shapes.GetTop(rec[9]) '<--------- 
      ddy= Math.GetRandomNumber(Math.Abs(300-el1y))-el1y
      ddx=-ddx                                'WhT
      For i=1 To 13
        Shapes.Move(ell[i],Shapes.GetLeft(ell[i])+ddx,shapes.GetTop(ell[i])+ddy)  'WhT   changed 1200 to ddx
        Shapes.Move(rec[i],Shapes.GetLeft(rec[i])+ddx,shapes.GetTop(rec[i])+ddy)  'WhT  changed 1200 to ddx
        Shapes.Move(Tri[i],Shapes.GetLeft(Tri[i])+ddx,shapes.GetTop(Tri[i])+ddy)  'haroon rashid  changed 1200 to ddx
      EndFor
      ddy=0
    EndSub
    Sub MakeSprite
      ' 7 Rectangle
      GraphicsWindow.BrushColor="green"
      rec[1] =  Shapes.AddRectangle(50,8)  '<-- 
      Shapes.Move(rec[1], 440,115)
      rec[2] =  Shapes.AddRectangle(50,8)  '<-- 
      Shapes.Move(rec[2], 440,140)
      GraphicsWindow.brushcolor = "sienna"
      rec[3] =  Shapes.AddRectangle(60,6)  '<-- 
      Shapes.Move(rec[3], 355,120)
      rec[4] =  Shapes.AddRectangle(60,6)  '<-- 
      Shapes.Move(rec[4], 355,138)
      GraphicsWindow.brushcolor = "darkgoldenrod"
      rec[5] =  Shapes.AddRectangle(100,22)  '<-- 
      Shapes.Move(rec[5], 400,120)
      ' 7 Ellipses
      GraphicsWindow.BrushColor="bisque"
      ell[1] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[1], 520,90)
      ell[2] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[2], 520,150)
       GraphicsWindow.BrushColor="purple"
      ell[3] =  Shapes.AddEllipse(70,70)
      Shapes.Move(ell[3], 500,95)
      GraphicsWindow.BrushColor="sienna"
      ell[4] =  Shapes.AddEllipse(30,10)
      Shapes.Move(ell[4], 520,120)
      GraphicsWindow.BrushColor="pink"
      ell[5] =  Shapes.AddEllipse(10,30)
      Shapes.Move(ell[5], 510,115)
      GraphicsWindow.BrushColor="cyan"
      ell[6] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[6], 530,102)
      ell[7] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[7], 530,128)
      ' 1 triangles
      GraphicsWindow.BrushColor="gold"
      tri[1] =  Shapes.Addtriangle(566,100,611,130,566,160)
      Shapes.Move(tri[1], 0,0)
     
      chrome=GraphicsWindow.getcolorfromrgb(215,219,213)
        GraphicsWindow.brushcolor=chrome
      tri[3] =  Shapes.Addtriangle(585,405,585,420,450,390)
      Shapes.Move(tri[3], 0,0)
        GraphicsWindow.BrushColor="#000000"
      tri[4] =  Shapes.Addtriangle(350,445,230,445,350,385)
      Shapes.Move(tri[4], 0,0)
     
      ' piston cylinder
     
      GraphicsWindow.brushcolor=chrome
      rec[12] =  Shapes.Addrectangle(150,20)
      Shapes.Move(rec[12], 585,405)
     
      rec[13] =  Shapes.Addrectangle(90,30)
      Shapes.Move(rec[13], 360,380)
    EndSub
    '  keys    S, W, A, T, F , SpaceBar works
    Sub OnKeyDown
      key= GraphicsWindow.LastKey
      If key="S" Then
        ddx=4
      ElseIf Key="W"then
        ddx=-4
      ElseIf Key="A"then
        ddy=4
      ElseIf key="T"Then
        ddy=-4
      ElseIf key="Space" Then
        ddx=0     'WhT
        ddy=0
        EndIf
      endsub
     
    Sub moveCannon
      If GraphicsWindow.LastKey = "X" Then
        Shapes.Rotate(cannon,angle+5)
        angle=angle+5
      
      ElseIf GraphicsWindow.LastKey = "Z" Then
        Shapes.Rotate(cannon,angle-5)
        angle=angle-5
      ElseIf GraphicsWindow.LastKey="F" then
        Shapes.Animate(ball,GraphicsWindow.width/2,sprite1_y-60,600)
        Shapes.ShowShape(Ball)
        Timer.Resume()
         EndIf
    EndSub
    with thanks                          mahreen miangul
    Sunday, April 09, 2017 4:40 AM
  • This is my solution for graphics challenge: FGC959-0.

    Screen shot of a program Windmill 0.2


    Nonki Takahashi

    Sunday, April 09, 2017 6:02 AM
    Moderator
  • @mussamania

    You program has still two subroutines for keyDown. Only the last KeyDown definition is used. As told you in your other questions, you have to merge all keys you want to use in one Sub, and use only one GraphicsWindow.keyDown.

    After you have fixed that, you can search for other errors.


    Jan [ WhTurner ] The Netherlands

    Sunday, April 09, 2017 8:45 AM
    Answerer
  • This is another solution for graphics challenge: ZZF466-1.

    Screen shot of a program Tulip 0.3


    Nonki Takahashi

    Sunday, April 09, 2017 8:55 AM
    Moderator
  • if I knew how to merge two subroutines or to merge all keys in one sub.I would not be asking your guidance in coding nor would I be asking a question on small basic forum I would be master of my own website answering young programmer question with no string attached your advise is somewhat silly you are telling me merge all keys in one  sub. and my program will be ok. you are also telling me to change the target and the the cannon hit will change very good you are telling me go north to reach a destination but not telling me how far to go very nice answer.edit or send tutorials if you can if not leave them alone.

                  mahreen miangul

    Sunday, April 09, 2017 11:11 AM
  • Here are your two subroutines merged into one:

    Sub OnKeyDown
      '  keys    S, W, A, T, F , SpaceBar works 
      key= GraphicsWindow.LastKey
      If key="S" Then
        ddx=4
      ElseIf Key="W"then
        ddx=-4
      ElseIf Key="A"then
        ddy=4
      ElseIf key="T"Then
        ddy=-4
      ElseIf key="Space" Then
        ddx=0     'WhT 
        ddy=0
      EndIf
      If Key = "X" Then
        Shapes.Rotate(cannon,angle+5)
        angle=angle+5
      ElseIf Key = "Z" Then
        Shapes.Rotate(cannon,angle-5)
        angle=angle-5
      ElseIf Key="F" then
        Shapes.Animate(ball,GraphicsWindow.width/2,sprite1_y-60,600)
        Shapes.ShowShape(Ball)
        Timer.Resume()
      EndIf
    EndSub

    Then you have to remove the second GraphicsWindow.KeyDown, and change the first from MoveCannon to OnKeyDown.

    Your program will then not work because the call to the Sub MoveSprite does nothing but wait forever. The part of the program thereafter is never executed. Remove the call to  Movesprite(). Then the program does work, but perhaps not what you want it to do: e.g. the cannon turns, but the ball goes always straight up.

    In one of the other answers to your questiions is a solution to that.

    EDIT***  to fire with turned casnnon see: https://social.msdn.microsoft.com/Forums/en-US/d42060cc-2d76-4f41-b1d3-d188343b74fa/challenge-of-the-month-march-2017?forum=smallbasic#4d55e4fe-f5be-4cf6-9124-0403ae6b05de  my post from march 28.


    Jan [ WhTurner ] The Netherlands


    Sunday, April 09, 2017 11:23 AM
    Answerer
  • This is my solution for maths challenge: DFQ430.

    Number? 123456789
    3,3607,3803 (123456789=3^2*3607*3803)
    Number? 987654321
    3,17,379721 (987654321=3^2*17^2*379721)
    Number? 1234567890
    2,3,5,3607,3803 (1234567890=2*3^2*5*3607*3803)
    Number?
    
    

    Nonki Takahashi


    Wednesday, April 12, 2017 4:27 PM
    Moderator
  • hello Program QST393 why are the Apples not coming with thanks

                                                               mahreen miangul

    Friday, April 14, 2017 4:45 AM
  • You have a number of errors in your program:

    - rename the array apple to shape en put those lines inside the sub sprite_init.

    - put the following lines after shapes_add()  'Tree Shape / endFor 

    N=9
    For M=1 to 1
      shapes_add()  '  apple Shape
    endfor
    
    This draws one apple (with the wrong size, you have to change that)

    - The cycle is not complete (wrong Moves), but you have programs which do this right, so you should be able to fix that.


    Jan [ WhTurner ] The Netherlands

    Friday, April 14, 2017 11:00 AM
    Answerer
  • To examine the way the figures in program QST393 are drawn, I extracted as an example the apple, and the draw subroutine, added some delay.

    GraphicsWindow.Width=1000
    GraphicsWindow.Height=800
    shape_init()
    n=9
    m=9
    shapes_add()
    
    ''======================================================================
    Sub shapes_add
      ss=s[M]    ''  <--------- scale  data
      GraphicsWindow.PenColor="Black"     '' WhT
      GraphicsWindow.PenWidth=2
      GraphicsWindow.DrawLine(shX[M],0,shX[M],GraphicsWindow.Height)  '' Xposition  WhT
      GraphicsWindow.DrawLine(0,shY[M],GraphicsWindow.Width,shY[M])   ''  Yposition  WhT
      
      for i=1 To Array.GetItemCount(shape[N])  
        GraphicsWindow.PenWidth = shape[N][i]["pw"]
        GraphicsWindow.BrushColor = shape[N][i]["bc"] 
        GraphicsWindow.penColor = shape[N][i]["pc"] 
        If shape[N][i]["func"]="ell" Then 
          shp[M][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss) 
        ElseIf shape[N][i]["func"]="rect" Then 
          shp[M][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)
        ElseIf shape[N][i]["func"]="tri" Then 
          shp[M][i] = Shapes.Addtriangle(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss, shape[N][i]["x3"]*ss, shape[N][i]["y3"]*ss) 
        ElseIf shape[N][i]["func"]="line" Then 
          shp[N][i] = Shapes.Addline(shape[N][i]["x1"]*ss, shape[N][i]["y1"]*ss,shape[N][i]["x2"]*ss, shape[N][i]["y2"]*ss)
        EndIf
        Shapes.Animate(shp[M][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 1000)   '' slow : 2000   WhT
        Program.Delay(1000)                                                                       '' slow draw
      EndFor
    EndSub
    
    Sub shape_init
      '' Apple
      s[9] = 0.4 
      shX[9] = 88
      shY[9] = 288
      shape[9][1] = "func=rect;x=626;y=110;width=20;height=60;angle=0;bc=green;pw=0;"
      shape[9][2] = "func=ell;x=511;y=148;width=150;height=150;bc=crimson;pw=0;"
      shape[9][3] = "func=ell;x=603;y=148;width=150;height=150;bc=crimson;pw=0;"
      shape[9][4] = "func=ell;x=594;y=188;width=40;height=40;bc=snow;pw=0;"
      shape[9][5] = "func=ell;x=633;y=188;width=40;height=40;bc=snow;pw=0;"
      shape[9][6] = "func=ell;x=614;y=196;width=15;height=15;bc=darkslategray;pw=0;"
      shape[9][7] = "func=ell;x=635;y=196;width=15;height=15;angle=7;bc=darkslategray;pw=0;"
      shape[9][8] = "func=rect;x=600;y=250;width=80;height=20;angle=-5;bc=purple;pw=0;"
    EndSub
      



    Jan [ WhTurner ] The Netherlands

    Friday, April 14, 2017 1:53 PM
    Answerer
  • This is my first step for the physics challenge: CQK137.

    Screen shot of a program Balance Scale 0.1a


    Nonki Takahashi

    Saturday, April 15, 2017 1:56 AM
    Moderator
  • hello Program QST393 why are the Apples not coming with thanks

                                                               mahreen miangul

    see QST393-0

    https://social.msdn.microsoft.com/Forums/en-US/e02c058f-cc21-47b8-b940-b32d78de7154/mahreen-miangul-april-2017?forum=smallbasic&prof=required

    Sunday, April 16, 2017 12:16 AM
    Answerer
  • hello ID TVJ820 i think i am getting somewhere if you post good and easy tutorials i am a fast learner the keys are doing there job the sprite is also moving on the screen the cannon is also animating and firing now to hit the sprite by the cannon ball and hit the spite on the head or the bump like in the duck shoot game with thanks
    GraphicsWindow.top=0
    GraphicsWindow.left=0
    GraphicsWindow.Title = "S-W-A-T"
    GraphicsWindow.Width = "1288"
    GraphicsWindow.Height = "666"
    GraphicsWindow.BackgroundColor = "skyblue"
    '-----------------        Draw  Hill,  Lake, Sun--------------------------------------------------------------------------------------------------------
    ' Hill
    GraphicsWindow.brushColor = "tan"
    GraphicsWindow.fillEllipse(-88,505,620,288)
    GraphicsWindow.fillEllipse(211,388,622,366)
    GraphicsWindow.fillEllipse(211,388,1888,666)
    ' Lake
    GraphicsWindow.BrushColor = "SkyBlue"
    GraphicsWindow.PenColor = "LightSlateGray"
    SnowGlobe = Shapes.AddEllipse(600,200)
    Shapes.Move(SnowGlobe,666,420)
    '  Sun
    GraphicsWindow.BrushColor = "yellow"
    GraphicsWindow.fillEllipse(1100,10,150,150)
    GraphicsWindow.BrushColor = "darkslategray"
    GraphicsWindow.FillEllipse(1130,40,15,45)
    GraphicsWindow.FillEllipse(1190,40,15,45)
    GraphicsWindow.brushColor = "darkslategray
    GraphicsWindow.Fillrectangle(1130,110,80,10)
    '  Clouds
    GraphicsWindow.PenColor = "darkslategray"
    GraphicsWindow.PenWidth = 2
    GraphicsWindow.DrawEllipse(80,40,100,100)
    GraphicsWindow.DrawEllipse(50,60,40,50)
    GraphicsWindow.DrawEllipse(60,16,70,50)
    GraphicsWindow.DrawEllipse(130,14,70,40)
    GraphicsWindow.DrawEllipse(150,50,80,50)
    GraphicsWindow.DrawEllipse(150,90,70,70)
    GraphicsWindow.DrawEllipse(70,100,95,70)
    GraphicsWindow.brushColor = "lightgray"
    GraphicsWindow.fillEllipse(80,40,100,100)
    GraphicsWindow.fillEllipse(50,60,40,50)
    GraphicsWindow.fillEllipse(60,16,70,50)
    GraphicsWindow.fillEllipse(130,14,70,40)
    GraphicsWindow.fillEllipse(150,50,80,50)
    GraphicsWindow.fillEllipse(150,90,70,70)
    GraphicsWindow.fillEllipse(70,100,95,70)
    '--------------------Font Animation -----------------------------------------------------------------------------------------
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.FontSize = 100
    GraphicsWindow.FontItalic = "True"
    GraphicsWindow.BrushColor = "lightyellow"    ' Text shadow color
    GraphicsWindow.DrawText(25, 545, "haroon rashid!")
     gold= GraphicsWindow.getcolorfromrgb(121,94,40)
     GraphicsWindow.BrushColor=gold
     
    GraphicsWindow.BrushColor = gold ' Text color
    GraphicsWindow.DrawText(20, 540, "haroon rashid!")
    MakeSprite()
    by=2  '  ball speed Y-direction
    '-------------------------Animation // Shapes--------------------------------------------------------
    '  1Tree
    Tree_init()
    shape=tree
    Name="Tree"
    add_shapes()
    '  2House
    house_Init()
    shape=house
    Name="house"
    add_shapes()
    '  3Apple
    aple_Init()
    shape=aple
    Name="aple"
    add_shapes()
    '  4Ball
    balls_init()
    shape=ball
    Name="Ball"
    add_shapes()
    '  5Duck
    Duck_Init()
    shape=duck
    Name="Duck"
    add_shapes()
    '----------------------Add // Shapes-----------------------------------------------------------------
    Sub add_shapes
      For M=1 To Array.GetItemCount(scale)
        ss=scale[M]
        SName=Name+"_"+M
        for i=1 To Array.GetItemCount(shape)
          GraphicsWindow.PenWidth = shape[i]["pw"]
          GraphicsWindow.BrushColor = shape[i]["bc"]
          GraphicsWindow.penColor = shape[i]["pc"]
          If shape[i]["func"]="ell" Then
            shp[SName][i] = Shapes.AddEllipse(shape[i]["width"]*ss, shape[i]["height"]*ss)
          ElseIf shape[i]["func"]="rect" Then
            shp[SName][i] = Shapes.AddRectangle(shape[i]["width"]*ss, shape[i]["height"]*ss)
          ElseIf shape[i]["func"]="tri" Then
            shp[SName][i] = Shapes.Addtriangle(shape[i]["x1"]*ss, shape[i]["y1"]*ss,shape[i]["x2"]*ss, shape[i]["y2"]*ss, shape[i]["x3"]*ss, shape[i]["y3"]*ss)
          ElseIf shape[i]["func"]="line" Then
            shp[SName][i] = Shapes.Addline(shape[i]["x1"]*ss, shape[i]["y1"]*ss,shape[i]["x2"]*ss, shape[i]["y2"]*ss)
          ElseIf shape[i]["func"]="txt" Then
            GraphicsWindow.FontSize=shape[i]["Size"]
            shp[SName][i] = Shapes.Addtext(shape[i]["Letter"])
          EndIf
          Shapes.Animate(shp[SName][i], shape[i]["x"]*ss+shX[M], shape[i]["y"]*ss+shY[M], 500)
          Shapes.Rotate(shp[SName][i], Shape[i]["angle"])   
        EndFor
      EndFor
    EndSub
    '-----------------------------------------Animation // 1 (Cannon) 2 (Ball )---------------------------------------------------
    GraphicsWindow.BrushColor = "slateblue"
    GraphicsWindow.penColor = "slateblue"
    cannon1_x = 644
    cannon1_y = 566
    sprite1_x = 0
    sprite1_y = 20
    cannon = Shapes.AddRectangle(50,100)
    Shapes.Move(cannon, cannon1_x, cannon1_y)
    GraphicsWindow.BrushColor="darkslategray"
    GraphicsWindow.penColor="darkslategray"
    Ball=Shapes.AddEllipse(40,40)
    Shapes.Move(Ball,cannon1_x+5,cannon1_y+30)
    Shapes.HideShape(Ball)
    Timer.interval=500
    Timer.tick=OnTimerTick
    '-----------------------------------------------Animation----------------------------------------------------
    GraphicsWindow.KeyDown = OnKeyDown
    While "True" '<------------
      TrainMove="True" '<------------
    While TrainMove '<------------
      For i=1 To 13
        Shapes.Move(ell[i],Shapes.GetLeft(ell[i])+ddx,shapes.GetTop(ell[i])+ddy)
        Shapes.Move(rec[i],Shapes.GetLeft(rec[i])+ddx,shapes.GetTop(rec[i])+ddy)
        Shapes.Move(Tri[i],Shapes.GetLeft(Tri[i])+ddx,shapes.GetTop(Tri[i])+ddy)
      EndFor
      If Shapes.GetLeft(ell[1])<-200 Then
        moveright()
      EndIf
      If Shapes.GetLeft(ell[1])>1200 then    'WhT
        ddx=-ddx                             'WhT
      EndIf                                  'WhT
      If shoot Then '<------------   
        TX= Shapes.GetLeft(Tri[4])+230 '<------------
        TY= Shapes.Gettop(Tri[4])+385 '<------------
        If bY<-100 then '<------------
          shoot="False"'<------------
        EndIf  '<-------
          Hit="True" '<------------
          TrainMove="False" '<------------
        EndIf  '<------------
      Program.Delay(20)
      endwhile
      Program.Delay(1500) '<------------
    endwhile
    Sub moveright
      el1y=shapes.GetTop(rec[9]) '<--------- 
      ddy= Math.GetRandomNumber(Math.Abs(300-el1y))-el1y
      ddx=-ddx                                'WhT
      For i=1 To 13
        Shapes.Move(ell[i],Shapes.GetLeft(ell[i])+ddx,shapes.GetTop(ell[i])+ddy)  'WhT   changed 1200 to ddx
        Shapes.Move(rec[i],Shapes.GetLeft(rec[i])+ddx,shapes.GetTop(rec[i])+ddy)  'WhT  changed 1200 to ddx
        Shapes.Move(Tri[i],Shapes.GetLeft(Tri[i])+ddx,shapes.GetTop(Tri[i])+ddy)  'haroon rashid  changed 1200 to ddx
      EndFor
      'ddy=0
    EndSub
    Sub OnTimerTick
      Timer.Pause()
        Shapes.HideShape(Ball)
      Shapes.Move(Ball,cannon1_x+5,cannon1_y+30)
    EndSub
    '-------------------------------------Data // Sprite-----------------------------------------------------------
    Sub MakeSprite
      ' 7 Rectangle
      GraphicsWindow.BrushColor="green"
      rec[1] =  Shapes.AddRectangle(50,8)  '<-- 
      Shapes.Move(rec[1], 440,115)
      rec[2] =  Shapes.AddRectangle(50,8)  '<-- 
      Shapes.Move(rec[2], 440,140)
      GraphicsWindow.brushcolor = "sienna"
      rec[3] =  Shapes.AddRectangle(60,6)  '<-- 
      Shapes.Move(rec[3], 355,120)
      rec[4] =  Shapes.AddRectangle(60,6)  '<-- 
      Shapes.Move(rec[4], 355,138)
      GraphicsWindow.brushcolor = "darkgoldenrod"
      rec[5] =  Shapes.AddRectangle(100,22)  '<-- 
      Shapes.Move(rec[5], 400,120)
      ' 7 Ellipses
      GraphicsWindow.BrushColor="bisque"
      ell[1] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[1], 520,90)
      ell[2] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[2], 520,150)
       GraphicsWindow.BrushColor="purple"
      ell[3] =  Shapes.AddEllipse(70,70)
      Shapes.Move(ell[3], 500,95)
      GraphicsWindow.BrushColor="sienna"
      ell[4] =  Shapes.AddEllipse(30,10)
      Shapes.Move(ell[4], 520,120)
      GraphicsWindow.BrushColor="pink"
      ell[5] =  Shapes.AddEllipse(10,30)
      Shapes.Move(ell[5], 510,115)
      GraphicsWindow.BrushColor="cyan"
      ell[6] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[6], 530,102)
      ell[7] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[7], 530,128)
      ' 1 triangles
      GraphicsWindow.BrushColor="gold"
      tri[1] =  Shapes.Addtriangle(566,100,611,130,566,160)
      Shapes.Move(tri[1], 0,0)
     
      chrome=GraphicsWindow.getcolorfromrgb(215,219,213)
        GraphicsWindow.brushcolor=chrome
      tri[3] =  Shapes.Addtriangle(585,405,585,420,450,390)
      Shapes.Move(tri[3], 0,0)
        GraphicsWindow.BrushColor="#000000"
      tri[4] =  Shapes.Addtriangle(350,445,230,445,350,385)
      Shapes.Move(tri[4], 0,0)
     
      ' piston cylinder
     
      GraphicsWindow.brushcolor=chrome
      rec[12] =  Shapes.Addrectangle(150,20)
      Shapes.Move(rec[12], 585,405)
     
      rec[13] =  Shapes.Addrectangle(90,30)
      Shapes.Move(rec[13], 360,380)
    EndSub
    '-----------------------------------Data//Shapes------------------------------------------------------
    Sub  aple_init
      scale ="1=0.2;2=0.2;3=0.2;4=0.2;5=0.2;6=0.2;7=0.2;8=0.2"
      shX ="1=-20;2=80;3=666;4=888;5=777;6=922;7=155;8=144"
      shY ="1=340;2=330;3=250;4=240;5=320;6=360;7=340;8=420"
      aple[1] = "func=rect;x=626;y=110;width=20;height=60;angle=0;bc=green;pw=0;"
      aple[2] = "func=ell;x=511;y=148;width=150;height=150;bc=crimson;pw=0;"
      aple[3] = "func=ell;x=603;y=148;width=150;height=150;bc=crimson;pw=0;"
      aple[4] = "func=ell;x=594;y=188;width=40;height=40;bc=snow;pw=0;"
      aple[5] = "func=ell;x=633;y=188;width=40;height=40;bc=snow;pw=0;"
      aple[6] = "func=ell;x=614;y=196;width=15;height=15;bc=darkslategray;pw=0;"
      aple[7] = "func=ell;x=635;y=196;width=15;height=15;angle=7;bc=darkslategray;pw=0;"
      aple[8] = "func=rect;x=600;y=250;width=80;height=20;angle=-5;bc=purple;pw=0;"
    endsub
    Sub  house_init
      scale = "1=0.5" 
      shX = "1=25"
      shY = "1=40"
      house[1] = "func=rect;x=800;y=280;width=210;height=30;bc=gray;pc=darkslategray;pw=1"'Rec A4
      house[2] = "func=rect;x=777;y=310;width=258;height=30;bc=silver;pc=darkslategray;pw=1"'Rec A3
      house[3] = "func=rect;x=755;y=340;width=277;height=30;bc=gray;pc=darkslategray;pw=2"'Rec A2
      house[4] = "func=rect;x=766;y=370;width=272;height=30;bc=silver;pc=darkslategray;pw=2"'Rec A1
      house[5] = "func=tri;x=480;y=340;x1=222;y1=60;x2=262;y2=8;x3=320;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1
      house[6] = "func=tri;x=480;y=320;x1=244;y1=50;x2=280;y2=6;x3=320;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2
      house[7] = "func=tri;x=480;y=300;x1=267;y1=40;x2=298;y2=4;x3=320;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3
      house[8] = "func=tri;x=480;y=280;x1=292;y1=30;x2=320;y2=2;x3=320;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4
      house[9] = "func=tri;x=480;y=340;x1=530;y1=60;x2=585;y2=8;x3=636;y3=60;bc=silver;pc=darkslategray;pw=2"'Tri A1
      house[10] = "func=tri;x=480;y=320;x1=530;y1=50;x2=566;y2=6;x3=608;y3=50;bc=gray;pc=darkslategray;pw=2"'Tri A2
      house[11] = "func=tri;x=480;y=300;x1=530;y1=40;x2=548;y2=4;x3=580;y3=40;bc=silver;pc=darkslategray;pw=2"'Tri A3
      house[12] = "func=tri;x=480;y=280;x1=530;y1=30;x2=530;y2=2;x3=555;y3=30;bc=gray;pc=darkslategray;pw=2"'Tri A4
      house[13] = "func=rect;x=743;y=397;width=333;height=333;bc=snow;pc=darkslategray;pw=2"'Body Structpw=2ure
      house[14] = "func=rect;x=766;y=608;width=100;height=122;bc=saddlebrown;pc=darkslategray;pw=2"'DoorA
      house[15] = "func=ell;x=766;y=573;width=100;height=80;bc=saddlebrown;pw=2"'pc=saddlebrown;"'DoorB
      house[16] ="func=ell;x=788;y=684;width=10;height=10;bc=yellow;pc=darcksategray;pw=2"'DoorC
      house[17] ="func=rect;x=944;y=480;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowA
      house[18] ="func=ell;x=944;y=428;width=100;height=122;bc=saddlebrown;darkslategray;pw=2"'WindowB
      house[19] = "func=rect;x=955;y=473;width=80;height=111;bc=skyblue;pc=darkslategray;pw=2"'windowC
      house[20] = "func=ell;x=955;y=442;width=80;height=88;bc=skyblue;pc=darkslategray;pw=2"'windowD
      house[21] ="func=line;x=877;y=451;x1=80;y1=30;x2=155;y2=30;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 1
      house[22] ="func=line;x=8977;y=451;x1=80;y1=60;x2=155;y2=60;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 2
      house[23] ="func=line;x=877;y=451;x1=80;y1=90;x2=155;y2=90;bc=dodgerblue;pc=darkslategray;pw=2"'Widow Grill 3
      house[24] ="func=line;x=900;y=395;x1=95;y1=44;x2=95;y2=188;bc=dodgerblue;pc=darkslategray;pw=2"'Window Grill 4
      house[25] ="func=rect;x=922;y=242;width=80;height=100;bc=crimson;pc=darkslategray;pw=2"'Chimny 1
      house[26] ="func=rect;x=911;y=241;width=100;height=20;bc=firebrick;pc=darkslategray;pw=2"'Chimny 2
    endsub
    Sub balls_init
      scale ="1=0.4;2=0.4;3=0.3;4=0.2"
      shX ="1=844;2=888;3=800;4=777"
      shY ="1=50;2=60;3=60;4=40"
      ball[1] = "func=ell;x=99;y=0;width=56;height=24;bc=#DFCA54;pc=#000000;pw=2;"              '    Head
      ball[2] = "func=ell;x=129;y=6;width=15;height=6;bc=#DF3954;pc=#000000;pw=2;"              '  Eye
      ball[3] = "func=ell;x=105;y=12;width=16;height=36;angle=45;bc=#00CA54;pc=#000000;pw=2;"    '   Neck
      ball[4] = "func=tri;x=50;y=5;x1=21;y1=0;x2=0;y2=57;x3=29;y3=57;bc=#DFCA54;pc=#000000;pw=2;"  'Wing
      ball[5] = "func=ell;x=1;y=38;width=108;height=31;bc=#DFCA54;pc=#000000;pw=2;"              '  Body
      ball[6] = "func=tri;x=37;y=0;x1=7;y1=0;x2=0;y2=57;x3=29;y3=57;bc=#DF8754;pc=#000000;pw=2;"  'Wing
      ball[7] = "func=ell;x=144;y=15;width=29;height=9;angle=13;bc=#DF8754;pc=#000000;pw=2;"      'Mouth
      ball[8] = "func=line;x=8;y=60;x1=0;y1=8;x2=49;y2=7;pc=#DF3954;pw=2;"
      ball[9] = "func=line;x=0;y=70;x1=9;y1=0;x2=0;y2=10;pc=#DF3954;pw=2;"
    EndSub
    Sub Tree_init  ' Tree Data
      scale ="1=.8;2=.8;3=.8;4=.8;5=.8;6=.8;7=.8;8=.8;9=0.8"
      shX ="1=10;2=100;3=200;4=700;5=800;6=900;7=1000;8=1100;9=133"
      shY ="1=188;2=177;3=166;4=110;5=100;6=100;7=100;8=110;9=210" 
      tree[1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning"
      tree[3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=0"  '  PW=0  then  pc no meaning
      tree[9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=0"  '  PW=0  then  pc no meaning
      tree[10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0"  '  PW=0  then  pc no meaning
      tree[11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0"  '  PW=0  then  pc no meaning
      tree[12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0"  '  PW=0  then  pc no meaning
      tree[13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0"  '  PW=0  then  pc no meaning
    endsub
    Sub Duck_Init  '  Duck  
      scale ="1=0.3;2=0.25;3=0.2;4=0.15"
      shX ="1=922;2=900;3=888;4=844"
      shY ="1=500;2=500;3=500;4=500"
      duck[1] = "func=tri;x=153;y=41;x1=47;y1=0;x2=0;y2=22;x3=95;y3=22;bc=red;pw=0" ';beck"
      duck[2] = "func=ell;x=118;y=0;width=91;height=73;bc=blue;pw=0;"
      duck[3] = "func=line;x=172;y=36;x1=0;y1=0;x2=22;y2=0;pc=red;pw=2" ' ;blink"
      duck[4] = "func=ell;x=172;y=25;width=22;height=22;bc=pink;pw=0" '  ;eye"
      duck[5] = "func=tri;x=132;y=58;x1=31;y1=0;x2=0;y2=45;x3=62;y3=45;bc=red;pw=0"  ' ;neck"
      duck[6] = "func=tri;x=0;y=80;x1=37;y1=0;x2=0;y2=32;x3=75;y3=32;angle=178;bc=red;pw=0" '  ;tail"
      duck[7] = "func=line;x=91;y=134;x1=0;y1=0;x2=0;y2=36;pc=red;pw=8" ' ;Leg1"
      duck[8] = "func=ell;x=33;y=72;width=164;height=82;bc=yellow;pw=0" '  ;body"
      duck[9] = "func=tri;x=58;y=180;x1=46;y1=0;x2=0;y2=14;x3=93;y3=14;bc=red;pw=0" ';Leg3"
      duck[10] = "func=line;x=90;y=169;x1=0;y1=0;x2=14;y2=15;pc=yellow;pw=8" '  ;Leg2"
    EndSub
    '  Keys    S, W, A, T, X,Z,F , SpaceBar works
    Sub OnKeyDown
      key= GraphicsWindow.LastKey
      If key="S" Then
        ddx=4
      ElseIf Key="W"then
        ddx=-4
      ElseIf Key="A"then
        ddy=4
      ElseIf key="T"Then
        ddy=-4
      ElseIf key="Space" Then
        ddx=0     'WhT
        ddy=0
      EndIf
      If Key = "X" Then
        Shapes.Rotate(cannon,angle+5)
        angle=angle+5
      ElseIf Key = "Z" Then
        Shapes.Rotate(cannon,angle-5)
        angle=angle-5
      ElseIf Key="F" then
        Shapes.Animate(ball,GraphicsWindow.width/2,sprite1_y-60,600)
        Shapes.ShowShape(Ball)
        Timer.Resume()
      EndIf
    EndSub
                                      mahreen miangul
    Sunday, April 16, 2017 3:29 AM
  • hello nice and good tutorial with thanks
                                                               mahreen miangul

    Sunday, April 16, 2017 6:48 AM
  • hello Yandee Man made using ellipses only the triangle rectangles and the line are not related to the sprite and are just for fun the only problem now is that i cannot do both moving the sprite and bilinking its eyes at the same time ID QRB861 thankyou

                                      mahreen miangul

    Friday, April 21, 2017 12:21 PM
  • Hello all programmers.

    Just to say next month's challenges will be a few days late since I will be away from home.

    Friday, April 21, 2017 4:59 PM
    Moderator
  • very nice we in pakistan wakeup late come to office late answer late some time dont answer at all the only thing we dont do late sleep early go from office early we are brothers thankyou

                                                                      mahreen miangul

    Saturday, April 22, 2017 11:48 AM
  • hello Yandee Man made using ellipses only the triangle rectangles and the line are not related to the sprite and are just for fun the only problem now is that i cannot do both moving the sprite and bilinking its eyes at the same time ID QRB861 thankyou

                                      mahreen miangul

    In your program, add the following lines just before the While

    z=1 
    dz=-0.02

    and this lines just before the EndWhile

      z=z+dz
      If z=0 Or z=1 Then
        dz=-dz
      endif
      Shapes.Zoom(ell[10],z,1)
      Shapes.Zoom(ell[11],1,z)
    



    Jan [ WhTurner ] The Netherlands

    Saturday, April 22, 2017 2:20 PM
    Answerer
  • hello i am not a programmer you are the guru but i think the good is incomplete or i dont understand it the eye blink once and stuck             thankyou

                                                                                                                  mahreen miangul

    Sunday, April 23, 2017 9:48 AM
  • I have added the above given lines (now with comment ''WhT" ) in your program QRB861 and published as QRB861-0. When I run this program, the blink doesn't stop. Try this.


    Jan [ WhTurner ] The Netherlands

    Sunday, April 23, 2017 5:55 PM
    Answerer
  • Thank you holland God bless you

                                    with best wishes                  mahreen miangul

    Monday, April 24, 2017 11:58 AM
  • hello program ZPG903 the animation is now fine the cannon is moving X-Y direction con i move the kong by arrokeys i have tried but failed the Trees and the Apples are also fine i think so  help nedeed with the Arrowkeys and the kong with thanks                    mahreen miangul
    Wednesday, April 26, 2017 11:27 AM
  • To get the arrowkeys working:

    Move the lines from "PMXY= ...." and the next 11 lines out of the "ElseIf Key="F" "block (i.e. after the EndIf  )

    As a hint for the writing of long programs: Do NOT put parts of the main program between Subs. Thus put all the Subroutines AFTER the main program.


    Jan [ WhTurner ] The Netherlands

    Wednesday, April 26, 2017 1:19 PM
    Answerer
  • There is also an error in the Sub move_index: the for-loop uses as variable , these variable is also used in the Blink routine for the cycle. These two gives interference. One of the variables should get another name. In the codeblock I give the new move_init subroutine with another For-variable:

    Sub move_index
      For iMove=1 To 47  '  <---  shp[] array number is 47
        Shapes.Move(shp[iMove],Shapes.GetLeft(shp[iMove])+dX,Shapes.Gettop(shp[iMove])+dY) ' current position +dX ,+dY
      EndFor
    EndSub
    



    Jan [ WhTurner ] The Netherlands

    Wednesday, April 26, 2017 5:40 PM
    Answerer