;@modern ; A rock falls on a ship: a collision from the hardware and from PMOverlap BYTE ARRAY ship=[$18 $3C $7E $FF $FF $DB $81 $81], rock=[$3C $7E $FF $FF $FF $FF $7E $3C] PROC Main() BYTE y, hw=[0], sw=[0] PMGraphics(1) PMCreate(0, ship, 8, 1, 120, 180) ; the ship at the bottom PMCreate(1, rock, 8, 1, 120, 100) ; the rock above it PMColor(0, 1, 12) PMColor(1, 2, 6) PMWait() HitClr() FOR y=101 TO 190 DO PMWait() ; the rock at y-1 is on the screen now IF hw=0 AND PMHitPM(1)&1 THEN ; player 1 met player 0 hw=y-1 FI HitClr() PMVPos(1, y) ; the rock one row lower IF sw=0 AND PMOverlap(0, 1) THEN ; the rectangles overlap at once sw=y FI OD Print("PMOverlap: the rock hit the ship at y=") PrintBE(sw) Print("Hardware: the rock hit the ship at y=") PrintBE(hw) RETURN