diff options
author | romangraef <romangraef@loves.dicksinhisan.us> | 2018-08-05 19:37:41 +0200 |
---|---|---|
committer | romangraef <romangraef@loves.dicksinhisan.us> | 2018-08-05 19:37:41 +0200 |
commit | 558dd3b92818566976043f750c4b3f2f34f2d17f (patch) | |
tree | 28b74f4e5133db0e1f12cb9432ed36c00ad306ce /src/main/kotlin/de/romjaki/pluggabledino/game | |
parent | 6585706c47343bcaf8145d19e4eee2f23562ec57 (diff) | |
download | pluggabledino-558dd3b92818566976043f750c4b3f2f34f2d17f.tar.gz pluggabledino-558dd3b92818566976043f750c4b3f2f34f2d17f.tar.bz2 pluggabledino-558dd3b92818566976043f750c4b3f2f34f2d17f.zip |
IMPORTANT GAME UPDATE! NOW WITH 100% MORE COMMUNISM
Diffstat (limited to 'src/main/kotlin/de/romjaki/pluggabledino/game')
-rw-r--r-- | src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt b/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt index 87b7a2c..3775faa 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt @@ -1,7 +1,6 @@ package de.romjaki.pluggabledino.game - import org.jbox2d.callbacks.ContactImpulse import org.jbox2d.callbacks.ContactListener import org.jbox2d.collision.Manifold @@ -23,10 +22,8 @@ class GameWorld : ContactListener { if (bodies.contains(dino) && cacti.any { bodies.contains(it) }) { hurt = true - } - else if (bodies.contains(dino) && birdd.any { bodies.contains(it) }) { + } else if (bodies.contains(dino) && birdd.any { bodies.contains(it) }) { hurt = true - } } @@ -108,16 +105,11 @@ class GameWorld : ContactListener { } - - - - fun rand(from: Int, to: Int): Int { return random.nextInt(to - from) + from } - fun createBird1(){ - + fun createBird1() { val body = world.createBody(birddBodyDef) @@ -136,8 +128,6 @@ class GameWorld : ContactListener { } - - fun createCactus1() { val body = world.createBody(cactiBodyDef) @@ -175,7 +165,7 @@ class GameWorld : ContactListener { createBird1() - bg = random.nextFloat() + rand(1, 2) + bg = random.nextFloat() + rand(1, 2) } cacti.forEach { it.linearVelocity.set(-delta * speed, 0f) |