Dependency Trigger
Tomatower opened this issue · 0 comments
Tomatower commented
Usually values depend on a higher-level logic (for example position in t depends on speed, reflection in t depends on the walls position).
Especially Environment variables like walls and map boundaries are not always aware of all the effects that depend on those - and so they shall never need to manually trigger a recalculation.
The calculated values shall define, on which values they depend.
An Example:
In Pong, the position in t+n depends on
- The speed of the ball
- The position of the walls
- The position of the paddels (may change history - or not)
So whenever such a value changes, the object has to know, that it has to double check, if it anyhow changed the future
Another example:
- The size of the playground changes (i.e. user resized the window). So all Wall-colissions have to be recalculated.
- The position (or trajectory, depends on implementation!) of the user paddle changed - so check if any update would have to be performed!
- An upgrade (collectable/buyable... ) changes the speed of the ball. The trajectory itself is still correct, but the timings have to be corrected.