diff options
author | Tyrannova <daniel.sluga@grb-online.net> | 2019-01-13 11:11:25 +0100 |
---|---|---|
committer | Tyrannova <daniel.sluga@grb-online.net> | 2019-01-13 11:11:25 +0100 |
commit | 79f63500e90199c44c4f0bc635b4476ccf069b41 (patch) | |
tree | ab688bf4f8ec3b107e79637aaaf39784ea61fac3 /src/main/kotlin | |
parent | e5aca456e5ee2dd4d8c151b86c9de419f7b994c4 (diff) | |
download | pluggabledino-79f63500e90199c44c4f0bc635b4476ccf069b41.tar.gz pluggabledino-79f63500e90199c44c4f0bc635b4476ccf069b41.tar.bz2 pluggabledino-79f63500e90199c44c4f0bc635b4476ccf069b41.zip |
Fixed: remove offscreen cacti from list
Diffstat (limited to 'src/main/kotlin')
-rw-r--r-- | src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt b/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt index 3775faa..3375c92 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt @@ -170,9 +170,16 @@ class GameWorld : ContactListener { cacti.forEach { it.linearVelocity.set(-delta * speed, 0f) } + cacti.removeIf { + it.position.x < 0 + } + birdd.forEach { it.linearVelocity.set(-delta * speed, 0f) } + cacti.removeIf { + it.position.x < 0 + } world.step(delta, 4, 3) world.setContactListener(this) |