Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. GraphicsWindow.Show()
  2. GraphicsWindow.Width=500
  3. GraphicsWindow.Height=500
  4. GraphicsWindow.Title = "Graphics Window"
  5. TextWindow.Show()
  6. shape1 = Shapes.AddRectangle(50, 25)
  7. x=100
  8. y=125
  9. vx=0
  10. vy=0
  11. ax=0
  12. ay=0
  13. Shapes.Move(shape1, x, y)
  14. s=0
  15. GraphicsWindow.keydown=premuto 'associo alla pressione di un qualunque tasto la subroutine premuto
  16. GraphicsWindow.KeyUp=lasciato
  17. fine=0
  18. While fine=0
  19. vx=vx+ax*1
  20. vy=vy+ay*1
  21. x=x+vx*1
  22. y=y+vy*1
  23. Shapes.Move(shape1, x, y)
  24. Program.Delay(200)
  25. TextWindow.Write(ax)
  26. TextWindow.Write(",")
  27. TextWindow.Write(vx)
  28. TextWindow.Write(",")
  29. TextWindow.WriteLine(x)
  30. endwhile
  31.  
  32. Sub premuto
  33.  
  34. If GraphicsWindow.LastKey = "A" then
  35. ax=-1
  36. EndIf
  37. If GraphicsWindow.LastKey = "D" then
  38. ax=1
  39. EndIf
  40. EndSub
  41.  
  42. Sub lasciato
  43. If GraphicsWindow.LastKey = "A" then
  44. ax=0
  45. EndIf
  46. If GraphicsWindow.LastKey = "D" then
  47. ax=0
  48. EndIf
  49. EndSub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement