Commit 10a16b50 authored by v.tarantik's avatar v.tarantik

#320 Pridani kontroly dohrani hry po kazde animaci

parent 82f27745
......@@ -28,6 +28,7 @@ import java.util.Map.Entry;
import java.util.Random;
import org.andengine.engine.options.EngineOptions;
import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.MoveModifier;
import org.andengine.entity.modifier.RotationModifier;
import org.andengine.entity.primitive.Rectangle;
......@@ -41,6 +42,8 @@ import org.andengine.opengl.texture.ITexture;
import org.andengine.opengl.texture.region.ITextureRegion;
import org.andengine.opengl.texture.region.TextureRegion;
import org.andengine.opengl.texture.region.TextureRegionFactory;
import org.andengine.util.modifier.IModifier;
import org.andengine.util.modifier.IModifier.IModifierListener;
import org.andengine.util.modifier.ease.EaseLinear;
import android.graphics.Bitmap;
......@@ -626,6 +629,20 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc
shadowSprite.unregisterEntityModifier(moveModifier);
}
moveModifier = new MoveModifier(0.2f, originalX, originalY, futureX, futureY, EaseLinear.getInstance());
moveModifier.addModifierListener(new IModifierListener<IEntity>() {
@Override
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
// nothing
}
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
if (gameRunning && checkWhetherDone()) {
onVictory();
}
}
});
scene.getChildByTag(pieceID).registerEntityModifier(moveModifier);
shadowSprite.registerEntityModifier(moveModifier);
}
......@@ -641,6 +658,21 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc
shadowSprite.unregisterEntityModifier(rotationModifier);
}
rotationModifier = new RotationModifier(0.4f, initialRotation, endRotation, EaseLinear.getInstance());
rotationModifier.addModifierListener(new IModifierListener<IEntity>() {
@Override
public void onModifierStarted(IModifier<IEntity> pModifier, IEntity pItem) {
// nothing
}
@Override
public void onModifierFinished(IModifier<IEntity> pModifier, IEntity pItem) {
if (gameRunning && checkWhetherDone()) {
onVictory();
}
}
});
scene.getChildByTag(pieceID).registerEntityModifier(rotationModifier);
shadowSprite.registerEntityModifier(rotationModifier);
}
......@@ -824,7 +856,7 @@ public class PronasledovaniActivity extends GameActivity implements IOnSceneTouc
getGameManager().setExtraInt2AndSave(++movesCounter);
}
if (checkWhetherDone()) {
if (gameRunning && checkWhetherDone()) {
onVictory();
}
animationCanceled = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment