Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GraphicsWindow.Show()
- GraphicsWindow.Width=500
- GraphicsWindow.Height=500
- GraphicsWindow.Title = "Graphics Window"
- TextWindow.Show()
- shape1 = Shapes.AddRectangle(50, 25)
- x=100
- y=125
- vx=0
- vy=0
- ax=0
- ay=0
- Shapes.Move(shape1, x, y)
- s=0
- GraphicsWindow.keydown=premuto 'associo alla pressione di un qualunque tasto la subroutine premuto
- GraphicsWindow.KeyUp=lasciato
- fine=0
- While fine=0
- vx=vx+ax*1
- vy=vy+ay*1
- x=x+vx*1
- y=y+vy*1
- Shapes.Move(shape1, x, y)
- Program.Delay(200)
- TextWindow.Write(ax)
- TextWindow.Write(",")
- TextWindow.Write(vx)
- TextWindow.Write(",")
- TextWindow.WriteLine(x)
- endwhile
- Sub premuto
- If GraphicsWindow.LastKey = "A" then
- ax=-1
- EndIf
- If GraphicsWindow.LastKey = "D" then
- ax=1
- EndIf
- EndSub
- Sub lasciato
- If GraphicsWindow.LastKey = "A" then
- ax=0
- EndIf
- If GraphicsWindow.LastKey = "D" then
- ax=0
- EndIf
- EndSub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement