You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Game.prototype.switchState() is called, it calls CameraManager.prototype.destroy() which creates and assigns a new camera to its current instance variable, but the camera instance variable in the Game instance is not updated.
Wouldn't it make sense to use a getter instead of an camera instance variable for the Game class, like this:
That code above behaves differently depending on when and how often it is called. But the third and all following calls to the function print out the "Before fade" message and then do nothing at all, since the fade is called on the wrong Camera instance.
The text was updated successfully, but these errors were encountered:
When
Game.prototype.switchState()
is called, it callsCameraManager.prototype.destroy()
which creates and assigns a new camera to itscurrent
instance variable, but thecamera
instance variable in theGame
instance is not updated.Wouldn't it make sense to use a getter instead of an
camera
instance variable for theGame
class, like this:That way you do not have to keep it in sync manually.
The code that helped detect the problem:
That code above behaves differently depending on when and how often it is called. But the third and all following calls to the function print out the "Before fade" message and then do nothing at all, since the
fade
is called on the wrongCamera
instance.The text was updated successfully, but these errors were encountered: