hi,
this is a snazzy little game were the object is to
pair off all the shapes (not diagonally) and click them away...
it is always possible to finish... the questions are ,,,
HOW QUICK? and WITH HOW MUCH HAIR?
packed with three midi tunes ( i think it's the sounds and music that
are making the game stick sometimes ... any tips on that would be nice.)
here's a screen-shot:
and the link to the game;......EXE or ZIP ........1.66mb or 684kb..
http://www.madglue.com/patch/Patch.exe
http://www.madglue.com/patch/Patch.zip
tech:..
the objects are just tiles on the matrix... each tile is a zone
that checks the zone next to itself for a match...
when a match is clicked the rest is down to simple commands...
any tips in how to turn all those commands into maths would be much appreciated.
known items:
it has stuck on me a couple of times ... tum tum tum
the game finish is triggered by how many shapes are deleted.
once or twice it's missed one (my problem) and the game didn't finish.
many thanks also to the guy who did the text input bit ...
can't remember his name .... he's cool
goodness gracious .. if that isn't enough already?
really hope you enjoy...
and return with feedback.
regards,
miki.
almost forgot ...
rem
autocam off:sync on :randomize timer():disable escapekey
rem
dim matrix_texture(30,30)
dim hiscore(1,1)
dim name$(1)
dim c$(61)
name$(0) = "DEFAULT"
rem
gosub display
gosub load_hit1
gosub load_graphs
gosub input_pre_loop
gosub enter_name
restart:
gosub highscore_arrays
gosub matrix_setup
gosub load_array
gosub make_pointer
rem
mins = 0
WIN = 0
z=10
x=10
a1 = timer()
a2 = timer()
rem
position camera 174,104,150
point camera 174,0,150
do
rem clock
b = (timer() - a1)*0.001
SECS = (timer() - a2)*0.001
if secs>59 then mins = mins + 1 :a2 = timer()
rem
gosub info
gosub position_pointer
gosub move_shapes
gosub zones
gosub high_score
gosub music_click
sync
loop
rem +++++++++++++++++++++++++++++++++++++ PRE LOOP +++++++++++++++++++++++++++++++++++++++++++++++++++++++
rem set display
display:
set window on
set window title "PATCH#"
set window size 640,480
set window layout 0,1,1
set window position 100,100
return
rem highscore arrays
highscore_arrays:
sync on
SET TEXT SIZE 55
center text 320,200,"LOADING"
if file exist("hiscore.dat") = 0
hiscore(0) = 599
save array "hiscore.dat",hiscore(0)
endif
SLEEP 100
load array "hiscore.dat",hiscore(0)
hiscore = hiscore(0)
if file exist("name.dat") = 1
load array "name.dat",name$(0)
name$ = name$(0)
endif
return
rem load graphics
load_graphs:
mat_image = 1
hit_image = 2
full_intro_image = 3
logo_image = 4
flowers_image = 5
clock_image = 6
big_flowers_image = 7
midi_image = 8
rem
load bitmap "shapes1.jpg",1
get image mat_image,0,0,192,192
delete bitmap 1
rem
ink rgb(255,0,0),0
set text font "comic sans ms"
for t = 1 to 50
for s = 1 to 20
ELLIPSE 50, 20, t, s
next s
next t
ink rgb(125,125,125),0
ellipse 50, 20, 50, 20
ellipse 50, 20, 51, 19
ink 0,0
set text size 33
center text 40,4,"Patch"
line 75,12,77,25
line 80,12,82,25
line 72,15,82,15
line 73,21,83,21
get image logo_image,0,0,102,42
cls 0
load bitmap "hit1.bmp",2
get image hit_image,0,0,100,100
get image flowers_image,0,101,127,120
get image clock_image,0,121,127,169
get image midi_image,0,170,90,220
delete bitmap 2
cls rgb(0,0,0)
FOR X = 2 to 640 step 107
paste image hit_image,x,15,transparent
next x
GET image big_flowers_image,0,0,640,110
REM
cls rgb(125,125,125)
FOR X = 2 to 640 step 107
paste image hit_image,x,15,transparent
paste image hit_image,x,365,transparent
paste image logo_image,270,120,transparent
next x
set text size 16
center text 320,160,"a game of speed and skill"
GET image full_intro_image,0,0,640,480
rem
sync
return
input_pre_loop:
string$=""
for t=1 to 61
read z$
c$(t)=z$
next t
return
rem enter game name
enter_name:
sync on
do
set text size 22
set text font "comic sans ms"
center text 320,200,"PLEASE ENTER YOUR GAME NAME"
center text 320,320,"THEN CLICK YOUR WAY TO THE BEST TIME EVER "
gosub name_input
set cursor 300,260
text 300,260, "> "+string$
name1$ = string$
if returnkey()=1 then cls 0 : goto restart
if escapekey()=1 then goto the_end
sync
loop
return
rem matrix setup
matrix_setup:
rem
if matrix exist(1) = 1 then delete matrix 1
make matrix 1,300,300,30,30
prepare matrix texture 1,1,3,3
for fx = 0 to 29
for fz = 0 to 29
set matrix tile 1,fx,fz,9
next fx:next fz
update matrix 1
REM
for x = 9 to 20
z1=9:z2=20
set matrix tile 1,x,9,8
set matrix tile 1,x,20,8
next x
update matrix 1
REM
for z = 9 to 20
x1=9:x2=20
set matrix tile 1,9,z,8
set matrix tile 1,20,z,8
next x
update matrix 1
rem save bass tile array
for x = 10 to 19
for z = 10 to 19
t = 2+rnd(5)
set matrix tile 1,x,z,t
matrix_texture(x,z) = t
save array "matrix_texture.dat",matrix_texture(0)
next z
next x
update matrix 1
return
rem load array
load_array:
load array "matrix_texture.dat",matrix_texture(0)
for x = 10 to 19
for z = 10 to 19
shapes = matrix_texture(x,z)
set matrix tile 1,x,z,shapes
next z
next x
update matrix 1
return
rem make pointer
make_pointer:
if object exist(1) = 1 then delete object 1
make object sphere 1,3
hide object 1
CLS 0
return
rem load music
load_sounds:
if music exist(1) = 1 then stop music 1 : delete music 1
if music exist(2) = 1 then stop music 2 : delete music 2
if music exist(3) = 1 then stop music 3 : delete music 3
if music = 1 then load music "patch_music1.mid",1:loop music 1
if music = 2 then load music "patch_music2.mid",2:loop music 2
if music = 3 then load music "patch_music3.mid",3:loop music 3
return
rem load sound
load_hit1:
load sound "hit1.wav",1
load music "patch_music2.mid",2:loop music 2
return
rem ++++++++++++++++++++++++++++++++++++++ LOOPED ++++++++++++++++++++++++++++++++++++++++++++++++++++++
rem onscreen info
info:
ink rgb(16,36,108),0:box 493,0,639,479
paste image flowers_image,485,15,transparent
rem
paste image logo_image,502,40,transparent
rem
paste image clock_image,487,90,transparent
ink 0,0
set text size 33
rem
paste image midi_image,465,155,transparent
text 523,166,"1"
rem
paste image midi_image,500,220,transparent
text 560,231,"2"
rem
paste image midi_image,535,280,transparent
text 595,291,"3"
rem
paste image flowers_image,485,340,transparent
rem
paste image flowers_image,485,412,transparent
rem
ink rgb(155,155,155),0 : box 495,440,600,460
IF MOUSECLICK() = 1
IF mousex()>495 and mousex()<600
IF mousey()>440 and mousey()<460
GOto the_end
endif
endif
endif
if escapekey()=1 then goto the_end
rem
ink rgb(21,255,43),0
set text size 33 :set text font "courier"
CENTER text 550,98,str$(mins)+" : "+str$(secs)
set text to normal
set text size 16 :set text font "ariel"
CENTER text 550,365,"BEST TIME"
CENTER text 550,379,name$(0)
rem
TM1 = hiscore(0)
tm2 = tm1/60 : hins = tm2
tm3 = hiscore(0) - tm2*60 : hecs = tm3
center text 550,394,str$(hins)+" : "+str$(hecs)
rem
set text size 19
center text 550,442,"EXIT"
return
rem position pointer maths
position_pointer:
px = mousex() -160
pz = 420 - mousey()
pointx = px/4+134
pointz = pz/4+105
rem pointer position
position object 1,pointx,2,pointz
x = pointx/10
z = pointz/10
return
rem move the shapes
move_shapes:
if mousex()>10 and mousex()<450
if mousey()>10 and mousey()<470
if x>9 and x<20
if z>9 and z<20
if zone>-1 and zone<8
rem down z
if smashz = 1
zfix = z
if mouseclick() = 1
if zone>1
play sound 1
pnt = pnt + 1
endif
for zz = zfix to 19
shapesz = matrix_texture(x,zz+1)
set matrix tile 1,x,zz,shapesz
matrix_texture(x,zz) = shapesz
save array "matrix_texture.dat",matrix_texture(0)
next zz
update matrix 1
IF ZONE>1
paste image 2,mousex()-50,mousey()-50,transparent
ENDIF
endif
endif
endif:endif
rem up z
if mousex()>10 and mousex()<450
if mousey()>10 and mousey()<470
if z<20
if smashz2 = 1
zfix2 = z
if mouseclick() = 1
if zone>1
play sound 1
pnt = pnt + 1
endif
for zz2 = zfix2 to 10 step -1
shapesz2 = matrix_texture(x,zz2-1)
set matrix tile 1,x,zz2,shapesz2
matrix_texture(x,zz2) = shapesz2
save array "matrix_texture.dat",matrix_texture(0)
next zz2
update matrix 1
IF ZONE>1
paste image 2,mousex()-50,mousey()-50,transparent
ENDIF
endif
endif
endif
endif:endif
rem left x
if mousex()>10 and mousex()<450
if mousey()>10 and mousey()<470
if x>9
if smashx = 1
xfix = x
if mouseclick() = 1
if zone>1
play sound 1
pnt = pnt + 1
endif
for xx = xfix to 19
shapesx = matrix_texture(xx+1,z)
set matrix tile 1,xx,z,shapesx
matrix_texture(xx,z) = shapesx
save array "matrix_texture.dat",matrix_texture(0)
next xx
update matrix 1
IF ZONE>1
paste image 2,mousex()-50,mousey()-50,transparent
ENDIF
endif
endif
endif
endif:endif
rem right x
if mousex()>10 and mousex()<450
if mousey()>10 and mousey()<470
if x<20
if smashx2 = 1
xfix2 = x
if mouseclick() = 1
if zone>1
play sound 1
pnt = pnt + 1
endif
for xx2 = xfix2 to 10 step -1
shapesx2 = matrix_texture(xx2-1,z)
set matrix tile 1,xx2,z,shapesx2
matrix_texture(xx2,z) = shapesx2
save array "matrix_texture.dat",matrix_texture(0)
next xx2
update matrix 1
IF ZONE>1
paste image 2,mousex()-50,mousey()-50,transparent
ENDIF
endif
endif
endif
rem
endif
endif
endif
endif:endif
rem
return
rem zone sub
zones:
load array "matrix_texture.dat",matrix_texture(0)
if x>9 and x<20
if z>9 and z<20
if zone>-1 and zone<8
zone = matrix_texture(x,z) : rem get zone data
hitz = matrix_texture(x,z+1)
hitx = matrix_texture(x+1,z)
hitz2 = matrix_texture(x,z-1)
hitx2 = matrix_texture(x-1,z)
rem
if hitz = zone
smashz = 1
else
smashz = 0
endif
rem
if hitx = zone
smashx = 1
else
smashx = 0
endif
rem
if hitz2 = zone
smashz2 = 1
else
smashz2 = 0
endif
rem
if hitx2 = zone
smashx2 = 1
else
smashx2 = 0
endif
rem
endif
endif
endif
return
rem high score
high_score:
IF PNT>93
final_time = b
if final_time < hiscore
WIN = 1
name$(0) = name1$
IF FILE EXIST("name.dat") = 1 then delete file "name.dat"
save array "name.dat",name$(0)
hiscore(0) = final_time
save array "hiscore.dat",hiscore(0)
b=0
ENDIF
endif
if file exist("hiscore.dat") = 1
load array "hiscore.dat",hiscore(0)
hiscore = hiscore(0)
endif
gosub load_name
rem clear game area at end of game
if pnt>93
for x = 10 to 19
for z = 10 to 19
set matrix tile 1,x,z,1
next z
next x
update matrix 1
if file exist("matrix_texture.dat") = 1 then delete file "matrix_texture.dat"
SET TEXT SIZE 22
INK RGB(125,125,125),0 : box 80,90,400,240
INK 0,0
IF WIN = 1
center text 235,100,"hey you've won!"
center text 235,130,"press 'ENTER' to restart."
center text 235,160,"+++++++++++++++++++++++"
center text 235,210,"Or just quit the program."
ENDIF
IF WIN = 0
INK RGB(125,125,125),0 : box 80,90,400,240
INK 0,0
center text 235,100,"QUICK LIKE A SLUG, AREN'T YOU?"
center text 235,130,"press 'ENTER' to restart."
center text 235,160,"+++++++++++++++++++++++"
center text 235,210,"Or just quit the program."
ENDIF
if returnkey()=1
if file exist("matrix_texture.dat") = 1 then delete file "matrix_texture.dat"
PNT = 0
goto restart
endif
endif
return
load_name:
if file exist("name.dat") = 1
load array "name.dat",name$(0)
name$ = name$(0)
endif
return
rem click for music
music_click:
IF MOUSECLICK() = 1
IF mousex()>465 and mousex()<555
IF mousey()>155 and mousey()<200
music = 1
gosub load_sounds
endif:endif:endif
rem
IF MOUSECLICK() = 1
IF mousex()>500 and mousex()<590
IF mousey()>220 and mousey()<265
music = 2
gosub load_sounds
endif:endif:endif
rem
IF MOUSECLICK() = 1
IF mousex()>535 and mousex()<625
IF mousey()>280 and mousey()<325
music = 3
gosub load_sounds
endif:endif:endif
return
name_input:
for t=1 to 61
if inkey$()=c$(t) and flag=0
flag=1
temp$=c$(t)
string$=string$+c$(t)
exit
endif
next t
if flag=1 and inkey$()<>temp$ then flag=0
if scancode()=14 and flag2=0
del=len(string$)-1
flag2=1
string$=left$(string$,del)
endif
if scancode()<>14 then flag2=0
return
the_end:
undim matrix_texture(30,30)
undim hiscore(1,1)
undim name$(1)
undim c$(61)
if file exist("matrix_texture.dat") = 1 then delete file "matrix_texture.dat"
end
return
data "1","2","3","4","5","6","7","8","9","0","-","="
data "q","w","e","r","t","y","u","i","o","p","[","]"
data "\","a","s","d","f","g","h","j","k","l",";","'"
data "z","x","c","v","b","n","m",",",".","/"," ","`"
data "~","!","@","#","$","%","^","&","*","(",")","_"
data "+"
in the end