Prevent items from teleporting when container is broken off-screen?

Psykai

Well-known member
Greetings! It's been a while since I had to post an ask here but there's a persistent annoyance within my game (and other people's games I've noticed over the years). Basically, if a projectile or long-reaching attack breaks a container that is further along the stage than the current screen, the item inside will teleport to the edge of the current screen, instead of staying where the container was. Naturally this allows the player to get health they weren't supposed to yet, and of course it also means that when they reach the boss at the end of the stage, they might have 'robbed themselves' of the health item that's there by accidentally breaking it's container earlier in the stage.

I've tried using things like subject_to_screen 0 on the items but that didn't have any effect. Initially, I planned on simply adding an offscreenkill to my projectiles, but then I realized I have attacks (such as stationary laser beams) that are not projectiles but have long-range, allowing them to hit things off-screen, so it's the items themselves that need fixing, rather than the attacks.

I imagine making individual copies of each container with a specific 'spawn entity' command on death might allow me to have them spawn the correct item in the correct place, but aside from being tedious to implement, it's an extra waste of resources the game has to load just to fix an issue that shouldn't exist in the first place, lol.

Is there a trick to make it so that if you break an off-screen obstacle, it's held item will spawn exactly where the container was, rather than teleporting to the part of the stage the player is on?
 
Back
Top Bottom