Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Level 3 Tutorial Should Work #135

Open
Caseysch opened this issue Jul 27, 2020 · 2 comments
Open

Level 3 Tutorial Should Work #135

Caseysch opened this issue Jul 27, 2020 · 2 comments
Labels
type/ux Related to the editor/user experience

Comments

@Caseysch
Copy link
Contributor

Caseysch commented Jul 27, 2020

' Lesson 3: getting set up
GraphicsWindow.BrushColor = "Red"
GraphicsWindow.PenColor = "White"
paddle = Shapes.AddRectangle(120, 12)
Shapes.Move(paddle, 0, GraphicsWindow.Height - 12)

GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
ball = Shapes.AddEllipse(16, 16)
GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor()
 
' Lesson 4: let's get moving
GraphicsWindow.MouseMove = WhenMouseMoves
Sub WhenMouseMoves
  mouseX= GraphicsWindow.MouseX
  Shapes.Move(paddle, mouseX-60, GraphicsWindow.Height-12)
EndSub
 
' Lesson 5&6: making the ball move
moveX = 1
moveY = 1
stillPlaying = "True"
While stillPlaying = "True"
  x= x + moveX
  y= y + moveY
  Shapes.Move(ball, x, y)
  Program.Delay(5) 'Make this number bigger to make the ball move slower
 
  If(y > GraphicsWindow.Height) Then
    GraphicsWindow.ShowMessage("You Lose", "Paddle")
    stillPlaying= "False"
  EndIf
 
  ' Lesson 6: make it bounce
  paddleX= Shapes.GetLeft(paddle)
  If(y >= GraphicsWindow.Height - 26 and x >= paddleX and x <= paddleX + 120) Then
    moveY= -moveY
  EndIf
 
  If(y < 0) Then
    moveY= -moveY
  EndIf
 
  If(x >= GraphicsWindow.Width - 16 or x < 0) Then
    moveX= -moveX
  EndIf
EndWhile
@Caseysch Caseysch added the type/ux Related to the editor/user experience label Jul 27, 2020
@Caseysch
Copy link
Contributor Author

Looks like the same bug as #125 , this code doesn't move the paddle:

paddle = Shapes.AddRectangle(120, 12)

GraphicsWindow.MouseMove = WhenMouseMoves
Sub WhenMouseMoves
  Shapes.Move(paddle, GraphicsWindow.MouseX-60, GraphicsWindow.Height-12)
EndSub

stillPlaying = "True"
While stillPlaying = "True"
  Program.Delay(5)
EndWhile

@nonkit
Copy link
Member

nonkit commented Aug 10, 2020

Yes I think so. Following code runs properly. It's very similar case of issue #125.

paddle = Shapes.AddRectangle(120, 12)

GraphicsWindow.MouseMove = WhenMouseMoves
Sub WhenMouseMoves
  Shapes.Move(paddle, GraphicsWindow.MouseX-60, GraphicsWindow.Height-12)
EndSub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/ux Related to the editor/user experience
Projects
None yet
Development

No branches or pull requests

3 participants