Does the inverted Condition of "IsOnScreen" work?

Checking if the Enemy is on Screen, if Yes, rotate Player towards the closest Enemy and set “HasTarget” to “True”. If No, set “HasTarget” to “False”
If “HasTarget” is “True” shoot.

Currently what happens is that the Player will rotate toward the target and shoot but if I move somewhere, where there are no Enemies, the player keeps shooting.

I tested it for a while and my assumption is that the invert works this way: Instead of “If there are no enemies on the screen” it is “If there are enemies outside the screen”

The same thing happened when I made my own Collision box and inverted it.

I also tested the “While” function but that crashes the game.

Am I missing something? Any advice?

Now that I think about it my assumption doesn’t make sense, if there are no enemies on screen and the enemies are off screen it should return to false but it doesn’t :neutral_face:

These are the possible solutions i came up with based on your screenshot. Hopefully i got it right and at least one of them helps ^-^

1 - You can try merging the code lines.

Like :

Meteors is on screen
Player is ready to shoot

Along with all the command lines from the 3rd event.

2 - Another problem i saw was that second event had trigger once on it. This may cause the player to stop shooting for one meteor while continuing to shoot for other meteors.

3 - You can try deleting the objects when they are outside of the screen and add a command line to player is ready to shoot to check if an object exists or not.

Example :

Player is ready to shoot
The amount of meteors on the scene is more than zero (or you can write equal or greater than 1)

4 - You can try changing the first and second event command lines to :

The amount of meteors on screen is greater than zero (or you can write equal or greater than 1)

And then invert the condition for the second command line and change the greater part to just equal to zero

5 - You can try hiding the object when they’re out of the screen. Might also try and deactivate their behaviours if they have one. Additionally you can add a command line to 3rd event so player shoots if the opacity of meteors is 255 (%100)

You can also try uploading the game file so people can fully understand what is going on in terms of other game mechanics etc.