Game Development Reference
In-Depth Information
To take care of this, make the following changes to the code in updateMotionY() :
@Override
protected void updateMotionY (float deltaTime) {
switch (jumpState) {
case GROUNDED:
jumpState = JUMP_STATE.FALLING;
if (velocity.x != 0) {
dustParticles.setPosition(position.x + dimension.x / 2,
position.y);
dustParticles.start();
}
break;
...
}
if (jumpState != JUMP_STATE.GROUNDED) {
dustParticles.allowCompletion();
super.updateMotionY(deltaTime);
}
}
Here is a screenshot of the result in the game:
 
Search WWH ::




Custom Search