Jump to content

How to avoid maaaany collisions?


Ulbast
 Share

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

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...