Just wated to test something

TheDakKnight 1 Reputation point
2021-01-13T13:53:48.457+00:00

Test123 Test123 Test123 Test123

Small BASIC
Small BASIC
A programming language created by Microsoft that serves a stepping stone for beginners from block-based coding languages to more complex text-based languages.
280 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. WhTurner 1,611 Reputation points
    2021-01-13T14:32:29.653+00:00

    THe following program shows a ball bouncing on the left wall.

    GraphicsWindow.FillRectangle(0,0,20,400)
    GraphicsWindow.BrushColor="Red"
    GraphicsWindow.PenColor="Red"
    ball=Shapes.AddEllipse(20,20)
    x=300
    y=400
    dx=1
    Controls.Move(ball,x,y)
    for i=1 to 400
    x=x-dx
    y=y-1
    if x<20 Then
    dx=-dx
    EndIf
    Controls.Move(ball,x,y)
    Program.Delay(10)
    EndFor


  2. WhTurner 1,611 Reputation points
    2021-01-13T15:55:54.853+00:00

    What problems?
    You have to detect when the ball reaches the top and change the direction of the ball to down (y=-y)


  3. WhTurner 1,611 Reputation points
    2021-01-13T16:30:59.573+00:00

    Ceiling: if y<12 reverse dy

    Rifgt wall; if x> (diameter ball + x coordinate right wall) reverse dx

    For the paddlew if y> (siameter ball + y coordinate paddle) AND x within left and right coordinates paddle

    0 comments No comments

  4. WhTurner 1,611 Reputation points
    2021-01-13T18:18:27.263+00:00

    You should
    replace y=y-1 by y=y-dy
    and y=-dy by y=-y

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.