Note that there are some explanatory texts on larger screens.

plurals
  1. POStart animation with AndEngine Live Wallpaper extansion
    primarykey
    data
    text
    <p>I have code like this:</p> <pre><code>public class SnowFallService extends BaseLiveWallpaperService implements IOnAreaTouchListener{ // =========================================================== // Constants // =========================================================== private static final int CAMERA_WIDTH = 480; private static final int CAMERA_HEIGHT = 800; private ArrayList&lt;Sprite&gt; allSnow = new ArrayList&lt;Sprite&gt;(); // =========================================================== // Fields // =========================================================== private ScreenOrientation screenOrientation; private static TextureRegion snowTexture; private static TextureRegion backgroundTexture; private static Textures texture = null; private Scene mScene; public org.anddev.andengine.engine.Engine onLoadEngine() { return new org.anddev.andengine.engine.Engine(new EngineOptions(true, this.screenOrientation, new FillResolutionPolicy(), new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT))); } public void onLoadResources() { texture = new Textures(this, getEngine()); } public void onUnloadResources() { } public Scene onLoadScene() { final Scene mScene = new Scene(); backgroundTexture = texture.getBackground(); mScene.attachChild(new Sprite(0, 0, backgroundTexture)); snowTexture = texture.getSnowTextureRegion(); mScene.registerUpdateHandler(new IUpdateHandler() { private long lastRaindropAdd = 0; @Override public void onUpdate(final float pSecondsElapsed) { int size = allSnow.size(); int tmpInt = 0; Random randGen = new Random(); for (int i = 0; i &lt; size; i++) { if (allSnow.get(i) != null){ Sprite snow = allSnow.get(i); tmpInt = randGen.nextInt(4); snow.setPosition(snow.getX() + (randGen.nextInt(5) - randGen.nextInt(5)) * randGen.nextInt(3), snow.getY() + tmpInt); if (snow.getY() &gt; CAMERA_HEIGHT || snow.getX() &gt; CAMERA_WIDTH) { synchronized(snow) { size--; allSnow.remove(i); mScene.detachChild(snow); } } } } tmpInt = randGen.nextInt(5000); if (System.currentTimeMillis() - lastRaindropAdd &gt; tmpInt) { lastRaindropAdd = System.currentTimeMillis(); tmpInt = randGen.nextInt(CAMERA_WIDTH); Sprite snow = getRaindrop(tmpInt, 0); allSnow.add(snow); mScene.attachChild(snow); } } @Override public void reset() { } }); return mScene; } public void onLoadComplete() { // TODO Auto-generated method stub } public void onPauseGame() { // TODO Auto-generated method stub } public void onResumeGame() { // TODO Auto-generated method stub } public Sprite getRaindrop(float x, float y) { return (new Sprite(x, y, snowTexture.deepCopy())); } @Override public boolean onAreaTouched(TouchEvent pSceneTouchEvent,ITouchArea pTouchArea, float pTouchAreaLocalX, float pTouchAreaLocalY) { if(pSceneTouchEvent.isActionDown()) { // HERE I WANT PLACE CODE, THAT WILL START ANIMATION. return true; } return false; } } </code></pre> <p>So how to start animation on click? I want to make something like small cartoon.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload