Hello, I need some more understanding how viewports work in combination with sprite.
I have this small piece of code which manually sets the viewport of a sprite after its creation:
class Sprite_Picture alias_method🙂evg_sp_initialize_pu1, :initialize) def initialize(*args) evg_sp_initialize_pu1(*args) if SceneManager.scene_is?(SceneMap) self.viewport = SceneManager.scene.spriteset.get_viewport_evg(1) end endendclass Scene_Map attr_reader :spritesetendclass Spriteset_Map def get_viewport_evg(id) case id when 1 @viewport1 when 2 @viewport2 end endendIf I now change the scene and go back to Scene Map the game just crashes without any error msg.
Someone can explain to me why this happens?
I have this small piece of code which manually sets the viewport of a sprite after its creation:
class Sprite_Picture alias_method🙂evg_sp_initialize_pu1, :initialize) def initialize(*args) evg_sp_initialize_pu1(*args) if SceneManager.scene_is?(SceneMap) self.viewport = SceneManager.scene.spriteset.get_viewport_evg(1) end endendclass Scene_Map attr_reader :spritesetendclass Spriteset_Map def get_viewport_evg(id) case id when 1 @viewport1 when 2 @viewport2 end endendIf I now change the scene and go back to Scene Map the game just crashes without any error msg.
Someone can explain to me why this happens?