package com.garbagecollector;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.garbagecollector.garbage.GarbageType;

/**
 * @author Alexander Semenov
 */
public class GarbageCollector extends Actor {

    private TextureRegion bucketImage;
    private GarbageType type;

    public GarbageCollector(GarbageType type) {
        this.type = type;
        Texture texture = new Texture(Gdx.files.internal("bucket_black.png"));
        bucketImage = new TextureRegion(texture);
    }

    public GarbageType getType() {
        return type;
    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        Color color = getColor();
        batch.setColor(color.r, color.g, color.b, color.a * parentAlpha);
        batch.draw(bucketImage, getX(), getY(), getOriginX(), getOriginY(),
                getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation());
    }

    @Override
    public void act(float delta) {
        super.act(delta);
        boolean isPortrait = Gdx.graphics.getHeight() > Gdx.graphics.getWidth();
        float accelerometerDelta = isPortrait ? Gdx.input.getAccelerometerX(): Gdx.input.getAccelerometerY();
        System.out.println("accelerometerX:  " + accelerometerDelta+", isPortrait "+isPortrait);
        //calculating new position of bucket
        float posDelta = accelerometerDelta * 6f * Gdx.graphics.getDensity();
        float newPos = isPortrait?(getX() - posDelta): (getX() + posDelta);
        float maxPoint = getStage().getWidth() - getWidth();

        //preventing move of bucket outside screen
        if (newPos < 0) setX(0);
        else if (newPos > maxPoint) setX(maxPoint);
        else setX(newPos);
    }
}

@@ -231,16 +231,60 @@
 Region;%0A
+import com.badlogic.gdx.math.Interpolation;%0A
 import c
@@ -369,16 +369,72 @@
 ageType;
+%0Aimport com.badlogic.gdx.scenes.scene2d.actions.Actions;
 %0A%0A/**%0A *
@@ -511,16 +511,146 @@
 ctor %7B%0A%0A
+    public static final float ACCELERATION_MULTIPLIER = 4f;%0A    private static final float ACCELERATION_DURATION_MULTIPLIER = 4f;%0A
     priv
@@ -1380,34 +1380,8 @@
 ) %7B%0A
-        super.act(delta);%0A
     
@@ -1642,31 +1642,22 @@
 +%22, 
-isPortrait %22+isPortrait
+delta: %22+delta
 );%0A 
@@ -1749,12 +1749,31 @@
 ta *
- 6f 
+ACCELERATION_MULTIPLIER
 * Gd
@@ -2014,15 +2014,18 @@
  0) 
-setX(0)
+newPos = 0
 ;%0A  
@@ -2062,21 +2062,25 @@
 nt) 
-setX(
+newPos = 
 maxPoint
 );%0A 
@@ -2075,18 +2075,18 @@
 maxPoint
-)
 ;
+%0A
 %0A       
@@ -2090,24 +2090,133 @@
     
-else setX(newPos
+addAction(Actions.moveTo(newPos, 0, delta* ACCELERATION_DURATION_MULTIPLIER, Interpolation.bounce));%0A%0A        super.act(delta
 );%0A 

Fix conflicts