Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
npe fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ira committed Mar 13, 2017
1 parent f4679e1 commit f87a82e
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.jbox2d.dynamics.*
/**
* Created by irinagalata on 1/26/17.
*/
class CircleBody(world: World, var position: Vec2, var radius: Float, var increasedRadius: Float) {
class CircleBody(val world: World, var position: Vec2, var radius: Float, var increasedRadius: Float) {

val decreasedRadius: Float = radius

Expand All @@ -27,7 +27,7 @@ class CircleBody(world: World, var position: Vec2, var radius: Float, var increa
val isBusy: Boolean
get() = isIncreasing || isDecreasing

var physicalBody: Body
lateinit var physicalBody: Body

var increased = false

Expand Down Expand Up @@ -57,6 +57,15 @@ class CircleBody(world: World, var position: Vec2, var radius: Float, var increa
else Constant.DENSITY.SMALL

init {
while (true) {
if (world.isLocked.not()) {
initializeBody()
break
}
}
}

private fun initializeBody() {
physicalBody = world.createBody(bodyDef).apply {
createFixture(fixture)
linearDamping = damping
Expand Down

0 comments on commit f87a82e

Please sign in to comment.