none
mahreen miangul febrUary 2017

    Question

  • hello everybody hope all of you are well and in good health programs Blinking Eyes ID BDR631 and Chalk Colors ID PCC484 were posted now i am putting a program ID ZMZ638 on the forum the cycle is moving from left to right would like to move it from right to left will some one help

    ' mahreen miangul
    ' Animation Event
    ' FebrUary 2017
    GraphicsWindow.Title = "ArrowKeys Event"
    GraphicsWindow.Width = "1080"
    GraphicsWindow.Height = "420"
    GraphicsWindow.BackgroundColor = "LightYellow"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.FontSize = 120
     GraphicsWindow.FontItalic = "True"

     GraphicsWindow.BrushColor = "Silver"    ' Text shadow color
      GraphicsWindow.DrawText(5, 5, "mahreen miangul!") ' Shadow position/text

     GraphicsWindow.BrushColor = "RosyBrown" ' Text color
     GraphicsWindow.DrawText(0, 0, "mahreen miangul!") ' Position and text
    MakeSprite()
    ddx=-5
    ddy=0

    While "True"
      For i=1 To 5
        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)
      EndFor
      If Shapes.GetLeft(ell[1])<-200 Then
        moveright()
      EndIf
      Program.Delay(20)
    endwhile

    Sub moveright
      el1y=shapes.GetTop(ell[1])
      ddy= Math.GetRandomNumber(Math.Abs(300-el1y))-el1y
      For i=1 To 5
        Shapes.Move(ell[i],Shapes.GetLeft(ell[i])+1200,shapes.GetTop(ell[i])+ddy)
        Shapes.Move(rec[i],Shapes.GetLeft(rec[i])+1200,shapes.GetTop(rec[i])+ddy)
      EndFor
      ddy=0
    EndSub

    Sub MakeSprite
      ' 1 Rectangle
      GraphicsWindow.BrushColor="darkgoldenrod"
      rec[1] =  Shapes.AddRectangle(100,22)  '<--  body
      Shapes.Move(rec[1], 400,120)
      ' 5 Ellipses
        GraphicsWindow.BrushColor="purple"
      ell[1] =  Shapes.AddEllipse(70,70)
      Shapes.Move(ell[1], 500,95)
      GraphicsWindow.BrushColor="cyan"
      ell[2] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[2], 524,128)
      GraphicsWindow.BrushColor="cyan"
      ell[3] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[3], 524,102)
      GraphicsWindow.BrushColor="sienna"
      ell[4] =  Shapes.AddEllipse(60,6)
      Shapes.Move(ell[4], 360,122)
        GraphicsWindow.BrushColor="sienna"
      ell[5] =  Shapes.AddEllipse(60,6)
      Shapes.Move(ell[5], 360,136)
    EndSub

     
    Monday, February 13, 2017 1:20 PM

