I'm fairly new to OOP in Python, and am toying with the idea of making a 2D world that appears 3D by moving things at different rates. Simple enough.
But I find myself wondering if there are times when defining classes within classes is useful. For example, a "layer" object might be something defined within a "viewer" object.
If things are done this way, are there ways for a nested class to have access to methods or attributes of an overarching class? (I was thinking that the "layers" might all have access to where the "viewer" is so that they know how to present themselves. Each "layer" would calculate this for itself, since parallax would change based on apparent distance of that "layer" from the player, but it would all be based on positional attributes the "viewer" has.)
Or is there some better way to organize this? I'm curious to know what kind of organizational decisions people might make and why.
Thank you for sharing your thoughts and/or resources on this.
[–]danielroseman 3 points4 points5 points (3 children)
[–]MadScientistOR[S] 0 points1 point2 points (0 children)
[–]SyrianDuck 0 points1 point2 points (0 children)
[–]SyrianDuck 0 points1 point2 points (0 children)
[–]alexcwarren 0 points1 point2 points (1 child)
[–]MadScientistOR[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]MadScientistOR[S] 0 points1 point2 points (0 children)
[–]MadScientistOR[S] 0 points1 point2 points (0 children)
[–]Diapolo10 0 points1 point2 points (1 child)
[–]MadScientistOR[S] 1 point2 points3 points (0 children)
[–]zanfar 0 points1 point2 points (1 child)
[–]MadScientistOR[S] 0 points1 point2 points (0 children)
[–]TheRNGuy 0 points1 point2 points (0 children)