3
votes

Me and my team are developing a HTML5 Game with the framework Phaser.io. Now we encountered a problem, since we pushed the speed of our bullets to a faster one.

this.game.physics.arcade.collide(this.objects.cups, this.obstacleLayer, this.destroy, null, this);

This is the function call, that our bullets (named cups) should collide with the obstacleLayer (where the walls are placed on).

You can run our actual version with the problem here. You can walk around with WASD and shoot with a mouseclick.

The problem is, that the bullets collide with the walls just sometimes and sometimes they do not. We tried to figure out in which special situation they collide or not, but we were not enable to locate the actual problem.

To fire our bullets we use

this.game.physics.arcade.moveToPointer(cup, 4000);

4000 is the speed. The problem occurs with higher speed, e.g. with a speed of 100 it will work. But we need minimum 2000 as the speed of our bullets.

Hope you can help us,

thank you in advance

1
Likely, you just need decrease timer interval which checks if objects are collided. - Vladimirs
Do you have any idea how to change this interval? I cant find anything about this. - Philipp Schemel

1 Answers

2
votes

Here is the source code of the phaser.io core timer https://github.com/photonstorm/phaser/blob/v2.4.4/src/time/Time.js

As Vladimirs stated in the comments you have to increase the calculated fps-rate (not the displayed) or decrease msMax value