Ulbast

How to avoid maaaany collisions?

Recommended Posts

Hi, in my finished game I've found a thing, that slows my game from 60 to 30 fps. Too many collisions handlers. Well I need them to control whole game, to call all essentiall functions, but they are sloooooowing game drastically.

game.physics.arcade.collide(bullets, layer, resetBullet);
    game.physics.arcade.collide(grenades, layer, resetBullet);
    game.physics.arcade.collide(ebullets, layer, resetBullet);
    game.physics.arcade.collide(chest3, chest5, chesting);
    game.physics.arcade.overlap(bullets, ebullets, resetBullet);

It's for bullets to destroy chests, bullets with themselves and chest with chest. If I delete this, FPS goes from 30 to 60. But I need this. How can I do it? It's interesting, because the bullets aren't even created and they are slowing game. I have much more collision handlers, for every object to collide with layers and with all other objects like player, bullet, chest, another bullet, enemy bullet etc...

Full code of game is avaiable here:
redplanetgame.prv.pl

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.