Mario: only visit objects if they entered screen at least once

This commit is contained in:
2021-08-07 22:25:32 +02:00
parent f7002f0f38
commit 4f65dba2e0
3 changed files with 17 additions and 1 deletions
+9
View File
@@ -656,3 +656,12 @@ void MarioBlock::setBaseRect(SDL_Rect rect) {
_base_src = rect;
setType(getType());
}
void MarioBlock::checkVisibility(double rightmost_x) {
// we assume that object's X > 0 as otherwise it would be destroyed
if(!getHidden() && getAbsolutePos().getX() < rightmost_x) {
_was_visible = true;
}
}
bool MarioBlock::wasVisible() const {
return _was_visible;
}