Closed bmarslandCN closed 1 year ago
@jwunderl ?
Hm looks like this between > v1.8.30 and < v1.10.34 (sept 30 release), so it's almost certainly somewhere in here that it changed: https://github.com/microsoft/pxt-common-packages/compare/v9.4.15...v10.1.13, I think it's caused by https://github.com/microsoft/pxt-common-packages/pull/1368 -- the stay in screen moved where it was being checked so it applied before the the position was recalculated on the camera. For what it's worth that stay in screen can be safely removed as the famera is already following the sprite, but we should fix the underlying bug.
Funnily enough, this looks like it is caused by an issue I fixed for another earlier this week with https://github.com/microsoft/pxt-common-packages/pull/1385, should be relatively simple to extend that fix over here as well
Yeah fix is here: https://github.com/microsoft/pxt-common-packages/pull/1386 but it will be a tad annoying to port as we need to test https://github.com/microsoft/pxt-common-packages/pull/1385 before release. For now, easiest would be to just remove the stay in screen
on whatever sprite you have camera follow
set to, as it won't be meaningful (the camera is already centered on it, so it can't typically go offscreen in the first place) & should cover the vast majority of cases where this will be hit
Thanks for the quick reply @jwunderl! Removing stay in screen
solves the problem, but the reason we were using it originally is because we noticed a sprite can move ever so slightly off screen / off the tilemap and get "stuck" and the stay in screen
resolves this. To recreate this using the game link I submitted above (https://arcade.makecode.com/S01883-07956-22345-45647) with stay in screen
commented out, move the sprite as far right or as far left as possible, press A to "gravity flip" and you'll notice that sometimes the sprite image flips but the ay flip doesn't happen because the sprite got "stuck" on the edge of the screen. Is this also a known bug?
@jwunderl if fixed in beta please resolve.
Yes, this should be fixed with my previous change / tested in beta and is fixed.
(we should probably update the issue template to request non-persistent share links, took me a minute to realize that the game changed slightly (it now has the stay in screen commented out which was my suggested temporary fix))
Describe the bug We are noticing a bug in the placeOnTile function in 2 separate games we created that did not exist when we created them ~2 months ago but exists in both games now.
We are using a placeOnTile function inside a user-created function to place a sprite on a specific tilemap location (the tilemap is larger than the screen size) at the start of the game, and when the sprite hits a specific wall tile (using on the onHitTile function). The sprite appears on the correct tilemap location when the game starts, but after hitting a wall, the sprite will start in the middle of the current camera view of the screen, which is causing errors, including the sprite getting "stuck" in a wall tile or the project getting stuck in a loop of restarting because the sprite is continuously hitting that specific wall tile that triggers the game to restart.
Previously, we did not encounter this bug in either of the 2 projects that used code like this (projects linked below), so we are wondering if something changed in the MakeCode editor or with some of the tilemap functionality that we should adapt to. We noticed we could fix the bug by destroying the sprite after hitting the specific wall tile, but are still curious why this bug is happening now when it did not when we tested the games 2 months ago.
To Reproduce Steps to reproduce the behavior:
Expected behavior The placeOnTile function should always run and place the sprite on the exact location given in the col/row parameters.
Screenshots
Desktop (please complete the following information):