Answers

  • Here is your program with the following changes:

    - your figure moves left to right and back.

    - on pressing one of the keys S W A or P, the figure goes in the other direction.

    I added 11 lines and changed two line, they are marked with WhT

    ' mahreen miangul
    ' Animation Event
    ' FebrUary 2017
    GraphicsWindow.Title = "ArrowKeys Event"
    GraphicsWindow.Width = "1080"
    GraphicsWindow.Height = "420"
    GraphicsWindow.BackgroundColor = "LightYellow"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.FontSize = 120
    GraphicsWindow.FontItalic = "True"
    
    GraphicsWindow.BrushColor = "Silver"    ' Text shadow color
    GraphicsWindow.DrawText(5, 5, "mahreen miangul!") ' Shadow position/text
    
    GraphicsWindow.BrushColor = "RosyBrown" ' Text color
    GraphicsWindow.DrawText(0, 0, "mahreen miangul!") ' Position and text
    GraphicsWindow.KeyDown=KeyD             'WhT
    MakeSprite()
    ddx=-5
    ddy=0
    
    While "True"
      For i=1 To 5
        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)
      EndFor
      If Shapes.GetLeft(ell[1])<-200 Then 
        moveright()
      EndIf
      If Shapes.GetLeft(ell[1])>1200 then   'WhT
        ddx=-ddx                            'WhT
      EndIf                                 'WhT
      Program.Delay(20)
    endwhile
    Sub KeyD                                'WhT
      key=GraphicsWindow.LastKey             'WhT
      If key="S" or key="W" Or key="A" Or key="P" then    'WhT
        ddx=-ddx                             'WhT
      EndIf                                  'WhT   
    EndSub                                   'WhT
    
    Sub moveright
      el1y=shapes.GetTop(ell[1])
      ddy= Math.GetRandomNumber(Math.Abs(300-el1y))-el1y
      ddx=-ddx                               'WhT
      For i=1 To 5
        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
      EndFor
      ddy=0
    EndSub
    
    Sub MakeSprite
      ' 1 Rectangle
      GraphicsWindow.BrushColor="darkgoldenrod"
      rec[1] =  Shapes.AddRectangle(100,22)  '<--  body
      Shapes.Move(rec[1], 400,120)
      ' 5 Ellipses
      GraphicsWindow.BrushColor="purple"
      ell[1] =  Shapes.AddEllipse(70,70)
      Shapes.Move(ell[1], 500,95)
      GraphicsWindow.BrushColor="cyan"
      ell[2] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[2], 524,128)
      GraphicsWindow.BrushColor="cyan"
      ell[3] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[3], 524,102)
      GraphicsWindow.BrushColor="sienna"
      ell[4] =  Shapes.AddEllipse(60,6)
      Shapes.Move(ell[4], 360,122)
      GraphicsWindow.BrushColor="sienna"
      ell[5] =  Shapes.AddEllipse(60,6)
      Shapes.Move(ell[5], 360,136)
    EndSub
    


    Jan [ WhTurner ] The Netherlands

    • Proposed as answer by YLedEditor Monday, February 13, 2017 9:23 PM
    • Marked as answer by mussamaina Tuesday, February 14, 2017 5:57 AM
    Monday, February 13, 2017 4:26 PM
    Answerer
  • mussa maina  nice program.

    rec[9] is the top shape.

    el1y=shapes.GetTop(rec[9]) '<---------  ell[1] to rec[9]

    • Marked as answer by mussamaina Thursday, February 16, 2017 10:44 AM
    Wednesday, February 15, 2017 11:39 PM
    Answerer
  • mussa-maina    how about this. 

    If "B" press ball  moves to top, if ball hits tri[4](front of train), train stops.

    ball added  when ball  frame out.

      

    ZWZ092-3  '<----* continuously works.



    • Edited by NaochanONEditor Friday, February 17, 2017 3:13 AM
    • Marked as answer by mussamaina Friday, February 17, 2017 11:15 AM
    Friday, February 17, 2017 3:08 AM
    Answerer
  • how about this?

    GraphicsWindow.Width = 1288
    GraphicsWindow.Height = 688
    GraphicsWindow.BackgroundColor = "rosybrown"
    GraphicsWindow.KeyDown=Onkeydown

    shape_init() '   Human and Tree shape data
    N=0
    M=0
    shapes_add() '  Human shapes
    N=1
    For M=1 to 6
      shapes_add()  '  Tree shapes
    endfor

    'Animate shapes - eyes and mouth
    dZ = 0.1
    zoom = 1
    ddx=4
    While 0=0
      zoom = zoom - dZ
      For i = 1 To Array.GetItemCount(shape[0])
        If Array.ContainsValue(shape[0][i], "eye") Then
          Shapes.Zoom(shp[0][i], 1, zoom)
        ElseIf Array.ContainsValue(shape[0][i], "mouth") Then
          Shapes.Zoom(shp[0][i], zoom, zoom)
        EndIf
        shapes.Move(shp[0][i],shapes.GetLeft(shp[0][i])+ddx,shapes.Gettop(shp[0][i]))
      EndFor
      If zoom = 0 Or zoom = 1 Then
        dZ = -dZ
      EndIf
      Program.Delay(100)
    EndWhile

    Sub Onkeydown
      key= GraphicsWindow.LastKey
      If key="S" or key="A"Then
        ddx=-ddx
      EndIf
    EndSub

    Sub shapes_add
      ss=s[M]    '  <--------- scale  data
      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)
        EndIf
        Shapes.Animate(shp[M][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 500)
      EndFor
    EndSub

    Sub shape_init
      ' Human   Data
      shape[0][1] = "func=ell;x=475;y=167;width=30;height=32;bc=bisque;tag=ear"'left
      shape[0][2] = "func=ell;x=572;y=167;width=30;height=32;bc=bisque;tag=ear"'right
      shape[0][3] = "func=ell;x=488;y=145;width=100;height=100;bc=darkgoldenrod;tag=face"
      shape[0][4] = "func=ell;x=515;y=165;width=10;height=10;bc=blue;tag=eye"'left
      shape[0][5] = "func=ell;x=555;y=165;width=10;height=10;bc=blue;tag=eye"'right
      shape[0][6] = "func=ell;x=533;y=175;width=10;height=30;bc=sienna;tag=nose"
      shape[0][7] = "func=ell;x=522;y=210;width=30;height=10;bc=pink;tag=mouth"
      shape[0][8] = "func=rect;x=515;y=240;width=50;height=100;bc=sienna;tag=body"
      shape[0][9] = "func=tri;x1=500;y1=150;x2=540;y2=100;x3=580;y3=150;bc=purple;angle=0;pw=0;tag=head"
      shape[0][10] = "func=rect;x=520;y=340;width=8;height=50;bc=yellow;Leg1"
      shape[0][11] = "func=rect;x=550;y=340;width=8;height=50;bc=yellow;Leg2"
      shape[0][12] = "func=rect;x=565;y=270;width=50;height=8;bc=green;tag=mouth"'hand2
      shape[0][13] = "func=rect;x=463;y=270;width=50;height=8;bc=green;tag=mouth"'hand1
      '  Tree data
      shape[1][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2"
      shape[1][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2
      shape[1][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2
      shape[1][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2
      shape[1][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2
      shape[1][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2
      shape[1][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2
      shape[1][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2
      shape[1][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2
      shape[1][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      shape[1][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      shape[1][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      shape[1][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      '  scale and   start XY position
      s   = "0=1.1;1=.8;2=.8;3=.8;4=.8;5=.8;6=.8"
      shX = "0=0;1=10;2=160;3=655;4=822;5=988;6=1100"
      shY = "0=0;1=188;2=180;3=112;4=88;5=102;6=122"
    endsub

    • Proposed as answer by YLedEditor Sunday, February 26, 2017 4:02 PM
    • Marked as answer by mussamaina Monday, February 27, 2017 12:04 PM
    Sunday, February 26, 2017 5:05 AM
    Answerer
  • I see no use for the use of two keys (A and S) for the same purpose. It is better to use A for left and S for right:

    Sub Onkeydown
      key= GraphicsWindow.LastKey
      If key="S" Then
        ddx=4
      ElseIf key="A"Then
        ddx=-4
      ElseIf key="Space" Then
        ddx=0
    EndIf 
    EndSub


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Sunday, February 26, 2017 12:06 PM added stop bY Space
    • Proposed as answer by YLedEditor Sunday, February 26, 2017 4:02 PM
    • Marked as answer by mussamaina Monday, February 27, 2017 12:04 PM
    Sunday, February 26, 2017 11:34 AM
    Answerer
  • NaochanON version with WhTurner suggestion

    program: BGB172

    • Marked as answer by mussamaina Monday, February 27, 2017 12:04 PM
    Sunday, February 26, 2017 4:02 PM
    Answerer

All replies

  • You have to make you wishes clearer.

    - when do you want to move from left to right?

    1. after reaching the left side or

    2. on the press of a key

    Or only to move from left to right?


    Jan [ WhTurner ] The Netherlands

    Monday, February 13, 2017 2:11 PM
    Answerer
  • hello with good wishes to turn the cycle on pressing keys-S-W-A or P with thanks

           with love from mussa maina------------------------mahreen miangul

    Monday, February 13, 2017 2:22 PM
  • Here is your program with the following changes:

    - your figure moves left to right and back.

    - on pressing one of the keys S W A or P, the figure goes in the other direction.

    I added 11 lines and changed two line, they are marked with WhT

    ' mahreen miangul
    ' Animation Event
    ' FebrUary 2017
    GraphicsWindow.Title = "ArrowKeys Event"
    GraphicsWindow.Width = "1080"
    GraphicsWindow.Height = "420"
    GraphicsWindow.BackgroundColor = "LightYellow"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.FontSize = 120
    GraphicsWindow.FontItalic = "True"
    
    GraphicsWindow.BrushColor = "Silver"    ' Text shadow color
    GraphicsWindow.DrawText(5, 5, "mahreen miangul!") ' Shadow position/text
    
    GraphicsWindow.BrushColor = "RosyBrown" ' Text color
    GraphicsWindow.DrawText(0, 0, "mahreen miangul!") ' Position and text
    GraphicsWindow.KeyDown=KeyD             'WhT
    MakeSprite()
    ddx=-5
    ddy=0
    
    While "True"
      For i=1 To 5
        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)
      EndFor
      If Shapes.GetLeft(ell[1])<-200 Then 
        moveright()
      EndIf
      If Shapes.GetLeft(ell[1])>1200 then   'WhT
        ddx=-ddx                            'WhT
      EndIf                                 'WhT
      Program.Delay(20)
    endwhile
    Sub KeyD                                'WhT
      key=GraphicsWindow.LastKey             'WhT
      If key="S" or key="W" Or key="A" Or key="P" then    'WhT
        ddx=-ddx                             'WhT
      EndIf                                  'WhT   
    EndSub                                   'WhT
    
    Sub moveright
      el1y=shapes.GetTop(ell[1])
      ddy= Math.GetRandomNumber(Math.Abs(300-el1y))-el1y
      ddx=-ddx                               'WhT
      For i=1 To 5
        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
      EndFor
      ddy=0
    EndSub
    
    Sub MakeSprite
      ' 1 Rectangle
      GraphicsWindow.BrushColor="darkgoldenrod"
      rec[1] =  Shapes.AddRectangle(100,22)  '<--  body
      Shapes.Move(rec[1], 400,120)
      ' 5 Ellipses
      GraphicsWindow.BrushColor="purple"
      ell[1] =  Shapes.AddEllipse(70,70)
      Shapes.Move(ell[1], 500,95)
      GraphicsWindow.BrushColor="cyan"
      ell[2] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[2], 524,128)
      GraphicsWindow.BrushColor="cyan"
      ell[3] =  Shapes.AddEllipse(30,20)
      Shapes.Move(ell[3], 524,102)
      GraphicsWindow.BrushColor="sienna"
      ell[4] =  Shapes.AddEllipse(60,6)
      Shapes.Move(ell[4], 360,122)
      GraphicsWindow.BrushColor="sienna"
      ell[5] =  Shapes.AddEllipse(60,6)
      Shapes.Move(ell[5], 360,136)
    EndSub
    


    Jan [ WhTurner ] The Netherlands

    • Proposed as answer by YLedEditor Monday, February 13, 2017 9:23 PM
    • Marked as answer by mussamaina Tuesday, February 14, 2017 5:57 AM
    Monday, February 13, 2017 4:26 PM
    Answerer
  • hello everybody a very good and simple program easy to understand and am busy with it from the moment recived it thankyou  with best wishes

              with love from mussa-maina
                                mahreen miangul

             


    • Edited by mussamaina Tuesday, February 14, 2017 1:15 PM spelling mistakes
    Tuesday, February 14, 2017 1:12 PM
  • hello every body program Car Image mussa- maina ID TCH804 drawing Sprite and another program with thanks to WhT Animation Car Image by S-W-A-T ID ZWZ092  your program was perfect in my program the sprite goes out of the window
      with love from mussa maina

    Wednesday, February 15, 2017 12:39 PM
  • mussa maina  nice program.

    rec[9] is the top shape.

    el1y=shapes.GetTop(rec[9]) '<---------  ell[1] to rec[9]

    • Marked as answer by mussamaina Thursday, February 16, 2017 10:44 AM
    Wednesday, February 15, 2017 11:39 PM
    Answerer
  • ThankYou NaochanON from mussa-maina with Love

                                        mahreen miangul

    Thursday, February 16, 2017 10:43 AM
  • Hi Mussamaina !

    great program !

    program: ZWZ092-0

    I have a little bit modified your train, add big wheels, with piston and valve gear,

    Steam locomotive, like this one:


    • Edited by YLedEditor Friday, February 17, 2017 4:48 PM linking image to not repeat
    Thursday, February 16, 2017 12:51 PM
    Answerer
  • hello everybody i have added key B Event to hit the train by pressing Key B but now Keys S-W-A-T are not wrking and the triangles are not hiting the Sprite

    ' Moving Sprite on Window by Keys S-W-A-T
    ' mahreen miangul
    ' FebrUary 2017
    GraphicsWindow.Title = "S-W-A-T"
    GraphicsWindow.Width = "1200"
    GraphicsWindow.Height = "700"
    GraphicsWindow.top=0
    GraphicsWindow.left=0

    GraphicsWindow.BackgroundColor = "LightYellow"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.FontSize = 120
    GraphicsWindow.FontItalic = "True"

    GraphicsWindow.BrushColor = "Silver"    ' Text shadow color
    GraphicsWindow.DrawText(5, 5, "mahreen miangul!") ' Shadow position/text

    GraphicsWindow.BrushColor = "RosyBrown" ' Text color
    GraphicsWindow.DrawText(0, 0, "mahreen miangul!") ' Position and text
    GraphicsWindow.KeyDown=KeyDown           ' haroon rashid
    MakeSprite()
    ddx=-5
    ddy=0

     GraphicsWindow.KeyDown = OnKeyDown

    While "True"
      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
      Program.Delay(20)
    endwhile
    Sub KeyDown                               ' haroon rashid
      key=GraphicsWindow.LastKey              'WhT
      If key="S" or key="W" Or key="A" Or key="T" then    'hr
        ddx=-ddx                              'WhT
      EndIf                                   'WhT
    EndSub                                    'WhT

    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="deepskyblue"
      rec[1] =  Shapes.AddRectangle(240,150)  '<--  
      Shapes.Move(rec[1], 420,200)
      GraphicsWindow.brushcolor = "yellow"
      rec[2] =  Shapes.AddRectangle(400,45)  '<--  
      Shapes.Move(rec[2], 349,370)
      rec[3] =  Shapes.AddRectangle(88,250)  '<--  
      Shapes.Move(rec[3], 660,120)
      GraphicsWindow.brushcolor = "crimson"
      rec[4] =  Shapes.AddRectangle(30,70)  '<--  
      Shapes.Move(rec[4], 440,130)
      rec[5] =  Shapes.AddRectangle(50,70)  '<--  
      Shapes.Move(rec[5], 680,160)
      rec[6] =  Shapes.AddRectangle(70,30)  '<--  
      Shapes.Move(rec[6], 747,240)
      GraphicsWindow.brushcolor = "darkslategray"
      rec[7] =  Shapes.Addrectangle(400,20)
      Shapes.Move(rec[7], 349,350)
      rec[8] =  Shapes.Addrectangle(40,55)
      Shapes.Move(rec[8], 310,390)
      rec[9] =  Shapes.Addrectangle(80,20)
      Shapes.Move(rec[9], 415,110)
      rec[10] =  Shapes.Addrectangle(140,20)
      Shapes.Move(rec[10], 630,110)
      rec[11] =  Shapes.Addrectangle(20,70)
      Shapes.Move(rec[11], 800,220)


      ' 5 Ellipses
      GraphicsWindow.BrushColor="yellow"
      ell[1] =  Shapes.AddEllipse(50,50)
      Shapes.Move(ell[1], 355,400)
      ell[2] =  Shapes.AddEllipse(50,50)
      Shapes.Move(ell[2], 430,400)
      ell[3] =  Shapes.AddEllipse(120,120)
      Shapes.Move(ell[3], 520,335)
      ell[4] =  Shapes.AddEllipse(120,120)
      Shapes.Move(ell[4], 650,335)
      ' 2 triangles
     GraphicsWindow.BrushColor="crimson"
      tri[1] =  Shapes.Addtriangle(350,350,418,200,420,350)
      Shapes.Move(tri[1], 0,0)
      tri[2] =  Shapes.Addtriangle(310,390,350,350,350,390,)
      Shapes.Move(tri[2], 0,0)

        GraphicsWindow.BrushColor="darkred"
       tri[3] =  Shapes.Addtriangle(585,405,585,420,450,390)
       Shapes.Move(tri[3], 0,0)

         GraphicsWindow.BrushColor="darkblue"
       tri[4] =  Shapes.Addtriangle(350,445,230,445,350,385)
       Shapes.Move(tri[4], 0,0)

      ' piston cylinder
        GraphicsWindow.BrushColor="darkred"
       rec[12] =  Shapes.Addrectangle(150,20)
       Shapes.Move(rec[12], 585,405)

       GraphicsWindow.BrushColor="darkred"
       rec[13] =  Shapes.Addrectangle(90,30)
       Shapes.Move(rec[13], 360,380)
     EndSub

     Sub OnKeyDown
      key= GraphicsWindow.LastKey
      BC=graphicswindow.GetRandomColor()
      GraphicsWindow.brushcolor=BC
      ball = Shapes.Addtriangle(50,50,80,20,110,50)
      Shapes.Move(ball,577, 700)
        If key = "B" then
               Shapes.animate(ball, 600, -100,3000)   
       EndIf
       key=""
     EndSub

                 with love from mussa-maina---------------mahreen miangul

                   
    Thursday, February 16, 2017 4:50 PM
  • Hi !

    my update was for to add some shapes , 2 big wheels and piston.

    version: ZWZ092-0

    and then NaochanON add this version to correct this:

    rec[9] is the top shape.

    el1y=shapes.GetTop(rec[9]) '

    version: ZWZ092-1

    so use the last version: ZWZ092-1

    Thursday, February 16, 2017 5:38 PM
    Answerer
  • You can only have one subroutine for KeyDown. In this sub, test for S W A P and B to execute the right part.

    You have no detection if the triangle is in the region of the train.


    Jan [ WhTurner ] The Netherlands



    Thursday, February 16, 2017 6:08 PM
    Answerer
  • mussa-maina    how about this. 

    If "B" press ball  moves to top, if ball hits tri[4](front of train), train stops.

    ball added  when ball  frame out.

      

    ZWZ092-3  '<----* continuously works.



    • Edited by NaochanONEditor Friday, February 17, 2017 3:13 AM
    • Marked as answer by mussamaina Friday, February 17, 2017 11:15 AM
    Friday, February 17, 2017 3:08 AM
    Answerer
  • version :  ZWZ092-4

    Hello !
    Here I wanted to change the colors of the train in order to reproduce the colors black, gray, red photo of the train found on Wikipedia.

    It's a try! :)

    Friday, February 17, 2017 4:47 PM
    Answerer
  • hello everybody Alphabetical Face ID QWR127 the ears are not comming very nice

    with love from mussa-maina

    Tuesday, February 21, 2017 11:47 AM
  •  program S-W-A-T ID GDC622 keys S-W-A-T are moving the sprite left right keys S-W should move the sprite left right and the sprite should be moved up down by keys A-T any help will be grate with thanks

        mahreen miangul                                                                mussa-maina

    Wednesday, February 22, 2017 11:32 AM
  • mussamaina,

    You should not ask the same question in two topics, that is confusing.

    In one of the previous topics about this progran I showed you how to add the key "B" to the program. You should do the same for the keys S W A T with for each key a different action ( left/right/up/down. )

    YOU can do it !!


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Wednesday, February 22, 2017 12:06 PM
    • Proposed as answer by YLedEditor Wednesday, February 22, 2017 10:27 PM
    Wednesday, February 22, 2017 12:05 PM
    Answerer
  • hello with regards the problem is i dont no 20% of  progrmming like you or i wold not have been on msb forum as a learner instead i would have been teaching programming through the net and would have been been a good teacher
    nice and simple tutorials only are needed  with thanks and best wishes       mahreen miangul
    Thursday, February 23, 2017 11:57 AM
  • This little program gives an explanation on how to use the GraphisWindow.KeyDown.

    You can also use it to find the names of all the keys for use in your program.

    You can find more hints in chapter 3.4 of  https://social.technet.microsoft.com/wiki/contents/articles/16982.small-basic-curriculum-online.aspx

    ' Explanation for the use of  GraphicsWindow.KeyDown
    '   WhTurner  2017-02-24
    
    TextWindow.Left=700
    GraphicsWindow.Left=50
    GraphicsWindow.KeyDown=KeyDown
    GraphicsWindow.DrawText(100,100,"Press some keys. The TextWndow shows the value")
    GraphicsWindow.DrawText(100,150,"   Press Esc to end the program")
    While "True"
      Program.Delay(100)
    EndWhile 
    
    Sub Keydown
      key= GraphicsWindow.LastKey
      If key="A" Then 
        ' commands to execute when key A is pressed
      ElseIf key="B" Then
        ' commands to execute when key B is pressed
      ElseIf key="Left" Then
        '  commands to execute when key Left is pressed
      ElseIf key="Up" Then
        '  commands to execute when key Up is pressed
      ElseIf key="D1" Then
        '  commands to execute when key 1 on normal keyboard is pressed
      ElseIf key="NumPad1" Then
        '  commands to execute when key 1 on the keypad is pressed
      ElseIf key="Return" Then
        '  commands to execute when key Return is pressed
      ElseIf key="Add" Then
        '  commands to execute when key + is pressed
      ElseIf key="Escape" Then
        Program.End()
      EndIf
      TextWindow.WriteLine("key pressed: "+key)
    EndSub
      


    Jan [ WhTurner ] The Netherlands


    Friday, February 24, 2017 3:17 PM
    Answerer
  • hello you posted a program two three months back ID KQL710  was good but was simple  my code example is bellow 'mahreen miangul
    'Sprite Animation
    GraphicsWindow.Width = 1288
    GraphicsWindow.Height = 688
    GraphicsWindow.BackgroundColor = "rosybrown"

    ' Trees Data
    shape_init()  '  <---------   all shape data is input here!!
    For M=1 to 6 '  <--------- you make 5 Cycles
      ss=s[M]    '  <--------- scale 5 data
      N=1        '  <---------  shapes array index=1
      for i=1 To 12 '  <------ max shape number is 6
        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[N][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)
        ElseIf shape[N][i]["func"]="rect" Then
          shp[N][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)
        ElseIf shape[N][i]["func"]="tri" Then
          shp[N][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[N][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 500) '  <----  shx[],shY[]   M=1 to 5
        Shapes.Rotate(shp[N][i], Shape[N][i]["angle"])    
      EndFor
    endfor

    '-------------------   Add  shapes   -------------------------------------------------------------------------------------------------------------------------------------------

    '  Add  shapes  // (1)(2)(3)(4)(5)(6)(7), (8)HOUSE  ,(9)Crab , (10)Gorilla ,(11)Rocket ,u7)Hallowen , (8)House
    For N=1 to 14
      ss=s[N]
      for i=1 To 47 '  <------ max shape number is 47
        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[N][i] = Shapes.AddEllipse(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)
        ElseIf shape[N][i]["func"]="rect" Then
          shp[N][i] = Shapes.AddRectangle(shape[N][i]["width"]*ss, shape[N][i]["height"]*ss)
        ElseIf shape[N][i]["func"]="tri" Then
          shp[N][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[N][i], shape[N][i]["x"]*ss+shX[N], shape[N][i]["y"]*ss+shY[N], 500)
        Shapes.Rotate(shp[N][i], Shape[N][i]["angle"])    
      EndFor
    endfor

    ' shape Animation
    'GraphicsWindow.MouseDown=pngsave
    Shapes_Init()
    s = 1.1   '<----   scale  

    'Draw outline
    For i = 1 To Array.GetItemCount(shape)
      GraphicsWindow.PenColor =  shape[i]["pc"]        '<--------------  pen color
      If  shape[i]["func"]="ell" Then
        GraphicsWindow.DrawEllipse(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s)
      elseIf shape[i]["func"]="rect" Then
        GraphicsWindow.DrawRectangle(shape[i]["x"]*s, shape[i]["y"]*s, shape[i]["Width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="tri" then
        GraphicsWindow.DrawTriangle(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s,shape[i]["x"]*s+shape[i]["x3"]*s, shape[i]["y"]*s+shape[i]["y3"]*s )
      elseif shape[i]["func"]="line" then
        GraphicsWindow.Drawline(shape[i]["x"]*s+shape[i]["x1"]*s, shape[i]["y"]*s+shape[i]["y1"]*s,shape[i]["x"]*s+shape[i]["x2"]*s, shape[i]["y"]*s+shape[i]["y2"]*s )
      EndIf
      Program.Delay(30)
    EndFor

    '  Add shapes for solid color
    GraphicsWindow.PenWidth = 0
    For i = 1 To Array.GetItemCount(shape)
      GraphicsWindow.BrushColor = shape[i]["bc"]      ' <-------------- brush color
      If shape[i]["func"]="ell" Then  
        shp[i] = Shapes.AddEllipse(shape[i]["width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="rect" Then  
        shp[i] = Shapes.AddRectangle(shape[i]["width"]*s, shape[i]["height"]*s)
      ElseIf shape[i]["func"]="tri" Then
        shp[i] = Shapes.Addtriangle(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s, shape[i]["x3"]*s, shape[i]["y3"]*s)
      ElseIf shape[i]["func"]="line" Then
        shp[i] = Shapes.Addline(shape[i]["x1"]*s, shape[i]["y1"]*s,shape[i]["x2"]*s, shape[i]["y2"]*s)
      EndIf
     
      ' Animate and Rotate
      Shapes.Animate(shp[i], shape[i]["x"]*s, shape[i]["y"]*s, 500)
      If Shape[i]["angle"]>0 Then
        Shapes.Rotate(SHP[i], Shape[i]["angle"])        ' <--------------  rotating angle
      EndIf
      Program.Delay(50)
    EndFor

    Sub Shapes_Init
      ' Shape Data
      shape[1] = "func=ell;x=475;y=167;width=30;height=32;bc=bisque;tag=ear"'left
      shape[2] = "func=ell;x=572;y=167;width=30;height=32;bc=bisque;tag=ear"'right
      shape[3] = "func=ell;x=488;y=145;width=100;height=100;bc=darkgoldenrod;tag=face"
      shape[4] = "func=ell;x=515;y=165;width=10;height=10;bc=blue;tag=eye"'left
      shape[5] = "func=ell;x=555;y=165;width=10;height=10;bc=blue;tag=eye"'right
      shape[6] = "func=ell;x=533;y=175;width=10;height=30;bc=sienna;tag=nose"
      shape[7] = "func=ell;x=522;y=210;width=30;height=10;bc=pink;tag=mouth"
      shape[8] = "func=rect;x=515;y=240;width=50;height=100;bc=sienna;tag=body"
      shape[9] = "func=tri;x=0;y=0;x1=500;y1=150;x2=540;y2=100;x3=580;y3=150;bc=purple;angle=0;pw=0;tag=head"
      shape[10] = "func=rect;x=520;y=340;width=8;height=50;bc=yellow;Leg1"
      shape[11] = "func=rect;x=550;y=340;width=8;height=50;bc=yellow;Leg2"
      shape[13] = "func=rect;x=463;y=270;width=50;height=8;bc=green;tag=mouth"'hand1
      shape[12] = "func=rect;x=565;y=270;width=50;height=8;bc=green;tag=mouth"'hand2


    endsub
     
      'Animate shapes - eyes and mouth
    dZ = 0.1
    zoom = 1
    While 0=0
      zoom = zoom - dZ
      For i = 1 To Array.GetItemCount(shape)
        If Array.ContainsValue(shape[i] "eye") Then
          Shapes.Zoom(shp[i] 1 zoom)
        ElseIf Array.ContainsValue(shape[i] "mouth") Then
          Shapes.Zoom(shp[i] zoom zoom)
        EndIf
      EndFor
      If zoom = 0 Or zoom = 1 Then
        dZ = -dZ
      EndIf
      Program.Delay(100)
    EndWhile


    Sub shape_init
      ' Tree Data
      'Tree 1
      s[1]=.8
      shX[1] = 10
      shY[1] = 188
    shape[1][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2"
    shape[1][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2
    shape[1][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2
    shape[1][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2
    shape[1][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2
    shape[1][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2
    shape[1][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2
    shape[1][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2
    shape[1][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2
    shape[1][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
    shape[1][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
    shape[1][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
    shape[1][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      'Tree 2
      s[2]=.8
      shX[2] = 160
      shY[2] = 180
      'Tree 3
      s[3]=.8
      shX[3] = 655
      shY[3] = 112
      'Tree 4
      s[4]=.8
      shX[4] = 822
      shY[4] = 88
      'Tree 5
      s[6]=.8
      shX[6] = 988
      shY[6] = 102
      'Tree 6
      s[5]=.8
      shX[5] = 1100
      shY[5] = 122
      ' shape 7
     
      endsub

    if you think i am right and  have understood your program then move the shape by key S or Key A behind the tree please be simple as your previous program with Thanks mussa-maina

                                  mahreen miangul

    Saturday, February 25, 2017 4:33 PM
  • how about this?

    GraphicsWindow.Width = 1288
    GraphicsWindow.Height = 688
    GraphicsWindow.BackgroundColor = "rosybrown"
    GraphicsWindow.KeyDown=Onkeydown

    shape_init() '   Human and Tree shape data
    N=0
    M=0
    shapes_add() '  Human shapes
    N=1
    For M=1 to 6
      shapes_add()  '  Tree shapes
    endfor

    'Animate shapes - eyes and mouth
    dZ = 0.1
    zoom = 1
    ddx=4
    While 0=0
      zoom = zoom - dZ
      For i = 1 To Array.GetItemCount(shape[0])
        If Array.ContainsValue(shape[0][i], "eye") Then
          Shapes.Zoom(shp[0][i], 1, zoom)
        ElseIf Array.ContainsValue(shape[0][i], "mouth") Then
          Shapes.Zoom(shp[0][i], zoom, zoom)
        EndIf
        shapes.Move(shp[0][i],shapes.GetLeft(shp[0][i])+ddx,shapes.Gettop(shp[0][i]))
      EndFor
      If zoom = 0 Or zoom = 1 Then
        dZ = -dZ
      EndIf
      Program.Delay(100)
    EndWhile

    Sub Onkeydown
      key= GraphicsWindow.LastKey
      If key="S" or key="A"Then
        ddx=-ddx
      EndIf
    EndSub

    Sub shapes_add
      ss=s[M]    '  <--------- scale  data
      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)
        EndIf
        Shapes.Animate(shp[M][i], shape[N][i]["x"]*ss+shX[M], shape[N][i]["y"]*ss+shY[M], 500)
      EndFor
    EndSub

    Sub shape_init
      ' Human   Data
      shape[0][1] = "func=ell;x=475;y=167;width=30;height=32;bc=bisque;tag=ear"'left
      shape[0][2] = "func=ell;x=572;y=167;width=30;height=32;bc=bisque;tag=ear"'right
      shape[0][3] = "func=ell;x=488;y=145;width=100;height=100;bc=darkgoldenrod;tag=face"
      shape[0][4] = "func=ell;x=515;y=165;width=10;height=10;bc=blue;tag=eye"'left
      shape[0][5] = "func=ell;x=555;y=165;width=10;height=10;bc=blue;tag=eye"'right
      shape[0][6] = "func=ell;x=533;y=175;width=10;height=30;bc=sienna;tag=nose"
      shape[0][7] = "func=ell;x=522;y=210;width=30;height=10;bc=pink;tag=mouth"
      shape[0][8] = "func=rect;x=515;y=240;width=50;height=100;bc=sienna;tag=body"
      shape[0][9] = "func=tri;x1=500;y1=150;x2=540;y2=100;x3=580;y3=150;bc=purple;angle=0;pw=0;tag=head"
      shape[0][10] = "func=rect;x=520;y=340;width=8;height=50;bc=yellow;Leg1"
      shape[0][11] = "func=rect;x=550;y=340;width=8;height=50;bc=yellow;Leg2"
      shape[0][12] = "func=rect;x=565;y=270;width=50;height=8;bc=green;tag=mouth"'hand2
      shape[0][13] = "func=rect;x=463;y=270;width=50;height=8;bc=green;tag=mouth"'hand1
      '  Tree data
      shape[1][1]="func=ell;X=0;Y=188;width=200;height=140;bc=Green;pc=Green;pw=2"
      shape[1][2]="func=ell;X=10;Y=277;width=80;height=60;bc=Green;pc=Green;pw=2
      shape[1][3]="func=ell;X=4;Y=255;width=80;height=70;bc=Green;pc=Green;pw=2
      shape[1][4]="func=ell;X=0;Y=191;width=80;height=80;bc=Green;pc=Green;pw=2
      shape[1][5]="func=ell;X=40;Y=177;width=80;height=80;bc=Green;pc=Green;pw=2
      shape[1][6]="func=ell;X=100;Y=177;width=120;height=80;bc=Green;pc=Green;pw=2
      shape[1][7]="func=ell;X=130;Y=240;width=100;height=80;bc=Green;pc=Green;pw=2
      shape[1][8]="func=ell;X=130;Y=260;width=100;height=80;bc=Green;pc=Green;pw=2
      shape[1][9]="func=rect;X=80;Y=322;width=60;height=100;bc=saddlebrown;pc=darkslatgray;pw=2
      shape[1][10]="func=tri;X1=140;Y1=262;X2=110;Y2=322;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      shape[1][11]="func=tri;X1=140;Y1=262;X2=170;Y2=262;X3=140;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      shape[1][12]="func=tri;X1=50;Y1=262;X2=96;Y2=262;X3=80;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      shape[1][13]="func=tri;X1=96;Y1=262;X2=80;Y2=322;X3=126;Y3=322;bc=saddlebrown;pc=darkslatgray;pw=0
      '  scale and   start XY position
      s   = "0=1.1;1=.8;2=.8;3=.8;4=.8;5=.8;6=.8"
      shX = "0=0;1=10;2=160;3=655;4=822;5=988;6=1100"
      shY = "0=0;1=188;2=180;3=112;4=88;5=102;6=122"
    endsub

    • Proposed as answer by YLedEditor Sunday, February 26, 2017 4:02 PM
    • Marked as answer by mussamaina Monday, February 27, 2017 12:04 PM
    Sunday, February 26, 2017 5:05 AM
    Answerer
  • I see no use for the use of two keys (A and S) for the same purpose. It is better to use A for left and S for right:

    Sub Onkeydown
      key= GraphicsWindow.LastKey
      If key="S" Then
        ddx=4
      ElseIf key="A"Then
        ddx=-4
      ElseIf key="Space" Then
        ddx=0
    EndIf 
    EndSub


    Jan [ WhTurner ] The Netherlands


    • Edited by WhTurner33Editor Sunday, February 26, 2017 12:06 PM added stop bY Space
    • Proposed as answer by YLedEditor Sunday, February 26, 2017 4:02 PM
    • Marked as answer by mussamaina Monday, February 27, 2017 12:04 PM
    Sunday, February 26, 2017 11:34 AM
    Answerer
  • NaochanON version with WhTurner suggestion

    program: BGB172

    • Marked as answer by mussamaina Monday, February 27, 2017 12:04 PM
    Sunday, February 26, 2017 4:02 PM
    Answerer