This game made with NAALAA6.


 
TreasureHuntv2.zip TreasureHuntv2.zip
Size : 760.079 Kb
Type : zip

 visible:
 mx;my;column;row;rx;ry;spx;spy;event   
 zloop;zwait;hits;starsfound;score;miss;MouseDown
 fnt1;fnt2;snd1;snd2;sprite1;star
brd[20][20]
brd2[20][20]
rt[20][20]  
lf[20][20] 
tp[20][20] 
bt[20][20]  
hidden:
sprite1 = 1
star = 2
snd1 = 3
snd2 = 4
set redraw off
event = 1
set window 0, 0, 1200, 700
 create font 0, "arial", 24

proc Setup1
 
proc Setup2

rem  SetBuffer BackBuffer()
cls                                

 do
   set color 0,0,10

   wait 20
      cls
 

    if event = 2 then
       proc InputLogic
       proc PrintText
       proc  Logic1
       proc  UpdateBoard
       proc  DrawBoard
    endif
   if event = 1 then
     proc Menu
     create font 0, "arial", 16
     wait 500
   endif
    redraw
 until event = 3

  end

function start(a)
  rem qwerty
endfunc

procedure Setup1()
  a;b;c
  event = 1
  randomize time()
 
  a=0
  while a<31
  
   b = rnd(10) + 1
   c = rnd(10) + 1
   if brd[b][c] = 0 then a = a+1
   brd[b][c] = 1
  write b
  wend 
  hits = 0

endproc

procedure Setup2()

  load sound snd1,"Data\boink4.wav"
  load sound snd2,"Data\boink2.wav"

create image sprite1,54,54
create image star,54,54

      
        
set image star
set color 0,20,20
draw rect 0,0,54,54,1
   
set color 255,110,110
 rem center=27                                        
draw rect 23,23,9,9,1               
set color 180,180,255               
draw line 27,16,27,39
draw line 17,26,39,27
draw line 12,12,42,42
draw line 42,12,12,42

set image sprite1
    
set color 0,10,40                      
draw rect 0,0,54,54,1


set image primary
endproc

 procedure Menu()
    a = 1
 
    set color 180,180,255
    wln ; wln ; wln ; wln ; wln ; wln ; wln

    wln  "                       THIS IS THE GAME OF TREASURE HUNT "
    wln  "          Click on any square to uncover it. You lose points for misses and "
    wln  "          gain points for hits. Each square contains clues to where the treasure "
    wln  "          pieces are located. There are 30 pieces to find. "
    wln  "          Click mouse to start. "
    wln
    wln  "          http://rb23.yolasite.com "
    wln
 
    redraw

    while a = 1
      wait 20
      if mousebutton(0) then a = 2
    wend  
    write ; write ; wln a
    event = 2
    hits=0
endproc

procedure InputLogic()

    value = 0
           
    MouseDown = mousebutton(0,1)
    wait 100

    mx = mousex()                   
    my = mousey()
    rx = mx-190                      
    if rx<1 then rx=1
    column = rx/54+1                 
    if mx < 190 then column = 0
    if mx > 733 then column = 0
    ry=my-30                         
    if ry<1 then ry=1
    row = ry/54+1
    if my < 30 then row = 0          
    if my > 570 then row = 0
      value = inkey()
      if value = 32 then
        event = 3                       
      endif

 endproc

 procedure PrintText()
   set color 200,200,255
   set caret 10,100
   wln "  Hit space bar to end "
   wln "  program"

   set caret 0,300


    write "  SCORE  " ; write ; write ; wln (score-miss)*10
    write "  mx = " ; write ; write ; wln mx    
    write "  my = " ; write ; write ; wln my
    write "  column = " ; write ; write ; wln column
    write "  row = " ; write ; write ; wln row
    write "  rx = " ; write ; write ; wln rx
    write "  ry = " ; write ; write ; wln ry
    write "  hits = " ; write ; write ; wln hits ;wln ; wln
    if hits = 30 then
       write ; write ; write ; wln "     GAME OVER "
    endif

 endproc
 
 procedure DrawBoard()

  x=189                               
  y=29
  y2=31
          
  set color 250,100,100                                     
  draw line 188,27,732,27                  
  draw line 188,573,732,573                
  draw line 187,28,187,572                 
  draw line 733,28,733,572                

  set color 50,200,255                   
  for a=1 to 11
    draw line x,y,731,y                    
    draw line x,y2,731,y2                 
    y=y+54                           
    y2=y2+54

  next

  set color 50,255,255
  x=189                               
  y=29
  x2=191

  for a=1 to 11
    draw line x,y,x,570                   
    draw line x2,y,x2,570                 
    x=x+54
    x2=x2+54                          
                  
  next


 endproc
 
procedure Logic1()

  a=0;b=0;c=0;d=0;e=0
 if MouseDown = 1  then       
    brd2[column][row]=1
   if brd[column][row] = 1 then score = score + 1
   if brd[column][row] = 0 then miss = miss + 1
   if brd[column][row] = 1 then play sound snd2
   if brd[column][row] = 0 then play sound snd1
   if brd[column][row] = 1 then hits = hits + 1
   for a= 1 to 9
      if column + a < 11 and  brd[column + a][row] = 1 then b = b + 1
      if column - a > 0  and  brd[column - a][row] = 1 then c = c + 1
      if row + a < 11 and  brd[column][row + a] = 1 then d = d + 1
      if row - a > 0  and  brd[column][row - a] = 1 then e = e + 1
    rt[column][row]=b
    lf[column][row]=c
    bt[column][row]=d
    tp[column][row]=e

   next 
   MouseDown = 0
 endif

endproc

procedure UpdateBoard()
  set color 255,255,255

 x=190                     
 y=30
 
 for b=1 to 10             

        spx=190+a*54
      for a= 1 to 10
        spy=30+b*54
        
    
           draw image sprite1,x,y       
           if brd[a][b]=1 and brd2[a][b]=1 then
             draw image star,x,y
            
           endif  
           if brd2[a][b]=1 then
            proc Print x+42,y+21,rt[a][b]
            proc Print x+6,y+21,lf[a][b]
            proc Print x+23,y+38,bt[a][b]
            proc Print x+23,y+3,tp[a][b]
           endif

        x=x+54              
      next
 x=190                     
 y=y+54                    
 next

endproc
 
procedure Print( x,y,n)
   set caret x,y
   write str$(n)
endproc

 

Make a free website with Yola