From 17fe6dee80b8f407793dc394a824794fec0baf1b Mon Sep 17 00:00:00 2001 From: Cory Date: Mon, 28 Dec 2020 17:12:04 -0600 Subject: [PATCH 1/4] Make ScrollingBitmap use the difference between the coordinate and the image dimension when wrapping a coordinate, rather than setting it to 0. --- com/stencyl/models/scene/ScrollingBitmap.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com/stencyl/models/scene/ScrollingBitmap.hx b/com/stencyl/models/scene/ScrollingBitmap.hx index 0e78bb97..0e46d9a0 100644 --- a/com/stencyl/models/scene/ScrollingBitmap.hx +++ b/com/stencyl/models/scene/ScrollingBitmap.hx @@ -148,12 +148,12 @@ class ScrollingBitmap extends Sprite { if(xP < -width || xP > width) { - xP = 0; + xP = xP - width; } - if(yP < -height || yP > height) + if(yP <= -height || yP > height) { - yP = 0; + yP = yP - height; } } From b349b751197ccb5c1e3c8941f630feadca56f09c Mon Sep 17 00:00:00 2001 From: Cory Date: Mon, 28 Dec 2020 17:19:19 -0600 Subject: [PATCH 2/4] Make ScrollingBitmap use the difference between the coordinate and the image dimension when wrapping a coordinate, rather than setting it to 0. --- com/stencyl/models/scene/ScrollingBitmap.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com/stencyl/models/scene/ScrollingBitmap.hx b/com/stencyl/models/scene/ScrollingBitmap.hx index 0e46d9a0..4961ba53 100644 --- a/com/stencyl/models/scene/ScrollingBitmap.hx +++ b/com/stencyl/models/scene/ScrollingBitmap.hx @@ -151,7 +151,7 @@ class ScrollingBitmap extends Sprite xP = xP - width; } - if(yP <= -height || yP > height) + if(yP < -height || yP > height) { yP = yP - height; } From 5d6dab72eacbf402ed13d1d971f4993a5691ca09 Mon Sep 17 00:00:00 2001 From: Cory Date: Mon, 28 Dec 2020 17:35:53 -0600 Subject: [PATCH 3/4] Change subtraction to mod to properly wrap scrolling bitmaps with negative coordinates. --- com/stencyl/models/scene/ScrollingBitmap.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com/stencyl/models/scene/ScrollingBitmap.hx b/com/stencyl/models/scene/ScrollingBitmap.hx index 4961ba53..7314b9a1 100644 --- a/com/stencyl/models/scene/ScrollingBitmap.hx +++ b/com/stencyl/models/scene/ScrollingBitmap.hx @@ -148,12 +148,12 @@ class ScrollingBitmap extends Sprite { if(xP < -width || xP > width) { - xP = xP - width; + xP = xP % width; } if(yP < -height || yP > height) { - yP = yP - height; + yP = yP % width; } } From 7abd88eb97d3529832ebc2883d26cdafeb24ad8c Mon Sep 17 00:00:00 2001 From: Cory Martin Date: Mon, 28 Dec 2020 17:55:02 -0600 Subject: [PATCH 4/4] Fix using "width" for "yP" --- com/stencyl/models/scene/ScrollingBitmap.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com/stencyl/models/scene/ScrollingBitmap.hx b/com/stencyl/models/scene/ScrollingBitmap.hx index 7314b9a1..bae27d6a 100644 --- a/com/stencyl/models/scene/ScrollingBitmap.hx +++ b/com/stencyl/models/scene/ScrollingBitmap.hx @@ -153,7 +153,7 @@ class ScrollingBitmap extends Sprite if(yP < -height || yP > height) { - yP = yP % width; + yP = yP % height; } }