package me.hammerle.supersnuvi.tiles;

import me.hammerle.supersnuvi.entity.Entity;
import me.hammerle.supersnuvi.util.Face;

public class SlipperyTile extends BaseBoxTile
{
    public SlipperyTile(String path) 
    {
        super(path);
    }

    @Override
    public void onEntityCollide(Entity ent, int x, int y, Face face) 
    {
        if(face == Face.UP)
        {
            if(ent.getPreviousMotionY() != -Entity.GRAVITY && Math.abs(ent.getMotionX()) <= 0.05)
            {
                ent.setMotionX(ent.drawImageFlipped() ? -2.5 : 2.5);
            }
            ent.setFriction(0.1);
        }
    }
}
