home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / logo / labybug / target.bug < prev    next >
Text File  |  1989-12-31  |  1KB  |  71 lines

  1. to "poly :d :a
  2. forward :d
  3. right :a
  4. poly :d :a
  5. end
  6.  
  7. to "ask  
  8. print [Can you hit the target?] wait 20
  9. print [Give me an x- and a y- coordinate.]
  10. wait 20
  11. print [x = ] make "x1 request
  12. print [y = ] make "y1 request
  13. test and :x1 > abs 250 :y1 < abs 150
  14. iftrue print [Your number is too big. Try again.] wait 20 ask
  15. iffalse pd st setxy :x1 :y1
  16. if or ( :x1 > ( :x + 5 ) ) ( :x1 < ( :x - 5 ) ) pu home pd ask
  17. if or ( :y1 > ( :y + 5 ) ) ( :y1 < ( :y - 5 ) ) pu home pd ask
  18. cheers
  19. end
  20.  
  21. to "and   :a :b
  22. if :a = "true [output :b = "true]
  23. output "false
  24. end
  25.  
  26. to "or   :a :b
  27. if :a = "true [output "true]
  28. output :b = "true
  29. end
  30.  
  31. to "wait   :seconds
  32. tone 32000  20 * :seconds
  33. tone 32000 1  ;above times the wait; this makes us wait
  34. end
  35.  
  36. to "target   
  37. pu ht
  38. setxy ( random 350 ) - 225 ( random 250 ) - 100
  39. make "x xcor + 6
  40. make "y ycor
  41. pd
  42. repeat 36 [fd 1 rt 10]
  43. pu home st
  44. end
  45.  
  46. to "game  
  47. draw cleartext
  48. target
  49. ask
  50. end
  51.  
  52. to "cheers  
  53. cleartext
  54. repeat 24 [print [Congratulations!]]
  55. wait 10
  56. print1 [Want to play again? (Y/N) ]
  57. make "ans request
  58. if :ans = "y [game]
  59. if :ans = "n [print [Bye for now!]]
  60. end
  61.  
  62. make "x "'5
  63. make "y "'17
  64. make "x1 "'5
  65. make "y1 "'15
  66. uest
  67. if :ans = "y [game]
  68. if :ans = "n [print [Bye for now!]]
  69. end
  70.  
  71. make "