summaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authorTyrannova <daniel.sluga@grb-online.net>2019-01-13 11:11:25 +0100
committerTyrannova <daniel.sluga@grb-online.net>2019-01-13 11:11:25 +0100
commit79f63500e90199c44c4f0bc635b4476ccf069b41 (patch)
treeab688bf4f8ec3b107e79637aaaf39784ea61fac3 /src/main/kotlin
parente5aca456e5ee2dd4d8c151b86c9de419f7b994c4 (diff)
downloadpluggabledino-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.kt7
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)