I been tryna figure the same thing out aswell , I haven't figured that out yet but I did figure out something similar that might be of use , if you go to enemys entity properties , and where it says "if used" , add the value end_game_activator or what ever you want(note name isn't important , just remember what name you do use) , then add an item (to test I just used yellow coin , but you can use what ever you want as item) , in the items entity properties , change the name to match what you picked , so I used end_game_activator , so that's what I change name to , then for script , change the script to winitem.lua and change spawn at start ? to say No , this will make it so , player has to kill enemy , to spawn item , then collect item to win game
then of course if you have new level to load at end game in the items entity window you would also add the name of level as the value for "if used" , anyways for the record not tryna say imma pro or nothing just figured something out while experimenting , and wanted to share incase it helps someone