1234567891011121314151617181920212223242526 |
- package me.hammerle.supersnuvi.tiles;
- import me.hammerle.supersnuvi.entity.Entity;
- import me.hammerle.supersnuvi.gamelogic.Level;
- import me.hammerle.supersnuvi.util.Face;
- public class SlipperyTile extends BaseBoxTile
- {
- public SlipperyTile()
- {
- super(0.25f, 0.0f, 0.3125f, 0.0625f);
- }
- @Override
- public void onEntityCollide(Entity ent, int x, int y, Face face, Level l)
- {
- if(face == Face.UP)
- {
- if(ent.getPreMotionY() != Entity.GRAVITY && Math.abs(ent.getMotionX()) <= 0.07)
- {
- ent.setMotionX(ent.getFace() == Face.RIGHT ? 5.0f : -5.0f);
- }
- ent.getMovement().setFrictionFactor(0.85f);
- }
- }
- }
|