[squeakland] Collision detection, only one object detects the collision

Karl Ramberg karlramberg at gmail.com
Fri Nov 27 15:14:47 EST 2009


Skipped content of type multipart/alternative-------------- next part --------------
'From etoys4.0 of 9 October 2008 [latest update: #2336] on 27 November 2009 at 9:12:24 pm'!
"Change Set:		OverlapsAnyBugFix
Date:			27 November 2009
Author:			Karl Ramberg

Fix the overlap logic in Morph>>overlapsShadowForm:bounds:"!


!Morph methodsFor: '*connectors-geometry' stamp: 'kfr 11/27/2009 21:06'!
overlapsShadowForm: itsShadow bounds: itsBounds
	"Answer true if itsShadow and my shadow overlap at all"
	| andForm overlapExtent |
	overlapExtent _ (itsBounds intersect: self fullBounds) extent.
	overlapExtent > (0 @ 0)
		ifFalse: [^ false].
	andForm _ self shadowForm.
	overlapExtent ~= self fullBounds extent
		ifTrue: [andForm _ andForm
						contentsOfArea: ((itsBounds topLeft max: self topLeft) extent: (overlapExtent min: self bottomRight))].
	andForm _ andForm
				copyBits: (self fullBounds translateBy: itsShadow offset negated)
				from: itsShadow
				at: 0 @ 0
				clippingBox: (0 @ 0 extent: overlapExtent)
				rule: Form and
				fillColor: nil.
	^ andForm bits
		anySatisfy: [:w | w ~= 0]! !



More information about the squeakland mailing list