Closed Sconvolto closed 6 days ago
Hi @Sconvolto following your instructions I was able to reproduce some weird issues like you describe. It seems the problem was in the calculation to determine "If Actor At Position", where it wasn't taking into account that the actor could be between tiles before doing the comparision
i.e. the check was roughly doing this this
if ((actorX == (tileX * 8)) && ((actorY) == (tileY * 8)) {
when it should have been something closer to this
if (floor(actorX / 8) == tileX) && (floor(actorY / 8) == tileY) {
I've created an updated build with this fix included which will be part of 4.1.0 when it releases. You can try the dev build early by downloading at: https://github.com/chrismaltby/gb-studio/actions/runs/10592730672 Please note though that this new build features an updated project file format so if you try it make sure to keep a backup of your project as it will be upgraded and no longer be compatible with older versions of GB Studio.
For reference this is the project I created following your instructions which now only beeps once each time the player position changes tile GitHubIssue1535.zip
Thank you Chris, looking forward to test it as soon as possible
This fix was included in the 4.1.0 release so I think this issue can be closed now :-)
Describe the bug If Player At Position ($Variable0,$Variable1) only work right when you go right!
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected, for any player step, to hear a beep an have the local variables ($Local0, $Local1) updated to player position and to ear ONE beep. Instead, this only works when going right and sometimes down, but I hear two beeps. If I go left or up, I hear continuous beeps and the local variables does not updates. Player moves normally, global variables are updated, but the TRUE event inside the If Player At Position only occours again if you move to the right. I've tried attaching the If Player At position event in other scripts, like in the OnUpdate of an actor, and the code behave in the same way.
Platform (please complete the following information):