Posted: Tue Mar 31, 2009 10:11 pm Post subject: Help, MineSweeper!!
Im trying to make a minesweeper game for fun. but im having trouble getting the selected square to dissapear, any help will be appreciated. this is still in its very early stages.
Turing:
import GUI
var menuItem :array1.. 7ofint var menuName :array1.. 7ofstring:=init("New", "---", "Begginer", "Intermediate", "Expert", "---", "Quit") var square, mines :array1.. 16, 1.. 30ofint var x, y, my, mx, file, Minesweeper, lineFrame :int:=0
%Procedures proc reveal
GUI.Dispose(square (1, 1))%THIS IS WHERE I NEED IT TO DISSAPEAR THE SELECTED BLOCK BUT I DONT KNOW HOW!! end reveal
proc NewGame
end NewGame
proc doNothing
end doNothing
proc menuSelected
end menuSelected
%Boxes
x :=25
y :=7 for i :1.. 16 for j :1.. 30
square (i, j):=GUI.CreateButtonFull(x, y, 5, "", reveal, 5, "r",true)
x +=30 endfor
x :=25
y +=25 endfor
right, i nevr realized that thks, i might make a type for the mines and boxes. that would help a lot i think. this si just the first time im actually using multi dimensional arrays, but, if i make a array of say
Turing:
type aBox
record
x,y :int
shown: boolean endrecord
type aMine
record
mx, my :int endrecord
var mines: array1..16,1..30of aMine
var box: array1..16,1..30of aBox
i know about flexible arrays pretty well, i did some adjustments but the error that i get now I dont gat, if someone could explain this to me, that would be appreciated. This is it now:
Turing:
import GUI
type abox : record
bX, bY :int
shown :boolean endrecord
var menuItem :array1.. 7ofint var menuName :array1.. 7ofstring:=init("New", "---", "Begginer", "Intermediate", "Expert", "---", "Quit") var square :array1.. 16, 1.. 30of abox
var x, y, file, Minesweeper, lineFrame :int:=0
%Procedures proc reveal (o : abox)
square (o.bX, o.bY).shown :=false end reveal
proc drawBox (o : abox, shown :boolean) if o.shown then
x :=25
y :=7 for i :1.. 16 for j :1.. 30
square (i, j):=GUI.CreateButtonFull(o.bX + x, o.bY + y, 5, "", reveal, 5, "",true)
x +=30 endfor
x :=25
y +=25 endfor endif end drawBox