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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.