Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. Import mojo
  2.  
  3.  
  4. Global tipo_pulsante: int[20]
  5. Global che_click=0
  6. Global fine_gioco=0
  7.  
  8. Class Game Extends App
  9.  
  10. Method OnCreate()
  11. SetUpdateRate 30
  12.  
  13. End
  14.  
  15. Method OnRender()
  16. Cls
  17.  
  18. For Local x=0 To 2
  19.  
  20. For Local y=0 To 2
  21.  
  22. Local numero: Int=x+y*3
  23.  
  24. Local xf:Float= DeviceWidth()
  25. Local yf:Float= DeviceHeight()
  26.  
  27. Local dime: Float= yf*.33333333
  28.  
  29. Local sposta_x=(xf-yf)*.5
  30.  
  31.  
  32. crea_pulsante(numero,sposta_x+dime*x,dime*y,dime,dime)
  33.  
  34. Next
  35. Next
  36.  
  37. controllo()
  38.  
  39. End
  40.  
  41. End
  42.  
  43. Function Main()
  44. New Game()
  45. End
  46.  
  47.  
  48.  
  49. Function crea_pulsante(num: Int,x: Int,y: Int,dx: Int,dy: Int)
  50.  
  51. SetColor 200,200,200
  52.  
  53. If (MouseX()>x And MouseX()<x+dx)
  54.  
  55. If (MouseY()>y And MouseY()<y+dy)
  56.  
  57. If (MouseDown(0) And fine_gioco=0)
  58. If (tipo_pulsante[num]=0)
  59.  
  60. tipo_pulsante[num]=che_click+1
  61.  
  62. che_click=1-che_click
  63.  
  64.  
  65. Endif
  66. endif
  67.  
  68.  
  69. SetColor 200,0,0
  70. Endif
  71.  
  72. endif
  73.  
  74.  
  75. DrawRect x+1,y+1,dx-2,dy-2
  76.  
  77.  
  78. SetColor 255,255,255
  79.  
  80. DrawRect x+3,y+3,dx-6,dy-6
  81.  
  82.  
  83. If tipo_pulsante[num]=1
  84.  
  85. SetColor 0,255,0
  86.  
  87. DrawOval x+15,y+15,dx-30,dy-30
  88.  
  89. SetColor 255,255,255
  90.  
  91. DrawOval x+17,y+17,dx-34,dy-34
  92.  
  93.  
  94. Endif
  95.  
  96. If tipo_pulsante[num]=2
  97.  
  98. SetColor 255,0,0
  99.  
  100. DrawLine x+15,y+15,x+dx-15,y+dy-15
  101. DrawLine x+dx-15,y+15,x+15,y+dy-15
  102.  
  103. Endif
  104.  
  105.  
  106.  
  107. End Function
  108.  
  109.  
  110. Function controllo()
  111.  
  112. fine_gioco=0
  113.  
  114. For Local g=1 To 2
  115.  
  116.  
  117.  
  118. For Local pos=0 To 2
  119.  
  120. If (tipo_pulsante[pos*3]=g and tipo_pulsante[pos*3+1]=g and tipo_pulsante[pos*3+2]=g )
  121.  
  122. fine_gioco=g
  123.  
  124. Endif
  125.  
  126. If (tipo_pulsante[0+pos]=g and tipo_pulsante[3+pos]=g and tipo_pulsante[6+pos]=g )
  127.  
  128. fine_gioco=g
  129.  
  130. Endif
  131.  
  132. Next
  133.  
  134. If (tipo_pulsante[0]=g and tipo_pulsante[4]=g and tipo_pulsante[8]=g )
  135.  
  136. fine_gioco=g
  137.  
  138. Endif
  139.  
  140.  
  141. If (tipo_pulsante[2]=g and tipo_pulsante[4]=g and tipo_pulsante[6]=g )
  142.  
  143. fine_gioco=g
  144.  
  145. Endif
  146.  
  147.  
  148. next
  149.  
  150. If fine_gioco>0
  151.  
  152. DrawText "Vince Giocatore "+fine_gioco,DeviceWidth/2,DeviceHeight/2,.5,.5
  153.  
  154. Endif
  155.  
  156.  
  157.  
  158. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement