Destroy Object Outside Screen Behaviour Doesn't Seem to be working


#1

Not sure if its some error I’ve made or if its a bug. I’ve included the Destroy Outside Screen Behaviour for bullets but when I use the debugger the instances of the bullets don’t get deleted once they cross the screen boundaries.


Destroy outside
#2

I think there’s a small margin after crossing the screen.
Can you see the position of bullets ?


#3

x > 20K , y > 30K


#4

Not sure what is happening in the debugger but when counting the number of objects it is indicating the behavior is working:


#5

Then the object exist in engine, but is not displayed ?


#6

Count(object) should return the number of objects exist in the game not just the visible ones.
So according to this expression the object does not exist after left the screen. Could confirm that by looking in to the source how this expression works I guess.


#7

Actually the debugger confirms too the objects are being deleted, I can not reproduce the problem on my side:


#8

OK so it’s working well.
@danjam84 Can you upload your project file here ?


#9

Ho do I do that? I only see an option to upload images.


#10

You can use Firefox Send, Dropbox, Google Drive or similar and share the link to the file here.


#11

I’m quite certain it’s some silly error on my side but here you go…


#12

This is indeed broken in new projects.
When I open an old project the behavior does work, but when I create a new project it doesn’t.
The project file is corrupted.

This is how it looks like in old project files that works:
“behaviors”: [
{
“name”: “DestroyOutside”,
“type”: “DestroyOutsideBehavior::DestroyOutside”,
“extraBorder”: 0
}

And this is how it looks like in new project files that does not work indeed:

“behaviors”: [
{
“name”: “DestroyOutside”,
“type”: “DestroyOutsideBehavior::DestroyOutside”
}

@4ian it is missing the “extraBorder” parameter in new project files.


#13

Fixed for next version.
Thanks @ddabrahim for spotting the issue :slight_smile:

As a work around, you can manually fix your games by adding “extraBorder” : 0 next to name and type. Be sure to make a copy of your game file before attempting this, so that you have a backup in case you break the file!!


General Collision Shapes unreliable for small images