Laser On Blank Cell
We can now draw the laser beam on the blank cells. That's the easiest case. The work will divide into a vertical and horizontal drawing technique. Here's the new horizontal laser beam drawing techniaue for a given mask form and given color. These are new instance methods on the BlankCellRenderer class.
renderLaserHorizontalMask: aMaskForm color: aColor
| cellPosn scaledBeam scale trimmedBeam offset |
cellPosn := self offsetWithinGridForm.
scale := CellRenderer cellExtent * 6.
scaledBeam := aMaskForm scaledToSize: scale.
trimmedBeam := Form extent: (CellRenderer cellExtent x)@(scaledBeam height) depth: scaledBeam depth.
scaledBeam
displayOn: trimmedBeam
at: 0@0
clippingBox: trimmedBeam boundingBox
rule: Form paint
fillColor: nil.
offset := 0@(4 + (CellRenderer cellExtent y - trimmedBeam height) // 2).
trimmedBeam
displayOn: self targetForm
at: (cellPosn + offset)
clippingBox: self targetForm boundingBox
rule: Form oldPaint
fillColor: aColor
To use this we have to paint the laser beam from the two mask components in the order of splatter mask then center mask. Here are the rest of the horizonal laser beam drawing instance methods.
renderLaserHorizontalSplatter
self
renderLaserHorizontalMask: LaserGameForms splatterBeamMask
color: LaserGameColors laserBeamSplatterColor
renderLaserHorizontalCenter
self
renderLaserHorizontalMask: LaserGameForms centerBeamMask
color: LaserGameColors laserBeamCenterColor
renderLaserHorizontal
self renderLaserHorizontalSplatter.
self renderLaserHorizontalCenter.