This game made with the NaaLaa6 programming language.
NumberMaze.zip Size : 763.366 Kb Type : zip |
|
visible:
size;
event = 2; count = 0 ; gamenumber = 0
sqrcolor ; mx; my; square ; column; row; score; number1; number2; enter
checksum; gameover ; sum
Board[80]
Board2[80]
Piece[12]
randomize time()
hidden:
set redraw off
procedure start()
ThisIsAPlaceHolder = 1
endproc
set window 0, 0, 1200, 700
proc SetupPieces
proc Setup
rem proc SetupSound
set color 0,0,0
cls
set color 255,255,255
do
wait 50
if event = 2 then
rem proc SetBackGround
proc BuildBoard
proc MakeSquares
proc DisplayPieces
proc PrintText
proc CheckMouse
rem proc SetScore
proc DrawMarker 50,50
proc EndGame
rem proc KeyBoard
endif
proc HowToPlay
redraw
until event = 3
proc AfterGame
end
procedure AfterGame()
set color 0,0,0
cls
create font 0, "arial", 48
set caret 300,200
set color 255,255,255
wln "PUZZLE SOLVED !"
create font 0, "arial", 16
set caret 200,300
wln " Why I do it? "
wln " Philipians 4:8 "
wln "Finally, brothers,whatever is true,whatever is noble, whatever "
wln "is right, whatever is pure,whatever is lovely, whatever is "
wln "admirable -- if anything is excellent or praiseworthy -- think "
wln "about such things "
wln;wln
wln " It is my plan, to build a collection of software, that would give "
wln "church organizations something to add to their cd roms that they make."
redraw
wait keydown
endproc
procedure BuildBoard()
set color 0,0,0
cls
set color 0,0,255
draw rect 250,10,674,674,0
draw rect 252,12,670,670,0
set color 40,0,50
draw rect 254,14,666,666,1
set color 0,0,255
draw rect 262,22,650,650,0
set color 255,10,10
draw rect 264,24,646,646,0
set color 255,255,255
draw rect 266,26,642,642,0
endproc
procedure MakeSquares()
x;y;a;b
x = 267 ; y=27 ; size = 80
for a = 1 to 8
for b = 1 to 8
draw rect x,y,size,size,0
y=y+size
next
x=x+size
y=27
next
endproc
procedure SetupPieces()
a;b;c;cnt
c=1
cnt = 1
rem Sqr = CreateImage(82,82,10)
rem Enter = CreateImage(45,15)
create image 9,50,15
create image 10,40,15
for a = 1 to 8
create image a,72,72
next
for a = 1 to 8
proc SetColor a
set image a
draw rect 0,0,72,72,1
next
for a = 1 to 8
set image a
set color 255,255,255
draw rect 2,2,68,68,0
draw rect 4,4,64,64,0
draw rect 6,6,60,60,0
draw rect 8,8,56,56,0
next
rem Cambria = LoadFont("Cambria",72,False,False,False)
rem Cambria2 = LoadFont("Cambria",16,False,False,False)
create font 0, "arial", 72
rem SetFont Cambria
b = 1
for a = 1 to 7
set image a
set color 0,0,0
rem Text 28,8, Chr$( a+48 )
set caret 18,0 ; write chr$ ( a + 48)
next
create font 0, "arial", 16
set image 9
set color 0,0,255
draw rect 0,0,50,15,1
set color 255,255,255
set caret 0,0 ; write " ENTER"
set image 10
set color 0,0,255
draw rect 0,0,45,15,1
set color 255,255,255
set caret 0,0 ; write " EXIT"
set image primary
set color 255,255,255
endproc
procedure DrawMarker(x,y)
set color 255,255,0
draw rect x+14,y+14,44,44
set color 255,255,0
draw rect x+9,y+9,54,54
set color 0,0,255
draw rect x+10,y+10,51,51
set color 255,255,255
draw rect x+12,y+12,48,48
endproc
procedure SetColor( a )
if a = 1 then set color 60,255,50
if a = 2 then set color 20,20,255
if a = 3 then set color 250,50,50
if a = 4 then set color 50,250,250
if a = 5 then set color 250,50,250
if a = 6 then set color 250,250,50
if a = 7 then set color 150,20,180
if a = 8 then set color 20,130,130
sqrcolor = a
endproc
procedure DisplayPieces()
set color 255,255,255
x;y;a;b;c
x= 271 ; y=32
rem draw image 1,500,500
for a = 1 to 64
b= Board[a]
rem if a = 64 then b = 8
if b > 0 then
draw image b,x,y
endif
c = Board2[a]
if c = 1 then proc DrawMarker x,y
if a = 64 then draw image 10,x+15,y+25
if a = 1 then draw image 9,x+12,y+58
rem if a = 1 then proc DrawPiece2 x+ 14,y-10
x= x + 80
if x> 900 then
x = 271
y = y + 80
endif
next
endproc
procedure HowToPlay()
a = 1
set color 255,255,255
set caret 10,400 ; wln " To play the game, start at "
wln "the upper left square, and"
wln "use the number to count and"
wln "click the next square. Continue "
wln "from there always using the"
wln "number to get the next square."
wln "The game ends at the exit "
wln "square."
wln " If there is more than one solution, "
wln "you need to try again."
wln " See Google; 'number maze game' "
wln
wln " http://rb23.yolasite.com "
rem wln Str$ GameOver
endproc
procedure Setup()
a;b;r
b=1
for a = 1 to 64
r = rnd (8)
Board[a] = r
b=b+1
Board[64] = 8;
if b>7 then b=1
next
r = rnd(21)
rem r = 5
gamenumber = r
Board[25] = 0 ; Board[26] = 0 ; Board[27] = 0 ; Board[28] = 0 ; Board[42] = 0 ; Board[50] = 0 ; Board[51] = 0; Board[10] = 0
Board[11] = 0 ; Board[12] = 0 ; Board[13] = 0 ; Board[23] = 0 ; Board[15] = 0 ; Board[16] = 0 ; Board[38] = 0; Board[45] = 0
if r = 1 then
Board[1] = 5 ; Board[6] = 5 ; Board[46] = 2 ; Board[44] = 2 ; Board[60] = 4 ; checksum = 175
endif
if r = 2 then
Board[1] = 3 ; Board[4] = 5 ; Board[44] = 2 ; Board[46] = 2 ; Board[62] = 2 ; checksum = 171
endif
if r = 3 then
Board[1] = 2 ; Board[3] = 3 ; Board[27] = 2 ; Board[43] = 5 ; Board[48] = 2 ; checksum = 136
endif
if r = 4 then
Board[1] = 6 ; Board[7] = 3 ; Board[31] = 1 ; Board[32] = 4 ; checksum = 85
endif
if r = 5 then
Board[1] = 7 ; Board[8] = 5 ; Board[48] = 4 ; Board[44] = 2 ; Board[60] = 4 ; checksum = 183
endif
if r = 6 then
Board[1] = 4 ; Board[5] = 4 ; Board[37] = 2 ; Board[39] = 3 ; Board[63] = 1 ; checksum = 159
endif
if r = 7 then
Board[1] = 5 ; Board[6] = 2 ; Board[4] = 4 ; Board[36] = 4 ; Board[40] = 3 ; checksum = 105
endif
if r = 8 then
Board[1] = 3 ; Board[25] = 5 ; Board[30] = 3 ; Board[54] = 2 ; Board[56] = 1 ; checksum = 180
endif
if r = 9 then
Board[1] = 5 ; Board[6] = 2 ; Board[22] = 3 ; Board[19] = 3 ; Board[43] = 5 ; Board[48] = 2 ; checksum = 159
endif
if r = 10 then
Board[1] = 5 ; Board[6] = 2 ; Board[22] = 5 ; Board[17] = 2 ; Board[33] = 7 ; Board[40] = 3 ; checksum = 143
endif
if r = 11 then
Board[1] = 7 ; Board[8] = 2 ; Board[24] = 7 ; Board[17] = 2 ; Board[33] = 3 ; Board[57] = 7 ; checksum = 168
endif
if r = 12 then
Board[1] = 5 ; Board[6] = 3 ; Board[30] = 2 ; Board[28] = 4 ; Board[60] = 4 ; checksum = 143
endif
if r = 13 then
Board[1] = 2 ; Board[3] = 4 ; Board[35] = 2 ; Board[37] = 3 ; Board[61] = 3 ; checksum = 151
endif
if r = 14 then
Board[1] = 6 ; Board[7] = 3 ; Board[31] = 2 ; Board[47] = 1 ; Board[48] = 2 ; checksum = 148
endif
if r = 15 then
Board[1] = 7 ; Board[8] = 5 ; Board[3] = 7 ; Board[59] = 5 ; checksum = 95
endif
if r = 16 then
Board[1] = 4 ; Board[5] = 4 ; Board[37] = 2 ; Board[39] = 3 ; Board[63] = 1 ; checksum = 159
endif
if r = 17 then
Board[1] = 5 ; Board[6] = 2 ; Board[4] = 4 ; Board[36] = 4 ; Board[40] = 3 ; checksum = 105
endif
if r = 18 then
Board[1] = 5 ; Board[6] = 5 ; Board[46] = 2 ; Board[62] = 2 ; checksum = 129
endif
if r = 19 then
Board[1] = 3 ; Board[4] = 4 ; Board[36] = 3 ; Board[33] = 2 ; Board[49] = 7 ; Board[56] = 1 ; checksum = 199
endif
if r = 20 then
Board[1] = 3 ; Board[25] = 5 ; Board[30] = 2 ; Board[46] = 3 ; Board[43] = 2 ; Board[59] = 5 ; checksum = 224
endif
Board2[1] = 1
Board2[64] = 1
gameover = 0
endproc
procedure CheckMouse()
a;b;c;x;y;x2;y2
if mousebutton(0,1) then
mx= mousex()
my= mousey()
square = 0
x = 267 ; x2 = 347 ; y = 27 ; y2 = 107
for b = 1 to 8
if mx > x and mx < x2 then column = b
x = x + 80
x2 = x2 + 80
next
for c = 1 to 8
if my > y and my < y2 then row = c
y = y + 80
y2 = y2 + 80
next
if column > 0 then
square = row * 8 - 8 + column
proc SelectSquare square
endif
endif
endproc
procedure PrintText()
rem Text 10,400, str mx
rem Text 10,420, str my
rem Text 10,440, str Square
rem Text 10,460, str Number2
set caret 10,200 ; write " MouseX = " ; wln str$(mx)
write " MouseY = " ; wln str$(my)
write " square hit = " ; wln str$(square)
write " number hit = " ; wln str$(number2) ; wln
write " sum = " ; wln str$(sum)
write " checksum = " ; wln str$(checksum)
write " Game = " ; wln str$(gamenumber)
endproc
procedure SelectSquare(s)
if Board2[s] = 0 then
Board2[s] = 1
else
Board2[s] = 0
endif
number2 = Board[s]
wait 60
endproc
procedure SetScore()
rem Text 50,30, "SCORE:"
rem Text 100,30, Score
set caret 50,30 ; write "SCORE:"
set caret 100,30 ; write str$ (score)
endproc
procedure EndGame()
a = 0
b = 0
sum = 0
for a = 1 to 63
b= Board2[a]
if b = 1 then
sum = sum + a
sum = sum + Board[a]
endif
next
if sum = checksum then event = 3
endproc