zenzoa / mosi

A tiny game editor
https://zenzoa.github.io/mosi/
MIT License
96 stars 12 forks source link

[Bug] Moving/Removing a sprite on Room Load locks up #38

Closed Jademalo closed 4 years ago

Jademalo commented 4 years ago

I had a sprite that I wanted to move once the player had advanced past a specific state. Since it's not possible to remove sprites that are in different rooms, I had a check on entering a specific room that if you had an item, it would remove the sprite.

This didn't work, and caused the game to hang. I had to move that check to a trigger tile that you press after loading the room, and that worked fine, though was a bit janky.

zenzoa commented 4 years ago

Can you share the script that cause the game to hang?

Jademalo commented 4 years ago

Ok, this produces a consistent crash. Had to rewrite this since I didn't have the original that was causing a crash, but thankfully managed to make it simple.

{if {eq {var car-bee-state} 1}}
Oh no, I'm going to bee late!
{pick {sprite-at 1 10}}{remove-sprite}{/pick}
{inc-var car-bee-state}
{/if}

If this is run on room load, the game will hang. If it is run anywhere else, it is fine.

zenzoa commented 4 years ago

Thanks for the detailed repro steps! I just pushed an update that should let you run {pick} successfully from room scripts.

Jademalo commented 4 years ago

Awesome, thank you so much for the quick turnaround!