Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. View.Set ("graphics:1024;768,position:center;center,nobuttonbar,offscreenonly")
  2. var circlex, circley, mousex, mousey, button, shootertimer,direcnum,soundcounter : int
  3. var now, last, count : int := 10
  4. var direction : string := "right"
  5. var background : string := "mountain_scenery_-1742.jpg"
  6. var picID : int
  7. var picx, picy,i,score : int := 0
  8. var scored:string
  9. var stillgood, timeset, buttongood : boolean := false
  10. var chars : array char of boolean
  11. shootertimer := maxint
  12. stillgood:=true
  13. soundcounter:=1
  14. picID := Pic.FileNew (background)
  15. Pic.Draw (picID, picx, picy, picCopy)
  16. randint (circlex, 100, 980)
  17. randint (circley, 100, 700)
  18.  
  19. process DoMusic
  20. Music.PlayFile ("gunshotgood.mp3")
  21. end DoMusic
  22.  
  23. process Hit
  24. locate(15,30)
  25. put "BAM!"
  26. end Hit
  27.  
  28.  
  29. procedure drawtarget (circlex, circley : int)
  30. drawfilloval (circlex, circley, 30, 30, 40)
  31. drawfilloval (circlex, circley, 25, 25, 0)
  32. drawfilloval (circlex, circley, 20, 20, 40)
  33. drawfilloval (circlex, circley, 15, 15, 0)
  34. drawfilloval (circlex, circley, 10, 10, 40)
  35. end drawtarget
  36.  
  37.  
  38.  
  39.  
  40. loop
  41. Mouse.Where (mousex, mousey, button)
  42. drawoval (mousex, mousey, 5, 5, green)
  43. drawoval (mousex, mousey, 6, 6, green)
  44. drawline (mousex - 5, mousey, mousex + 5, mousey, green)
  45. drawline (mousex, mousey - 5, mousex, mousey + 5, green)
  46. if direction = "right" then
  47. i := i + 5
  48. elsif direction = "left" then
  49. i := i - 5
  50. end if
  51. Pic.Draw (picID, picx, picy, picCopy)
  52. drawtarget (circlex + i, circley)
  53. Mouse.Where (mousex, mousey, button)
  54. drawoval (mousex, mousey, 5, 5, green)
  55. drawoval (mousex, mousey, 6, 6, green)
  56. drawline (mousex - 5, mousey, mousex + 5, mousey, green)
  57. drawline (mousex, mousey - 5, mousex, mousey + 5, green)
  58. delay (20)
  59.  
  60.  
  61. if button = 1 and stillgood = true then
  62. drawfilloval (mousex, mousey, 2, 2, yellow)
  63. if Time.Elapsed - shootertimer >= 1000 then
  64. stillgood := false
  65. end if
  66. if timeset = false then
  67. shootertimer := Time.Elapsed
  68. fork DoMusic
  69. timeset := true
  70. end if
  71. if mousex > circlex + i - 10 and mousex < circlex + i + 10 and mousey > circley - 10 and mousey < circley + 10 and stillgood = true then
  72. randint (circlex, 100, 980)
  73. randint (circley, 100, 700)
  74. i := 0
  75. score:=score+1
  76. randint(direcnum,1,2)
  77. if direcnum=1 then
  78. direction:="right"
  79. else
  80. direction:="left"
  81. end if
  82. end if
  83. end if
  84. if button=0 then
  85. stillgood:=true
  86. shootertimer:=maxint
  87. timeset:=false
  88. end if
  89.  
  90.  
  91. View.Update
  92. if i >= maxx - circlex - 30 then
  93. direction := "left"
  94. elsif i <= 0 - circlex + 30 then
  95. direction := "right"
  96. end if
  97. now := Time.Elapsed
  98. if (now - last >= 1000) then
  99. count := count - 1
  100. locate (1, 1)
  101. last := now
  102. if count = 0 then
  103. cls
  104. exit
  105. end if
  106. end if
  107. Input.KeyDown (chars)
  108. if chars (chr (27))
  109. then
  110. cls
  111. exit
  112. end if
  113. end loop
  114.  
  115.  
  116.  
  117.  
  118.  
  119. scored:=intstr(score)
  120. var font1,font2: int
  121. font2:=Font.New("Arial:80:bold")
  122. font1 := Font.New ("sans serif:30:bold")
  123. assert font1 > 0
  124. Font.Draw ("GAME OVER",180,600,font2,black)
  125. Font.Draw ("Your Score is: ", 320, 400, font1, black)
  126. Font.Draw (scored, 610, 398, font1, red)
  127. Font.Free (font1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement