Я пытаюсь создать лабиринт с PBE-Lighoutgame как мой реф без МЫШЬЮ событий У меня есть 2 классаСоздание Maze
Оба эти классы являются подклассом RectangleMorph
VisibleSquare>>initialize
"Visible borders with Some Color"
другого класса
InvisbleSquare>>initialize
"Everything is transparent Including Borders"
Реализация лабиринт класс, который является подкласс BorderedMorph
Maze>>initialize
initialize
|sampleCell width height n sample|
super initialize.
self borderWidth: 0.
n := self cellsPerSide.
sampleCell := VisibleSquare new.
sample:= InvisibleSquare new.
width := sampleCell width.
height := sample height.
self bounds: ([email protected] extent: ((width + n) @ (height + n)) + (2 * self borderWidth)).
cells := Matrix new: n tabulate: [:i :j | self newCellAt: i at: j].
другой метод
Maze>> newCellAt: i at: j
"Create a cell for position (i,j) and add it to my on-screen
representation at the appropriate screen position. Answer the new cell"
|c origin b |
c := VisibleSquare new.
origin := self innerBounds origin.
self addMorph: c.
c position: ((i - 1) * c width) @ ((j - 1) * c height) + origin.
^ c
Как я могу пластинчатый Матрицу с такими, что они могут быть произвольно добавлены в сетке как VisibleSquare & InvisibleSquare (или) Есть ли другой способ сделать это ??
Табличная матрица с видимым и невидимым квадратом, я понятия не имею, как я могу это сделать – Irfan