Projectile issue with transitioning to new screen [4.1]

I have noticed an issue with my projectiles when I move from one screen to another in 4.1.

To prevent lag, I make it where the player can only have a max of 2 projectiles on screen at once.
The problem is ff I leave the screen while the projectile is still moving (not collided with a monster or solid) I lose the projectile forever, it never updates my variable to say the projectile is usable again.

I actually think I know a good fix for this, just not sure where to place it.

Since obviously you are not going to have already created a projectile before you enter a new screen, I was thinking of adding a small bit of code to whatever controls screen transitions to reset the variable to 2 every time you enter a new screen.

Looking at the screen code it looks like this may be handled by multiple scripts though. Any advice over where the best place to put this would be?

I want to reset the projectile count whether the player walks from one screen to another or teleports.
 
Answered my own question.

Could only seem to get it to work by updating the 4 'Handle x Bounds' in the defined scripts.
Just added a 2 line reset script to each.
 

dale_coop

Moderator
Staff member
Thanks for sharing that info.
Might be useful for someone in the same situation (at least for myself at some point ;)).
 
Top Bottom