Closed Tajammal-Maqbool closed 7 months ago
Oohh sorry, My bad, I found the solution from chatgpt, need to increase the maxLights. Sorry for creating the issue.
import Phaser from "phaser";
import GameOverScene from "./gameOverScene";
import GameScene from "./gameScene";
import LoadingScene from "./loadingScene";
import MainMenuScene from "./mainMenuScene";
import SettingsScene from "./settingsScene";
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: "#2d2d2d",
physics: {
default: "arcade",
arcade: {
debug: false,
gravity: {
y: 100
}
}
},
maxLights: 100,
parent: "body",
dom: {
createContainer: true
},
scene: [
LoadingScene,
MainMenuScene,
SettingsScene,
GameScene,
GameOverScene
]
}
export default config;
You can increase maxLights as you've found - but I would strongly recommend you re-use the lights as well (or at least swap to using Point Lights). If the light has left the screen, or the bullet it was attached to is now destroyed, then always remove the light to free-up some resources.
Version
Description
I am adding Lights in my Scene and I faced a very serious issue. I was adding lights on dynamic bullets, When a limit of lights has been added and then removed, It stop adding lights to new bullets. Let me explain more, On the first maybe 10 bullets, lights going to added for each bullet but when this number goes cross then light is not goging to add to bullet.
Check here:
I am almost sure whenever it cross then number 10 then it leaves adding lights into scene, I am sure because I have test when score goes above the 50 then not added lights because all lighted bullets goes enemeis, On each hit, I give 5 score.
Example Test Code
Additional Information
This issue looking like maybe any condition before adding the lights or maybe due to adding too much lighting algorithm start working slow. Hopefully You will find the issue. Thanks for making the Phaser.io