Skip to content

Commit 9a8c902

Browse files
committed
Merge pull request scratchfoundation#541 from LLK/fix_edge_bounce
Use ScratchSprite::bounds() instead of Flash's less accurate getRect() m...
2 parents 3f07456 + 3f2218d commit 9a8c902

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/primitives/MotionAndPenPrims.as

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public class MotionAndPenPrims {
311311
// turn away from the nearest edge if it's close enough; otherwise do nothing
312312
// Note: comparisons are in the stage coordinates, with origin (0, 0)
313313
// use bounding rect of the sprite to account for costume rotation and scale
314-
var r:Rectangle = s.getRect(app.stagePane);
314+
var r:Rectangle = s.bounds();
315315
// measure distance to edges
316316
var d1:Number = Math.max(0, r.left);
317317
var d2:Number = Math.max(0, r.top);
@@ -338,7 +338,7 @@ public class MotionAndPenPrims {
338338
}
339339

340340
private function ensureOnStageOnBounce(s:ScratchSprite):void {
341-
var r:Rectangle = s.getRect(app.stagePane);
341+
var r:Rectangle = s.bounds();
342342
if (r.left < 0) moveSpriteTo(s, s.scratchX - r.left, s.scratchY);
343343
if (r.top < 0) moveSpriteTo(s, s.scratchX, s.scratchY + r.top);
344344
if (r.right > ScratchObj.STAGEW) {

0 commit comments

Comments
 (0)