Post by honky on May 29, 2024 16:25:20 GMT
Note: Put this code ni a folder, because it générate files.
MapWidth=17: MapHeight=17
graphicbox #u.g, 0, 0, 17, 17
open " " for window_nf as #u
#u.g, "down;fill black": #u.g, "color red;size 3"
#u.g, "place 0 17": #u.g, "line 0 17 17 0": #u.g, "place 0 0": #u.g, "line 0 0 17 17"
#u.g, "getbmp red 0 0 17 17": bmpsave "red","red.bmp"
#u.g, "fill black": #u.g, "color yellow;size 3"
#u.g, "place 0 17": #u.g, "line 0 17 17 0": #u.g, "place 0 0": #u.g, "line 0 0 17 17"
#u.g, "getbmp yellow 0 0 17 17": bmpsave "yellow","yellow.bmp"
close #u
NbXmax = 56: NbYmax = 25
dc = 20 'dimension d'une case en pixels
MapWidth = NbXmax*dc: MapHeight = NbYmax*dc
WindowWidth = MapWidth+25: WindowHeight=MapHeight+160
UpperLeftX = 20: UpperLeftY =5
ncx = int(MapWidth/dc) 'nb of X cells
ncy = int(MapHeight/dc) 'nb of Y cells
dim cell(ncx,ncy), cell$(ncx,ncy)
statictext #w.txt "",10,10,280,20
BUTTON #w.pla, "Placer A", [pla], UL, 30, 80, 110, 25
BUTTON #w.valpla, "<-- Fin", [savea], UL, 150, 80, 60, 25
BUTTON #w.plb, "Placer B", [plb], UL, 250, 80, 110, 25
BUTTON #w.valplb, "<-- Fin", [saveb], UL, 370, 80, 60, 25
BUTTON #w.jou, "JOUER", [jouer], UL, 800, 80, 80, 25
graphicbox #w.g, 5, 30, MapWidth, 85
graphicbox #w.map, 5, 120, MapWidth, MapHeight
if opw=1 then [passw]
open " Placement des navires" for window_nf as #w 'graphics_nf_nsb
[passw]
opw=1
#w "trapclose [quit]"
#w.map "down; fill black": #w.g, "down;fill darkgreen;color white;backcolor darkgreen"
#w.map "backcolor lightgray; color lightgray"
#w, "font courrier 12 bold": #w.g, "font courrier 12 bold"
#w.g, "place 20 20": #w.g, "\A faire dans cet ordre:"
#w.g, "place 230 20": #w.g, "\Clic on 'Placer A' --> Clic in 'Map'--> in 'Map'... --> Clic on 'Fin'"
#w.g, "\ Puis -->Clic on 'Placer B--> Clic in 'Map'--> in 'Map...' --> Clic on 'Fin'"
#w.g, "place 450 70": #w.g, "\---> 'Jouer'"
#w.map "when leftButtonDown [Mark]"
#w.g, "when rightButtonDown [coord]"
dim jeuax(100),jeuay(100),jeubx(100),jeuby(100)
dim jeuax(100): DIM info$(10,10)
gosub [DispMap]: gosub [opja]: gosub [opjb]
#w.jou, "!disable": #w.plb, "!disable": #w.valplb, "!disable"
if fileExists(DefaultDir$, "jeua.txt") and fileExists(DefaultDir$, "jeub.txt") then
#w.jou, "!enable"
end if
wait
[jeu]
jx=int(MouseX/dc): jy=int(MouseY/dc)
if jx>560 and jx<WindowWidth then
end if
wait
[pla]
flaga=1
#w.map, "color red;backcolor red": flaga=1
#w.map, "when leftButtonDown [Mark]"
wait
[plb]
flaga=2
#w.map, "color yellow;backcolor yellow": flaga=2
#w.map, "when leftButtonDown [Mark]"
wait
[Mark]
mx = int(MouseX/dc)
my = int(MouseY/dc)
if flaga=3 then wait
if flaga=1 and mx>23 then wait
if flaga=2 and mx<23 then wait
if mx<=ncx and my<=ncy then
#w.map, "place ";mx*dc+1;" ";my*dc+1;"; boxfilled ";mx*dc+dc-1;" ";my*dc+dc-1
if flaga=1 then
pa=pa+1: jeuay(pa)=my+1: jeuax(pa)=mx+1
end if
if flaga=2 then
pb=pb+1: jeubx(pb)=mx+1: jeuby(pb)=my+1
end if
end if
gosub [infos]
wait
[infos]
#w.txt "pixels : ";MouseX;" / ";MouseY;" Cell ( ";mx;" , ";my;" )"
return
[DispMap]
#w.map "fill black;color lightgray"
for y=1 to ncy
#w.map "place 0 ";y*dc;"; goto ";MapWidth;" ";y*dc
next y
for x=1 to ncx
#w.map "place ";x*dc;" 0; goto ";x*dc;" ";MapHeight
next
#w.map "color white;size 2"
#w.map "place 560 o": #w.map "line 560 0 560 ";" ";MapHeight
#w.map "flush; discard"
return
[savea]
open "jeua.txt" for output as #f
for x=1 to pa
print #f, jeuax(x)
print #f, jeuay(x)
next x
close #f
fg=1: #w.plb, "!enable": #w.valplb, "!enable": flaga=3
notice,"It's saved"
wait
[saveb]
open "jeub.txt" for output as #f
for x=1 to pb
print #f, jeubx(x)
print #f, jeuby(x)
next x
close #f
notice,"It's saved"
' #w.g, "color yellow;backcolor darkgreen"
#w.map "when leftButtonDown"
fgg=1
#w.pla, "!disable": #w.valpla, "!disable"
if fg=1 and fgg=1 then #w.jou, "!enable"
wait
[jouer] '----------------------------------JOUER--------------------------------------
opw=0: close #w
MapWidth = NbXmax*dc: MapHeight = NbYmax*dc
WindowWidth = MapWidth+25: WindowHeight=MapHeight+160
UpperLeftX = 20: UpperLeftY =5
statictext #j.txt "",10,10,280,20
textbox #j.voo, 890, 5, 50, 20
BUTTON #j.vo, "Voir", [voir], UL, 960, 5, 50, 25
graphicbox #j.g, 5, 30, MapWidth, 85
graphicbox #j.mapj, 5, 120, MapWidth, MapHeight
if opj=1 then [passj]
open " Jeu." for window_nf as #j 'graphics_nf_nsb
[passj]
opj=1
loadbmp "red","red.bmp": loadbmp "yellow","yellow.bmp"
#j.mapj, "when leftButtonDown [Markj]"
#j.g, "when rightButtonDown [coord]"
#j "trapclose [quitj]"
#j.g, "when rightButtonDown [coorda]"
#j.mapj "down; fill black": #j.g, "down;fill darkgreen;color white;backcolor darkgreen"
#j.g, "font courrier 16 bold"
#j.g, "place 240 50": #j.g, "\JOUEUR B": #j.g, "place 750 50": #j.g, "\JOUEUR A"
#j.g "color yellow;backcolor darkgreen"
#j.g, "place 370 50": #j.g, "\JOUE !": flag$="b"
temp=500: #j.voo, str$(temp)
#j.mapj, "flush;discard"
gosub [DispMapj]: gosub [opja]: gosub [opjb]
wait
[Markj]
jx = int(MouseX/dc)
jy = int(MouseY/dc)
if flag$="b" and jx>23 then wait
if flag$="a" and jx<23 then wait
if flag$="b" then [bjoue]
if flag$="a" then [ajoue]
wait
[bjoue]
gosub [opja]: gosub [opjb]
#j.mapj, "drawbmp yellow ";jx*dc+1;" ";jy*dc+1
jx=jx+1: jy=jy+1
for x=1 to t
if jx=charax(x) and jy=charay(x) then
#j.mapj, "color red;backcolor red"
jx=jx-1: jy=jy-1
#j.mapj, "place ";jx*dc+1;" ";jy*dc+1;"; boxfilled ";jx*dc+dc-1;" ";jy*dc+dc-1
pjb=pjb+1
#j.g, "color yellow;backcolor darkgreen"
#j.g, "place 10 50": #j.g, "\Touché ";str$(pjb)
end if
next x
#j.g, "color darkgreen;backcolor darkgreen"
#j.g, "place 360 20": #j.g, "boxfilled 460 60"
#j.g "color yellow;backcolor darkgreen"
#j.g, "place 880 50": #j.g, "\JOUE !": flag$="a"
#j.mapj, "flush;discard"
' gosub [infos]
wait
[ajoue]
gosub [opja]: gosub [opjb]
#j.mapj, "drawbmp red ";jx*dc+1;" ";jy*dc+1
jx=jx+1: jy=jy+1
for x=1 to t
if jx=charbx(x) and jy=charby(x) then
#j.mapj, "color yellow;backcolor yellow"
jx=jx-1: jy=jy-1
#j.mapj, "place ";jx*dc+1;" ";jy*dc+1;"; boxfilled ";jx*dc+dc-1;" ";jy*dc+dc-1
pja=pja+1
#j.g, "color yellow;backcolor darkgreen"
#j.g, "place 600 50": #j.g, "\Touché ";str$(pja)
end if
next x
#j.g, "color darkgreen;backcolor darkgreen"
#j.g, "place 870 20": #j.g, "boxfilled 970 60"
#j.g "color yellow;backcolor darkgreen"
#j.g, "place 370 50": #j.g, "\JOUE !": flag$="b"
#j.mapj, "flush;discard"
wait
[infosj]
#j.txt "pixels : ";MouseX;" / ";MouseY;" Cell ( ";jx;" , ";jy;" )"
return
[DispMapj]
#j.mapj "fill black;color lightgray"
for y=1 to ncy
#j.mapj "place 0 ";y*dc;"; goto ";MapWidth;" ";y*dc
next y
for x=1 to ncx
#j.mapj "place ";x*dc;" 0; goto ";x*dc;" ";MapHeight
next
#j.mapj "color white;size 2"
#j.mapj "place 560 o": #j.mapj "line 560 0 560 ";" ";MapHeight
#j.mapj "flush; discard"
return
function fileExists(path$, filename$)
'DIM info$(10,10) doit déjà être déclarée
files path$, filename$, info$() ' path$ = DefaultDir$ en général...
fileExists = val(info$(0, 0)) 'non zéro si vrai
end function
[opja]
if fileExists(DefaultDir$, "jeua.txt") then
open "jeua.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
wend
close #g
dim charax(t+2),charay(t+2): t=0
open "jeua.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
charax(t)=val(donn$)
line input #g, donn$
charay(t)=val(donn$)
wend
close #g
end if
' #j.mapj, "color red;backcolor red"
for x=1 to t
' #j.mapj, "place ";charax(x)*dc+1;" ";charay(x)*dc+1;"; boxfilled ";charax(x)*dc+dc-1;" ";charay(x)*dc+dc-1
next x
return
[opjb]
if fileExists(DefaultDir$, "jeub.txt") then
open "jeub.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
wend
close #g
dim charbx(t+2),charby(t+2): t=0
open "jeub.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
charbx(t)=val(donn$)
line input #g, donn$
charby(t)=val(donn$)
wend
close #g
end if
' #j.mapj, "color yellow;backcolor yellow"
for x=1 to t
' #j.mapj, "place ";charbx(x)*dc+1;" ";charby(x)*dc+1;"; boxfilled ";charbx(x)*dc+dc-1;" ";charby(x)*dc+dc-1
next x
return
[voir] '------------------------------------------VOIR-----------------------------------
MapWidth = NbXmax*dc: MapHeight = NbYmax*dc
WindowWidth = MapWidth+25: WindowHeight=MapHeight+160
UpperLeftX = 20: UpperLeftY =5
ncx = int(MapWidth/dc) 'nb of X cells
ncy = int(MapHeight/dc) 'nb of Y cells
graphicbox #p.map, 5, 120, MapWidth, MapHeight
open " Voir" for window_nf as #p
#p.map "down;fill black;color lightgray"
for y=1 to ncy
#p.map "place 0 ";y*dc;"; goto ";MapWidth;" ";y*dc
next y
for x=1 to ncx
#p.map "place ";x*dc;" 0; goto ";x*dc;" ";MapHeight
next
#p.map "color white;size 2"
#p.map "place 560 o": #p.map "line 560 0 560 ";" ";MapHeight
'////////////////////////////
gosub [opja]: gosub [opjb]
for x=1 to t
charax(x)=charax(x)-1: charay(x)=charay(x)-1: charbx(x)=charbx(x)-1: charby(x)=charby(x)-1
#p.map, "place ";charax(x)*dc+1;" ";charay(x)*dc+1;"; boxfilled ";charax(x)*dc+dc-1;" ";charay(x)*dc+dc-1
#p.map, "place ";charbx(x)*dc+1;" ";charby(x)*dc+1;"; boxfilled ";charbx(x)*dc+dc-1;" ";charby(x)*dc+dc-1
next x
if flag$="a" then
pja=pja-1: #j.g, "place 600 50": #j.g, "\Touché ";str$(pja)
end if
if flag$="b" then
pjb=pjb-1: #j.g, "place 10 50": #j.g, "\Touché ";str$(pjb)
end if
gosub [pause]: close #p
wait
[pause]
#j.voo, "!contents? temp$": temp=val(temp$)
timer temp, [temps]
wait
[temps]
timer 0
return
[coord]
ax=MouseX: ay=MouseY
#w.g, "place ";ax;" ";ay: #w.g, "\ ";str$(ax);" ";str$(ay)
wait
[coorda]
ax=MouseX: ay=MouseY
#j.g, "place ";ax;" ";ay: #j.g, "\ ";str$(ax);" ";str$(ay)
wait
[quitj]
unloadbmp "red": unloadbmp "yellow"
if opw=1 then opw=0: close #w
opj=0: close #j
wait
[quit]
if opj=1 then opj=0: close #j
close #w
end
wait
nomainwinMapWidth=17: MapHeight=17
graphicbox #u.g, 0, 0, 17, 17
open " " for window_nf as #u
#u.g, "down;fill black": #u.g, "color red;size 3"
#u.g, "place 0 17": #u.g, "line 0 17 17 0": #u.g, "place 0 0": #u.g, "line 0 0 17 17"
#u.g, "getbmp red 0 0 17 17": bmpsave "red","red.bmp"
#u.g, "fill black": #u.g, "color yellow;size 3"
#u.g, "place 0 17": #u.g, "line 0 17 17 0": #u.g, "place 0 0": #u.g, "line 0 0 17 17"
#u.g, "getbmp yellow 0 0 17 17": bmpsave "yellow","yellow.bmp"
close #u
NbXmax = 56: NbYmax = 25
dc = 20 'dimension d'une case en pixels
MapWidth = NbXmax*dc: MapHeight = NbYmax*dc
WindowWidth = MapWidth+25: WindowHeight=MapHeight+160
UpperLeftX = 20: UpperLeftY =5
ncx = int(MapWidth/dc) 'nb of X cells
ncy = int(MapHeight/dc) 'nb of Y cells
dim cell(ncx,ncy), cell$(ncx,ncy)
statictext #w.txt "",10,10,280,20
BUTTON #w.pla, "Placer A", [pla], UL, 30, 80, 110, 25
BUTTON #w.valpla, "<-- Fin", [savea], UL, 150, 80, 60, 25
BUTTON #w.plb, "Placer B", [plb], UL, 250, 80, 110, 25
BUTTON #w.valplb, "<-- Fin", [saveb], UL, 370, 80, 60, 25
BUTTON #w.jou, "JOUER", [jouer], UL, 800, 80, 80, 25
graphicbox #w.g, 5, 30, MapWidth, 85
graphicbox #w.map, 5, 120, MapWidth, MapHeight
if opw=1 then [passw]
open " Placement des navires" for window_nf as #w 'graphics_nf_nsb
[passw]
opw=1
#w "trapclose [quit]"
#w.map "down; fill black": #w.g, "down;fill darkgreen;color white;backcolor darkgreen"
#w.map "backcolor lightgray; color lightgray"
#w, "font courrier 12 bold": #w.g, "font courrier 12 bold"
#w.g, "place 20 20": #w.g, "\A faire dans cet ordre:"
#w.g, "place 230 20": #w.g, "\Clic on 'Placer A' --> Clic in 'Map'--> in 'Map'... --> Clic on 'Fin'"
#w.g, "\ Puis -->Clic on 'Placer B--> Clic in 'Map'--> in 'Map...' --> Clic on 'Fin'"
#w.g, "place 450 70": #w.g, "\---> 'Jouer'"
#w.map "when leftButtonDown [Mark]"
#w.g, "when rightButtonDown [coord]"
dim jeuax(100),jeuay(100),jeubx(100),jeuby(100)
dim jeuax(100): DIM info$(10,10)
gosub [DispMap]: gosub [opja]: gosub [opjb]
#w.jou, "!disable": #w.plb, "!disable": #w.valplb, "!disable"
if fileExists(DefaultDir$, "jeua.txt") and fileExists(DefaultDir$, "jeub.txt") then
#w.jou, "!enable"
end if
wait
[jeu]
jx=int(MouseX/dc): jy=int(MouseY/dc)
if jx>560 and jx<WindowWidth then
end if
wait
[pla]
flaga=1
#w.map, "color red;backcolor red": flaga=1
#w.map, "when leftButtonDown [Mark]"
wait
[plb]
flaga=2
#w.map, "color yellow;backcolor yellow": flaga=2
#w.map, "when leftButtonDown [Mark]"
wait
[Mark]
mx = int(MouseX/dc)
my = int(MouseY/dc)
if flaga=3 then wait
if flaga=1 and mx>23 then wait
if flaga=2 and mx<23 then wait
if mx<=ncx and my<=ncy then
#w.map, "place ";mx*dc+1;" ";my*dc+1;"; boxfilled ";mx*dc+dc-1;" ";my*dc+dc-1
if flaga=1 then
pa=pa+1: jeuay(pa)=my+1: jeuax(pa)=mx+1
end if
if flaga=2 then
pb=pb+1: jeubx(pb)=mx+1: jeuby(pb)=my+1
end if
end if
gosub [infos]
wait
[infos]
#w.txt "pixels : ";MouseX;" / ";MouseY;" Cell ( ";mx;" , ";my;" )"
return
[DispMap]
#w.map "fill black;color lightgray"
for y=1 to ncy
#w.map "place 0 ";y*dc;"; goto ";MapWidth;" ";y*dc
next y
for x=1 to ncx
#w.map "place ";x*dc;" 0; goto ";x*dc;" ";MapHeight
next
#w.map "color white;size 2"
#w.map "place 560 o": #w.map "line 560 0 560 ";" ";MapHeight
#w.map "flush; discard"
return
[savea]
open "jeua.txt" for output as #f
for x=1 to pa
print #f, jeuax(x)
print #f, jeuay(x)
next x
close #f
fg=1: #w.plb, "!enable": #w.valplb, "!enable": flaga=3
notice,"It's saved"
wait
[saveb]
open "jeub.txt" for output as #f
for x=1 to pb
print #f, jeubx(x)
print #f, jeuby(x)
next x
close #f
notice,"It's saved"
' #w.g, "color yellow;backcolor darkgreen"
#w.map "when leftButtonDown"
fgg=1
#w.pla, "!disable": #w.valpla, "!disable"
if fg=1 and fgg=1 then #w.jou, "!enable"
wait
[jouer] '----------------------------------JOUER--------------------------------------
opw=0: close #w
MapWidth = NbXmax*dc: MapHeight = NbYmax*dc
WindowWidth = MapWidth+25: WindowHeight=MapHeight+160
UpperLeftX = 20: UpperLeftY =5
statictext #j.txt "",10,10,280,20
textbox #j.voo, 890, 5, 50, 20
BUTTON #j.vo, "Voir", [voir], UL, 960, 5, 50, 25
graphicbox #j.g, 5, 30, MapWidth, 85
graphicbox #j.mapj, 5, 120, MapWidth, MapHeight
if opj=1 then [passj]
open " Jeu." for window_nf as #j 'graphics_nf_nsb
[passj]
opj=1
loadbmp "red","red.bmp": loadbmp "yellow","yellow.bmp"
#j.mapj, "when leftButtonDown [Markj]"
#j.g, "when rightButtonDown [coord]"
#j "trapclose [quitj]"
#j.g, "when rightButtonDown [coorda]"
#j.mapj "down; fill black": #j.g, "down;fill darkgreen;color white;backcolor darkgreen"
#j.g, "font courrier 16 bold"
#j.g, "place 240 50": #j.g, "\JOUEUR B": #j.g, "place 750 50": #j.g, "\JOUEUR A"
#j.g "color yellow;backcolor darkgreen"
#j.g, "place 370 50": #j.g, "\JOUE !": flag$="b"
temp=500: #j.voo, str$(temp)
#j.mapj, "flush;discard"
gosub [DispMapj]: gosub [opja]: gosub [opjb]
wait
[Markj]
jx = int(MouseX/dc)
jy = int(MouseY/dc)
if flag$="b" and jx>23 then wait
if flag$="a" and jx<23 then wait
if flag$="b" then [bjoue]
if flag$="a" then [ajoue]
wait
[bjoue]
gosub [opja]: gosub [opjb]
#j.mapj, "drawbmp yellow ";jx*dc+1;" ";jy*dc+1
jx=jx+1: jy=jy+1
for x=1 to t
if jx=charax(x) and jy=charay(x) then
#j.mapj, "color red;backcolor red"
jx=jx-1: jy=jy-1
#j.mapj, "place ";jx*dc+1;" ";jy*dc+1;"; boxfilled ";jx*dc+dc-1;" ";jy*dc+dc-1
pjb=pjb+1
#j.g, "color yellow;backcolor darkgreen"
#j.g, "place 10 50": #j.g, "\Touché ";str$(pjb)
end if
next x
#j.g, "color darkgreen;backcolor darkgreen"
#j.g, "place 360 20": #j.g, "boxfilled 460 60"
#j.g "color yellow;backcolor darkgreen"
#j.g, "place 880 50": #j.g, "\JOUE !": flag$="a"
#j.mapj, "flush;discard"
' gosub [infos]
wait
[ajoue]
gosub [opja]: gosub [opjb]
#j.mapj, "drawbmp red ";jx*dc+1;" ";jy*dc+1
jx=jx+1: jy=jy+1
for x=1 to t
if jx=charbx(x) and jy=charby(x) then
#j.mapj, "color yellow;backcolor yellow"
jx=jx-1: jy=jy-1
#j.mapj, "place ";jx*dc+1;" ";jy*dc+1;"; boxfilled ";jx*dc+dc-1;" ";jy*dc+dc-1
pja=pja+1
#j.g, "color yellow;backcolor darkgreen"
#j.g, "place 600 50": #j.g, "\Touché ";str$(pja)
end if
next x
#j.g, "color darkgreen;backcolor darkgreen"
#j.g, "place 870 20": #j.g, "boxfilled 970 60"
#j.g "color yellow;backcolor darkgreen"
#j.g, "place 370 50": #j.g, "\JOUE !": flag$="b"
#j.mapj, "flush;discard"
wait
[infosj]
#j.txt "pixels : ";MouseX;" / ";MouseY;" Cell ( ";jx;" , ";jy;" )"
return
[DispMapj]
#j.mapj "fill black;color lightgray"
for y=1 to ncy
#j.mapj "place 0 ";y*dc;"; goto ";MapWidth;" ";y*dc
next y
for x=1 to ncx
#j.mapj "place ";x*dc;" 0; goto ";x*dc;" ";MapHeight
next
#j.mapj "color white;size 2"
#j.mapj "place 560 o": #j.mapj "line 560 0 560 ";" ";MapHeight
#j.mapj "flush; discard"
return
function fileExists(path$, filename$)
'DIM info$(10,10) doit déjà être déclarée
files path$, filename$, info$() ' path$ = DefaultDir$ en général...
fileExists = val(info$(0, 0)) 'non zéro si vrai
end function
[opja]
if fileExists(DefaultDir$, "jeua.txt") then
open "jeua.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
wend
close #g
dim charax(t+2),charay(t+2): t=0
open "jeua.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
charax(t)=val(donn$)
line input #g, donn$
charay(t)=val(donn$)
wend
close #g
end if
' #j.mapj, "color red;backcolor red"
for x=1 to t
' #j.mapj, "place ";charax(x)*dc+1;" ";charay(x)*dc+1;"; boxfilled ";charax(x)*dc+dc-1;" ";charay(x)*dc+dc-1
next x
return
[opjb]
if fileExists(DefaultDir$, "jeub.txt") then
open "jeub.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
wend
close #g
dim charbx(t+2),charby(t+2): t=0
open "jeub.txt" for input as #g 'Ouverture fichier en lecture
while eof(#g)=0
t=t+1: line input #g, donn$
charbx(t)=val(donn$)
line input #g, donn$
charby(t)=val(donn$)
wend
close #g
end if
' #j.mapj, "color yellow;backcolor yellow"
for x=1 to t
' #j.mapj, "place ";charbx(x)*dc+1;" ";charby(x)*dc+1;"; boxfilled ";charbx(x)*dc+dc-1;" ";charby(x)*dc+dc-1
next x
return
[voir] '------------------------------------------VOIR-----------------------------------
MapWidth = NbXmax*dc: MapHeight = NbYmax*dc
WindowWidth = MapWidth+25: WindowHeight=MapHeight+160
UpperLeftX = 20: UpperLeftY =5
ncx = int(MapWidth/dc) 'nb of X cells
ncy = int(MapHeight/dc) 'nb of Y cells
graphicbox #p.map, 5, 120, MapWidth, MapHeight
open " Voir" for window_nf as #p
#p.map "down;fill black;color lightgray"
for y=1 to ncy
#p.map "place 0 ";y*dc;"; goto ";MapWidth;" ";y*dc
next y
for x=1 to ncx
#p.map "place ";x*dc;" 0; goto ";x*dc;" ";MapHeight
next
#p.map "color white;size 2"
#p.map "place 560 o": #p.map "line 560 0 560 ";" ";MapHeight
'////////////////////////////
gosub [opja]: gosub [opjb]
for x=1 to t
charax(x)=charax(x)-1: charay(x)=charay(x)-1: charbx(x)=charbx(x)-1: charby(x)=charby(x)-1
#p.map, "place ";charax(x)*dc+1;" ";charay(x)*dc+1;"; boxfilled ";charax(x)*dc+dc-1;" ";charay(x)*dc+dc-1
#p.map, "place ";charbx(x)*dc+1;" ";charby(x)*dc+1;"; boxfilled ";charbx(x)*dc+dc-1;" ";charby(x)*dc+dc-1
next x
if flag$="a" then
pja=pja-1: #j.g, "place 600 50": #j.g, "\Touché ";str$(pja)
end if
if flag$="b" then
pjb=pjb-1: #j.g, "place 10 50": #j.g, "\Touché ";str$(pjb)
end if
gosub [pause]: close #p
wait
[pause]
#j.voo, "!contents? temp$": temp=val(temp$)
timer temp, [temps]
wait
[temps]
timer 0
return
[coord]
ax=MouseX: ay=MouseY
#w.g, "place ";ax;" ";ay: #w.g, "\ ";str$(ax);" ";str$(ay)
wait
[coorda]
ax=MouseX: ay=MouseY
#j.g, "place ";ax;" ";ay: #j.g, "\ ";str$(ax);" ";str$(ay)
wait
[quitj]
unloadbmp "red": unloadbmp "yellow"
if opw=1 then opw=0: close #w
opj=0: close #j
wait
[quit]
if opj=1 then opj=0: close #j
close #w
end
wait