home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / riblitzlibs.lha / riblitzlibs / zonejoy / ZoneTest.asc < prev   
Encoding:
Text File  |  1980-06-20  |  1.8 KB  |  54 lines

  1. ;########################
  2. ;# Example 1.2 ZoneTest #
  3. ;########################
  4. ; By Steven Matty
  5. ;
  6. ; This setsup 12 zones with either cicles or boxes around them
  7. ; If the dot comes into contact with one, the screen will flash
  8. ; Turn the lights down for a nice strobe :)
  9.  
  10. VWait 40             ; Wait for disk activity to finish
  11. BLITZ                ; BLITZ!
  12. BitMap 0,320,DispHeight,1    ; Open a 1bitplane bitmap 320x???
  13. BitMapOutput 0
  14. Use BitMap 0
  15. Slice 0,44,320,DispHeight,$fff8,1,8,2,320,320   ; And a slice
  16. Show 0                                          ; Show it
  17. PalRGB 0,1,15,15,15                             ; Set ink 1 to white
  18. Use Palette 0                                   ; Use the palette
  19. ZoneInit 0,12                                   ; Clear Zones 0-12
  20. For n=0 To 12                                   ;
  21. x2.w=Int(Rnd(30))+5                             ;
  22. y2.w=Int(Rnd(30))+5                             ;
  23. x.w=Int(Rnd(320-(x2*2)))                        ;
  24. y.w=Int(Rnd(DispHeight-(y2*2)))                 ;
  25. If x2>=320 Then x2=319                          ;
  26. If y2>=DispHeight Then y2=DispHeight-1          ;
  27. g=Int(Rnd(2))                                   ; Circle or Box
  28. If g=0
  29.   Box x,y,x+x2,y+y2,1
  30.   SetZone n,x,y,x+x2,y+y2                       ; Set Box zone
  31. Else
  32.   Circle x,y,x2,1
  33.   SetZone n,x,y,x2                              ; Set Circular zone
  34. End If
  35. Next n
  36. Mouse On                                        ; Mouse ON
  37. Repeat
  38. xo.w=xm.w
  39. yo.w=ym.w
  40. xm.w=MouseX
  41. ym.w=MouseY
  42. If xo<>xm OR yo<>ym
  43.   Plot xo,yo,0                                  ; Update pointer
  44.   Plot xm,ym,1
  45. EndIf
  46.  
  47. zn.w=Zone(xm,ym)                                ; Are we in the ZONE?
  48. If zn<>-1 Then Locate 0,0:NPrint "Zone ",zn," hit!" ; Yes!
  49. If zn=-1 Then Locate 0,0:NPrint"            "          ; No!
  50. VWait
  51. Until Joyb(0)                                  ; Until mousebutton
  52. AMIGA
  53. End
  54.