Browse Source

stone and hero texture atlas, stone and basic hero animation, clean up

Kajetan Johannes Hammerle 5 years ago
parent
commit
a92ae18b2c
73 changed files with 222 additions and 1586 deletions
  1. BIN
      resources/crumbling_stones/crumbling_stones _f1.png
  2. BIN
      resources/crumbling_stones/crumbling_stones _f10.png
  3. BIN
      resources/crumbling_stones/crumbling_stones _f11.png
  4. BIN
      resources/crumbling_stones/crumbling_stones _f12.png
  5. BIN
      resources/crumbling_stones/crumbling_stones _f13.png
  6. BIN
      resources/crumbling_stones/crumbling_stones _f14.png
  7. BIN
      resources/crumbling_stones/crumbling_stones _f15.png
  8. BIN
      resources/crumbling_stones/crumbling_stones _f16.png
  9. BIN
      resources/crumbling_stones/crumbling_stones _f17.png
  10. BIN
      resources/crumbling_stones/crumbling_stones _f18.png
  11. BIN
      resources/crumbling_stones/crumbling_stones _f19.png
  12. BIN
      resources/crumbling_stones/crumbling_stones _f2.png
  13. BIN
      resources/crumbling_stones/crumbling_stones _f20.png
  14. BIN
      resources/crumbling_stones/crumbling_stones _f21.png
  15. BIN
      resources/crumbling_stones/crumbling_stones _f22.png
  16. BIN
      resources/crumbling_stones/crumbling_stones _f23.png
  17. BIN
      resources/crumbling_stones/crumbling_stones _f24.png
  18. BIN
      resources/crumbling_stones/crumbling_stones _f25.png
  19. BIN
      resources/crumbling_stones/crumbling_stones _f26.png
  20. BIN
      resources/crumbling_stones/crumbling_stones _f27.png
  21. BIN
      resources/crumbling_stones/crumbling_stones _f28.png
  22. BIN
      resources/crumbling_stones/crumbling_stones _f29.png
  23. BIN
      resources/crumbling_stones/crumbling_stones _f3.png
  24. BIN
      resources/crumbling_stones/crumbling_stones _f30.png
  25. BIN
      resources/crumbling_stones/crumbling_stones _f31.png
  26. BIN
      resources/crumbling_stones/crumbling_stones _f32.png
  27. BIN
      resources/crumbling_stones/crumbling_stones _f33.png
  28. BIN
      resources/crumbling_stones/crumbling_stones _f34.png
  29. BIN
      resources/crumbling_stones/crumbling_stones _f35.png
  30. BIN
      resources/crumbling_stones/crumbling_stones _f36.png
  31. BIN
      resources/crumbling_stones/crumbling_stones _f37.png
  32. BIN
      resources/crumbling_stones/crumbling_stones _f38.png
  33. BIN
      resources/crumbling_stones/crumbling_stones _f39.png
  34. BIN
      resources/crumbling_stones/crumbling_stones _f4.png
  35. BIN
      resources/crumbling_stones/crumbling_stones _f40.png
  36. BIN
      resources/crumbling_stones/crumbling_stones _f41.png
  37. BIN
      resources/crumbling_stones/crumbling_stones _f5.png
  38. BIN
      resources/crumbling_stones/crumbling_stones _f6.png
  39. BIN
      resources/crumbling_stones/crumbling_stones _f7.png
  40. BIN
      resources/crumbling_stones/crumbling_stones _f8.png
  41. BIN
      resources/crumbling_stones/crumbling_stones _f9.png
  42. BIN
      resources/crumbling_stones/crumbling_stones.png
  43. BIN
      resources/hero.png
  44. BIN
      resources/hero.xcf
  45. BIN
      resources/stone.png
  46. BIN
      resources/stone.xcf
  47. BIN
      resources/tiles.png
  48. BIN
      resources/tiles.xcf
  49. 2 2
      src/me/hammerle/supersnuvi/Game.java
  50. 24 8
      src/me/hammerle/supersnuvi/entity/Entity.java
  51. 4 11
      src/me/hammerle/supersnuvi/entity/EntityBuilder.java
  52. 13 0
      src/me/hammerle/supersnuvi/entity/components/DefaultMovement.java
  53. 5 0
      src/me/hammerle/supersnuvi/entity/components/Movement.java
  54. 2 1
      src/me/hammerle/supersnuvi/entity/components/NoHealth.java
  55. 9 0
      src/me/hammerle/supersnuvi/entity/components/ai/Controller.java
  56. 88 215
      src/me/hammerle/supersnuvi/entity/components/ai/HumanController.java
  57. 47 0
      src/me/hammerle/supersnuvi/entity/components/ai/StoneController.java
  58. 0 516
      src/me/hammerle/supersnuvi/entity/components/animator/HeroAnimator.java
  59. 1 4
      src/me/hammerle/supersnuvi/entity/components/animator/LondonerAnimator.java
  60. 0 24
      src/me/hammerle/supersnuvi/entity/components/animator/Renderer.java
  61. 0 66
      src/me/hammerle/supersnuvi/entity/components/animator/StoneAnimator.java
  62. 18 63
      src/me/hammerle/supersnuvi/gamelogic/Level.java
  63. 0 42
      src/me/hammerle/supersnuvi/javafx/IJavaRenderer.java
  64. 0 12
      src/me/hammerle/supersnuvi/javafx/IKeyBinding.java
  65. 0 74
      src/me/hammerle/supersnuvi/javafx/Image.java
  66. 0 250
      src/me/hammerle/supersnuvi/javafx/JavaRenderer.java
  67. 0 59
      src/me/hammerle/supersnuvi/javafx/ResourceImage.java
  68. 0 59
      src/me/hammerle/supersnuvi/javafx/WritableImage.java
  69. 0 60
      src/me/hammerle/supersnuvi/rendering/IRenderer.java
  70. 8 14
      src/me/hammerle/supersnuvi/tiles/CrumblingStoneTile.java
  71. 0 59
      src/me/hammerle/supersnuvi/tiles/FogTile.java
  72. 1 13
      src/me/hammerle/supersnuvi/tiles/Tile.java
  73. 0 34
      src/me/hammerle/supersnuvi/util/Utils.java

BIN
resources/crumbling_stones/crumbling_stones _f1.png


BIN
resources/crumbling_stones/crumbling_stones _f10.png


BIN
resources/crumbling_stones/crumbling_stones _f11.png


BIN
resources/crumbling_stones/crumbling_stones _f12.png


BIN
resources/crumbling_stones/crumbling_stones _f13.png


BIN
resources/crumbling_stones/crumbling_stones _f14.png


BIN
resources/crumbling_stones/crumbling_stones _f15.png


BIN
resources/crumbling_stones/crumbling_stones _f16.png


BIN
resources/crumbling_stones/crumbling_stones _f17.png


BIN
resources/crumbling_stones/crumbling_stones _f18.png


BIN
resources/crumbling_stones/crumbling_stones _f19.png


BIN
resources/crumbling_stones/crumbling_stones _f2.png


BIN
resources/crumbling_stones/crumbling_stones _f20.png


BIN
resources/crumbling_stones/crumbling_stones _f21.png


BIN
resources/crumbling_stones/crumbling_stones _f22.png


BIN
resources/crumbling_stones/crumbling_stones _f23.png


BIN
resources/crumbling_stones/crumbling_stones _f24.png


BIN
resources/crumbling_stones/crumbling_stones _f25.png


BIN
resources/crumbling_stones/crumbling_stones _f26.png


BIN
resources/crumbling_stones/crumbling_stones _f27.png


BIN
resources/crumbling_stones/crumbling_stones _f28.png


BIN
resources/crumbling_stones/crumbling_stones _f29.png


BIN
resources/crumbling_stones/crumbling_stones _f3.png


BIN
resources/crumbling_stones/crumbling_stones _f30.png


BIN
resources/crumbling_stones/crumbling_stones _f31.png


BIN
resources/crumbling_stones/crumbling_stones _f32.png


BIN
resources/crumbling_stones/crumbling_stones _f33.png


BIN
resources/crumbling_stones/crumbling_stones _f34.png


BIN
resources/crumbling_stones/crumbling_stones _f35.png


BIN
resources/crumbling_stones/crumbling_stones _f36.png


BIN
resources/crumbling_stones/crumbling_stones _f37.png


BIN
resources/crumbling_stones/crumbling_stones _f38.png


BIN
resources/crumbling_stones/crumbling_stones _f39.png


BIN
resources/crumbling_stones/crumbling_stones _f4.png


BIN
resources/crumbling_stones/crumbling_stones _f40.png


BIN
resources/crumbling_stones/crumbling_stones _f41.png


BIN
resources/crumbling_stones/crumbling_stones _f5.png


BIN
resources/crumbling_stones/crumbling_stones _f6.png


BIN
resources/crumbling_stones/crumbling_stones _f7.png


BIN
resources/crumbling_stones/crumbling_stones _f8.png


BIN
resources/crumbling_stones/crumbling_stones _f9.png


BIN
resources/crumbling_stones/crumbling_stones.png


BIN
resources/hero.png


BIN
resources/hero.xcf


BIN
resources/stone.png


BIN
resources/stone.xcf


BIN
resources/tiles.png


BIN
resources/tiles.xcf


+ 2 - 2
src/me/hammerle/supersnuvi/Game.java

@@ -635,10 +635,10 @@ public class Game extends Engine
         registeredTiles.put(211, new DecoShroomTile(0.0625f, 0.1875f, 0.125f, 0.21875f));
         
         // fog, starting late to make length changes possible
-        for(int i = 0; i < 16; i++)
+        /*for(int i = 0; i < 16; i++)
         {
             registeredTiles.put(16000 + i, new FogTile((i + 1) / 16.0));
-        }
+        }*/
         
         // london stuff
         //registeredTiles.put(224, new BaseBoxTile("london_background/london_background"));

+ 24 - 8
src/me/hammerle/supersnuvi/entity/Entity.java

@@ -1,7 +1,6 @@
 package me.hammerle.supersnuvi.entity;
 
 import java.util.List;
-import me.hammerle.supersnuvi.entity.components.animator.Renderer;
 import me.hammerle.supersnuvi.entity.components.ai.Controller;
 import me.hammerle.supersnuvi.entity.components.Energy;
 import me.hammerle.supersnuvi.entity.components.Health;
@@ -41,13 +40,15 @@ public final class Entity
     private final Level level;
     
     // entity components
-    protected Renderer renderer;   
     protected Controller controller;
     protected Health health;
     protected Energy energy;
     protected Movement move;
     protected ItemCollector itemCollector;
     
+    // face
+    private Face face;
+    
     protected Entity(Level level, float x, float y, CollisionBox box)
     {
         lastPosX = x;
@@ -66,7 +67,6 @@ public final class Entity
         this.level = level;
         
         // components
-        this.renderer = Renderer.NULL;
         this.controller = Controller.NULL;
         this.health = Health.NULL;
         this.energy = Energy.NULL;
@@ -85,7 +85,7 @@ public final class Entity
     
     public boolean isAnimated()
     {
-        return renderer.isAnimated();
+        return controller.isAnimated();
     }
     
     public Health getHealth()
@@ -119,6 +119,11 @@ public final class Entity
                 e.posX + e.box.getWidth() * 0.5f, e.posY + e.box.getHeight() * 0.5f);
     }
     
+    public CollisionBox getBox()
+    {
+        return box;
+    }
+    
     public float getX()
     {
         return posX;
@@ -151,7 +156,7 @@ public final class Entity
     
     public Face getFace()
     {
-        return preMotionX > 0.0f ? Face.RIGHT : Face.LEFT;
+        return face;
     }
     
     public float getMotionX()
@@ -200,6 +205,11 @@ public final class Entity
         preMotionX = motionX;
         preMotionY = motionY;
         
+        if(preMotionX != 0.0f)
+        {
+            face = preMotionX > 0.0f ? Face.RIGHT : Face.LEFT;
+        }
+        
         if(move.hasGravity())
         {
             preMotionY += GRAVITY * move.getGravityFactor();
@@ -213,7 +223,7 @@ public final class Entity
         else
         {
             CollisionBox testBox = box.copy().expand(preMotionX, preMotionY);
-            List<CollisionBox> boxes = level.getMovementBoxesAt(testBox);
+            List<CollisionBox> boxes = level.getMovementBoxesAt(testBox, this);
             if(!boxes.isEmpty())
             {
                 float mx = preMotionX;
@@ -322,7 +332,7 @@ public final class Entity
         onGround = preMotionY > 0.0f && motionY == 0;
         
         move.setInWater(false);
-        move.setFrictionFactor(0.7f);
+        move.setFrictionFactor(0.6f);
         // apply collision
         CollisionBox cb = box.copy();
         for(Face f : Face.values())
@@ -336,11 +346,17 @@ public final class Entity
                 loc.getTile().onEntityCollide(this, loc.getX(), loc.getY(), f.getOpposite());
             });
         }
+        
+        motionX *= move.getFrictionFactor();
+        if(Math.abs(motionX) < 0.3)
+        {
+            motionX = 0.0f;
+        }
     }
     
     public void renderTick(float lag)
     {
-        renderer.renderTick(lag);
+        controller.renderTick(lag);
     }
     
     //--------------------------------------------------------------------------

+ 4 - 11
src/me/hammerle/supersnuvi/entity/EntityBuilder.java

@@ -6,29 +6,23 @@ import me.hammerle.supersnuvi.entity.components.DefaultEnergy;
 import me.hammerle.supersnuvi.entity.components.StoneMovement;
 import me.hammerle.supersnuvi.entity.components.ai.HumanController;
 import me.hammerle.supersnuvi.entity.components.ai.LondonerController;
-import me.hammerle.supersnuvi.entity.components.animator.StoneAnimator;
-import me.hammerle.supersnuvi.entity.components.animator.HeroAnimator;
-import me.hammerle.supersnuvi.entity.components.animator.LondonerAnimator;
 import me.hammerle.supersnuvi.gamelogic.Level;
 import me.hammerle.supersnuvi.tiles.Tile;
 import me.hammerle.supersnuvi.entity.components.IDeath;
 import me.hammerle.supersnuvi.entity.components.ItemCollector;
 import me.hammerle.supersnuvi.entity.components.NoHealth;
+import me.hammerle.supersnuvi.entity.components.ai.StoneController;
 import me.hammerle.supersnuvi.util.CollisionBox;
 
 public final class EntityBuilder 
 {
     public static Entity buildHero(Level level, float x, float y)
     {
-        float w = Tile.SIZE;
-        float h = Tile.SIZE * 2;
-        
-        Entity hero = new Entity(level, x, y, new CollisionBox(0.0f, 0.0f, w * 0.90625f, h * 0.921875f));
-        hero.renderer = new HeroAnimator(hero);
+        Entity hero = new Entity(level, x, y, new CollisionBox(0.0f, 5.0f, 29.0f, 64.0f));
         hero.controller = new HumanController(hero);
         hero.health = new DefaultHealth(hero, (ent) -> ent.getLevel().scheduleReset(), 100.0f, null, null, null);
         hero.energy = new DefaultEnergy(hero, 100.0f);
-        hero.move = new DefaultMovement(hero, 3f, 3f, 50.0f);
+        hero.move = new DefaultMovement(hero, 12.0f, 0.0f, 50.0f);
         hero.itemCollector = ItemCollector.HERO;
         return hero;
     }
@@ -39,7 +33,6 @@ public final class EntityBuilder
         float h = Tile.SIZE * 2;
 
         Entity hero = new Entity(level, x, y, new CollisionBox(0.0f, 0.0f, w * 0.4375f, h * 0.703125f));
-        hero.renderer = new LondonerAnimator(hero);
         //hero.controller = new FollowHeroController(hero, 2);
         hero.controller = new LondonerController(hero, evil);
         hero.health = new DefaultHealth(hero, IDeath.NULL, 100.0f, null, null, null);
@@ -52,7 +45,7 @@ public final class EntityBuilder
     public static Entity buildCrumblingStone(Level level, float x, float y)
     {
         Entity stone = new Entity(level, x, y, new CollisionBox(0.0f, 0.0f, Tile.SIZE, Tile.SIZE * 10f));
-        stone.renderer = new StoneAnimator(stone);
+        stone.controller = new StoneController(stone);
         stone.move = new StoneMovement(stone);
         stone.health = new NoHealth(stone);
         return stone;

+ 13 - 0
src/me/hammerle/supersnuvi/entity/components/DefaultMovement.java

@@ -8,6 +8,7 @@ public class DefaultMovement extends Movement
     private boolean inWater = false;
     private final float vx;
     private final float vy;
+    private float friction = 1.0f;
     
     public DefaultMovement(Entity ent, float vx, float vy, float jumpPower) 
     {
@@ -62,4 +63,16 @@ public class DefaultMovement extends Movement
     {
         inWater = b;
     }
+
+    @Override
+    public void setFrictionFactor(float f)
+    {
+        friction = f;
+    }
+
+    @Override
+    public float getFrictionFactor()
+    {
+        return friction;
+    }
 }

+ 5 - 0
src/me/hammerle/supersnuvi/entity/components/Movement.java

@@ -67,4 +67,9 @@ public class Movement
     public void setFrictionFactor(float f)
     {
     }
+    
+    public float getFrictionFactor()
+    {
+        return 1.0f;
+    }
 }

+ 2 - 1
src/me/hammerle/supersnuvi/entity/components/NoHealth.java

@@ -1,6 +1,7 @@
 package me.hammerle.supersnuvi.entity.components;
 
 import me.hammerle.supersnuvi.entity.Entity;
+import me.hammerle.supersnuvi.tiles.Tile;
 
 public class NoHealth extends Health
 {
@@ -12,6 +13,6 @@ public class NoHealth extends Health
     @Override
     public boolean shouldDespawn()
     {
-        return ent.getY() > ent.getLevel().getHeight();
+        return ent.getY() > ent.getLevel().getHeight() * Tile.SIZE;
     }
 }

+ 9 - 0
src/me/hammerle/supersnuvi/entity/components/ai/Controller.java

@@ -19,6 +19,15 @@ public class Controller
     {
     }
     
+    public void renderTick(float lag)
+    {
+    }
+    
+    public boolean isAnimated()
+    {
+        return false;
+    }
+    
     public void onCollideWithTile(Location loc, Face face)
     {
     }

+ 88 - 215
src/me/hammerle/supersnuvi/entity/components/ai/HumanController.java

@@ -1,275 +1,148 @@
 package me.hammerle.supersnuvi.entity.components.ai;
 
+import me.hammerle.snuviengine.api.Shader;
+import me.hammerle.snuviengine.api.Texture;
 import me.hammerle.supersnuvi.Keys;
 import me.hammerle.supersnuvi.entity.Entity;
-import me.hammerle.supersnuvi.tiles.Tile;
-import me.hammerle.supersnuvi.util.SoundUtils;
+import me.hammerle.supersnuvi.util.Face;
+import me.hammerle.supersnuvi.util.Utils;
 
 public class HumanController extends Controller
 {
-    private boolean combatMode = false;
-    private int combatTimer = 0;
-    private int blockTimer = -1;
-    private int attackTimer = -1;
-    private int dodgeTimer = -1;
-    private int dashTimer = -1;
+    private final static int SIZE = 1024;
+    private final static Texture HERO = new Texture("resources/hero.png");
     
-    public HumanController(Entity ent) 
+    private class TexturePart
     {
-        super(ent);
+        private boolean draw = false;
+        private float ox = 0.0f;
+        private float oy = 0.0f;
+        private float w = 0.0f;
+        private float h = 0.0f;
+        private float tx = 0.0f;
+        private float ty = 0.0f;
     }
     
-    @Override
-    public void tick()
+    private TexturePart body = new TexturePart();
+    private TexturePart arms = new TexturePart();
+    private TexturePart head = new TexturePart();
+    private TexturePart[] parts = new TexturePart[] 
     {
-        float f = 12;
-        if(Keys.RUN.isDown())
-        {
-            f = 24;
-        }
-        
-        if(Keys.RIGHT.isDown())
-        {
-            ent.setMotionX(f);
-        }
-        else if(Keys.LEFT.isDown())
-        {
-            ent.setMotionX(-f);
-        }
-        else
-        {
-            ent.setMotionX(0.0f);
-        }
-        
-        if(Keys.JUMP.isDown())
-        {
-            if(ent.getMovement().jump())
-            {
-                ent.getEnergy().addEnergyPercent(-0.3f);
-            }
-        }
-    }
+        body, arms, head
+    };
     
-    /*
-    @Override
-    public boolean isRunning() 
-    {
-        return Keys.RUN.isDown();
-    }
+    private int walkFrame = 0;
+    private int idleFrame = 0;
 
-    @Override
-    public boolean isInCombatMode() 
-    {
-        return combatMode || combatTimer < 0;
-    }
-
-    @Override
-    public int getCombatTimer() 
-    {
-        return combatTimer;
-    }
-
-    @Override
-    public boolean isBlocking() 
+    public HumanController(Entity ent) 
     {
-        return blockTimer >= 0;
+        super(ent);
     }
-
-    @Override
-    public boolean isAttacking() 
+    
+    private void nextWalkFrame()
     {
-        return attackTimer >= 0;
+        walkFrame = (walkFrame + 1) % 9;
+        idleFrame = 0;
     }
-
-    @Override
-    public boolean isDashing() 
+    
+    private void nextIdleFrame()
     {
-        return dashTimer != -1;
+        walkFrame = 0;
+        idleFrame = (idleFrame + 1) % 14;   
     }
     
-    @Override
-    public boolean isDodging() 
+    private void resetFrames()
     {
-        return dodgeTimer != -1;
+        walkFrame = 0;
+        idleFrame = 0;   
     }
     
-
     @Override
     public void tick() 
     {
-        if(ent.getHealth().isDead())
-        {
-            return;
-        }
-            
-        if(Keys.COMBAT.isReleased())
+        for(TexturePart tp : parts)
         {
-            if(combatMode)
-            {
-                combatMode = false;
-                combatTimer = -ent.getAnimator().getCombatStartTicks();
-                SoundUtils.playSound(SoundUtils.Sound.SWORD_SHEATH);               
-            }
-            else
-            {
-                combatMode = true;
-                combatTimer = ent.getAnimator().getCombatStartTicks();
-                SoundUtils.playSound(SoundUtils.Sound.SWORD_PULL);
-            }
+            tp.draw = false;
         }
         
-        if(combatTimer < 0)
-        {
-            combatTimer++;
-        }
-        else if(combatTimer > 0)
+        float speed = ent.getMovement().getVelocityX();
+        if(Keys.RUN.isDown())
         {
-            combatTimer--;
+            speed *= 1.5f;
         }
         
-        if(blockTimer != -1)
+        if(Keys.LEFT.isDown())
         {
-            blockTimer++;
-            if(blockTimer >= ent.getAnimator().getBlockTicks())
-            {
-                blockTimer = -80;
-            }
+            ent.setMotionX(-speed);
         }
         
-        if(attackTimer != -1)
+        if(Keys.RIGHT.isDown())
         {
-            attackTimer++;
-            if(attackTimer >= ent.getAnimator().getAttackTicks())
-            {
-                attackTimer = -1;
-                
-                float sign = ent.getAnimator().drawImageFlipped() ? -1 : 1;
-                float extend = sign * Tile.SIZE;
-                boolean once = true;
-                for(Entity e : ent.getLevel().getEntitiesCollidingWith(ent, ent.getBox().expand(extend, 0)))
-                {
-                    if(e.getController().isAttacking() && once)
-                    {
-                        once = false;
-                        ent.setMotionX(-sign * 7);
-                        e.setMotionX(sign * 7);
-                    }
-                    else if(!e.getController().isBlocking())
-                    {
-                        e.getHealth().addHealth(-30);
-                    }
-                }
-                return;
-            }
+            ent.setMotionX(speed);
         }
         
-        if(dodgeTimer != -1)
+        if(Keys.JUMP.isDown())
         {
-            dodgeTimer++;
-            if(dodgeTimer > 12)
-            {
-                dodgeTimer = -1;
-                ent.setMotionX(0.0f);
-            }
-            else
-            {
-                ent.setMotionX(ent.getAnimator().drawImageFlipped() ? 10 : -10);
-            }
+            ent.getMovement().jump();
         }
         
-        if(dashTimer != -1)
+        body.draw = true;
+        body.ox = 0.0f;
+        body.oy = 0.0f;
+        body.h = 64.0f;
+        body.w = 32.0f;
+        
+        if(ent.isOnGround())
         {
-            dashTimer++;
-            if(dashTimer > 15)
+            if(ent.getMotionX() == 0.0f)
             {
-                dashTimer = -1;
-                ent.setMotionX(0.0f);
+                nextIdleFrame();
+                body.tx = (idleFrame * 32.0f) / SIZE;
+                body.ty = 128.0f / SIZE;
             }
             else
             {
-                ent.setMotionX(ent.getAnimator().drawImageFlipped() ? -15 : 15);
+                nextWalkFrame();
+                body.tx = (96.0f + walkFrame * 32.0f) / SIZE;
+                body.ty = 0.0f;
             }
         }
-         
-        if(combatMode && combatTimer == 0)
+        else
         {
-            if(Keys.COMBAT_BLOCK.isDown() && blockTimer == -1)
-            {
-                ent.getAnimator().resetFrames();
-                blockTimer = 0;
-            }
-            else if(Keys.COMBAT_ATTACK.isReleased()&& attackTimer == -1)
-            {
-                SoundUtils.playSound(SoundUtils.Sound.SWORD_SLASH);
-                attackTimer = 0;
-            }
-            else if(Keys.COMBAT_DASH.isReleased() && dashTimer == -1 && ent.getEnergy().getEnergyPercent() >= 0.3)
-            {
-                SoundUtils.playSound(SoundUtils.Sound.DASH);
-                dashTimer = 0;
-                ent.getEnergy().addEnergyPercent(-0.3);
-            }
-            else if(Keys.COMBAT_DODGE.isReleased() && dodgeTimer == -1 && ent.getEnergy().getEnergyPercent() >= 0.1)
-            {
-                SoundUtils.playSound(SoundUtils.Sound.DODGE);
-                dodgeTimer = 0;
-                ent.getEnergy().addEnergyPercent(-0.10);
-            }
+            resetFrames();
+            body.tx = 0.0f;
+            body.ty = 0.0f;
         }
-        
-        
-        if(!isBlocking() && dodgeTimer == -1 && dashTimer == -1)
-        {
-            if(Keys.JUMP.isDown() && ent.getEnergy().getEnergyPercent() > 0.2 && ent.getMovement().jump())
-            {
-                ent.getEnergy().addEnergyPercent(-0.10);
-                SoundUtils.playSound(SoundUtils.Sound.JUMP);
-            }
-            
-            float speed;
-            if(ent.getController().isInCombatMode())
-            {
-                speed = 3.0f;
-            }
-            else
-            {
-                speed = 6.0f;
-                if(isRunning())
-                {
-                    if(ent.getEnergy().getEnergyPercent() > 0.0)
-                    {
-                        speed = 9.0f;
-                    }
-                    if(ent.isMoving())
-                    {
-                        ent.getEnergy().addEnergy(-0.3);
-                    }
-                }
-            }
-
-            if(dodgeTimer == -1 && dashTimer == -1)
-            {
-                if(Keys.LEFT.isDown())
-                {
-                    ent.setMotionX(-speed * ent.getMovementPenalty().getFactor());
-                }
-                else if(Keys.RIGHT.isDown())
-                {
-                    ent.setMotionX(speed * ent.getMovementPenalty().getFactor());
-                }
-            }
+    }
 
-            if(ent.isOnGround() && ent.getPreviousMotionX() != 0)
+    @Override
+    public void renderTick(float lag)
+    {
+        HERO.bind();
+        float x = Utils.interpolate(ent.getLastX(), ent.getX(), lag);
+        float y = Utils.interpolate(ent.getLastY(), ent.getY(), lag);
+        for(TexturePart tp : parts)
+        {
+            if(tp.draw)
             {
-                if(ent.getMovementPenalty().isInWater())
+                float m1;
+                float m2;
+                if(ent.getFace() == Face.LEFT)
                 {
-                    SoundUtils.playSound(SoundUtils.Sound.WALK_WATER);
+                    m1 = tp.w;
+                    m2 = 0.0f;
                 }
                 else
                 {
-                    SoundUtils.playSound(SoundUtils.Sound.WALK);
-                }           
+                    m1 = 0.0f;
+                    m2 = tp.w;
+                }
+                Shader.getTextureRenderer().drawRectangle(
+                        x + tp.ox + m1, y + tp.oy, 
+                        x + tp.ox + m2, y + tp.oy + tp.h, 
+                        tp.tx, tp.ty, 
+                        tp.tx + (tp.w / SIZE), tp.ty + (tp.h / SIZE));
             }
         }
-    }*/
+    }
 }

+ 47 - 0
src/me/hammerle/supersnuvi/entity/components/ai/StoneController.java

@@ -0,0 +1,47 @@
+package me.hammerle.supersnuvi.entity.components.ai;
+
+import me.hammerle.snuviengine.api.Shader;
+import me.hammerle.snuviengine.api.Texture;
+import me.hammerle.supersnuvi.entity.Entity;
+import me.hammerle.supersnuvi.util.Utils;
+
+public class StoneController extends Controller
+{
+    private final static Texture STONE = new Texture("resources/stone.png");
+    
+    private int frame = 0;
+    
+    public StoneController(Entity ent)
+    {
+        super(ent);
+    }
+
+    @Override
+    public boolean isAnimated()
+    {
+        return frame < 40;
+    }
+
+    @Override
+    public void renderTick(float lag)
+    {
+        STONE.bind();
+        float x = Utils.interpolate(ent.getLastX(), ent.getX(), lag);
+        float y = Utils.interpolate(ent.getLastY(), ent.getY(), lag);
+        
+        float row = (frame / 16) * 0.3125f;
+        float column = (frame % 16) * 0.0625f;
+        Shader.getTextureRenderer().drawRectangle(
+                x, y, x + 32.0f, y + 160.0f, 
+                column, row, column + 0.0625f, row + 0.3125f);
+    }
+
+    @Override
+    public void tick()
+    {
+        if(frame < 40)
+        {
+            frame++;
+        }
+    }
+}

+ 0 - 516
src/me/hammerle/supersnuvi/entity/components/animator/HeroAnimator.java

@@ -1,516 +0,0 @@
-package me.hammerle.supersnuvi.entity.components.animator;
-
-import me.hammerle.supersnuvi.Keys;
-import me.hammerle.supersnuvi.entity.Entity;
-import me.hammerle.supersnuvi.entity.components.Health;
-import me.hammerle.supersnuvi.javafx.Image;
-import me.hammerle.supersnuvi.rendering.IRenderer;
-import me.hammerle.supersnuvi.util.Utils;
-
-public class HeroAnimator extends Renderer
-{
-    /*private final static Image[] WALK = new Image[]
-    {
-        Utils.getImage("snuvi/walk/walk_f1", true),
-        Utils.getImage("snuvi/walk/walk_f2", true),
-        Utils.getImage("snuvi/walk/walk_f3", true),
-        Utils.getImage("snuvi/walk/walk_f4", true),
-        Utils.getImage("snuvi/walk/walk_f5", true),
-        Utils.getImage("snuvi/walk/walk_f6", true),
-        Utils.getImage("snuvi/walk/walk_f7", true),
-        Utils.getImage("snuvi/walk/walk_f8", true),
-        Utils.getImage("snuvi/walk/walk_f9", true)
-    };
-    
-    private final static Image JUMP = Utils.getImage("snuvi/jump", true);
-    
-    static
-    {
-        Image block3 = Utils.getImage("snuvi/block/block_f3", true);
-        BLOCK = new Image[]
-        {
-            Utils.getImage("snuvi/block/block_f1", true),
-            Utils.getImage("snuvi/block/block_f2", true),
-            block3,
-            block3,
-            block3,
-            block3,
-            block3,
-            block3,
-            block3,
-            block3
-        };
-        
-        Image headHit3 = Utils.getImage("snuvi/combat/cbat_hit_f3", true);
-        COMBAT_HEAD_HIT = new Image[]
-        {
-            Utils.getImage("snuvi/combat/cbat_hit_f1", true),
-            Utils.getImage("snuvi/combat/cbat_hit_f2", true),
-            headHit3,
-            headHit3
-        };
-    }
-    
-    private final static Image[] BLOCK;
-    
-    private final static Image[] DEATH = new Image[]
-    {
-        Utils.getImage("snuvi/death/cbat_death_f1"),
-        Utils.getImage("snuvi/death/cbat_death_f2"),
-        Utils.getImage("snuvi/death/cbat_death_f3"),
-        Utils.getImage("snuvi/death/cbat_death_f4"),
-        Utils.getImage("snuvi/death/cbat_death_f5"),
-        Utils.getImage("snuvi/death/cbat_death_f6"),
-        Utils.getImage("snuvi/death/cbat_death_f7"),
-        Utils.getImage("snuvi/death/cbat_death_f8"),
-        Utils.getImage("snuvi/death/cbat_death_f9"),
-        Utils.getImage("snuvi/death/cbat_death_f10"),
-        Utils.getImage("snuvi/death/cbat_death_f11"),
-        Utils.getImage("snuvi/death/cbat_death_f12"),
-        Utils.getImage("snuvi/death/cbat_death_f13"),
-        Utils.getImage("snuvi/death/cbat_death_f14"),
-        Utils.getImage("snuvi/death/cbat_death_f15"),
-        Utils.getImage("snuvi/death/cbat_death_f16"),
-        Utils.getImage("snuvi/death/cbat_death_f17")
-    };
-    
-    private final static Image[] COMBAT_DEATH = new Image[]
-    {
-        Utils.getImage("snuvi/combat_death/death_f1"),
-        Utils.getImage("snuvi/combat_death/death_f2"),
-        Utils.getImage("snuvi/combat_death/death_f3"),
-        Utils.getImage("snuvi/combat_death/death_f4"),
-        Utils.getImage("snuvi/combat_death/death_f5"),
-        Utils.getImage("snuvi/combat_death/death_f6"),
-        Utils.getImage("snuvi/combat_death/death_f7"),
-        Utils.getImage("snuvi/combat_death/death_f8"),
-        Utils.getImage("snuvi/combat_death/death_f9"),
-        Utils.getImage("snuvi/combat_death/death_f10"),
-        Utils.getImage("snuvi/combat_death/death_f11"),
-        Utils.getImage("snuvi/combat_death/death_f12"),
-        Utils.getImage("snuvi/combat_death/death_f13"),
-        Utils.getImage("snuvi/combat_death/death_f14"),
-        Utils.getImage("snuvi/combat_death/death_f15"),
-        Utils.getImage("snuvi/combat_death/death_f16"),
-        Utils.getImage("snuvi/combat_death/death_f17")
-    };
-    
-    private final static Image[] IDLE = new Image[]
-    {
-        Utils.getImage("snuvi/idle/idle_f1", true),
-        Utils.getImage("snuvi/idle/idle_f2", true),
-        Utils.getImage("snuvi/idle/idle_f3", true),
-        Utils.getImage("snuvi/idle/idle_f4", true),
-        Utils.getImage("snuvi/idle/idle_f5", true),
-        Utils.getImage("snuvi/idle/idle_f6", true),
-        Utils.getImage("snuvi/idle/idle_f7", true),
-        Utils.getImage("snuvi/idle/idle_f8", true),
-        Utils.getImage("snuvi/idle/idle_f9", true),
-        Utils.getImage("snuvi/idle/idle_f10", true),
-        Utils.getImage("snuvi/idle/idle_f11", true),
-        Utils.getImage("snuvi/idle/idle_f12", true),
-        Utils.getImage("snuvi/idle/idle_f13", true),
-        Utils.getImage("snuvi/idle/idle_f14", true)
-    };
-    
-    private final static Image[] COMBAT_HEAD = new Image[]
-    {
-        Utils.getImage("snuvi/combat/cbat_head_f1", true),
-        Utils.getImage("snuvi/combat/cbat_head_f2", true),
-        Utils.getImage("snuvi/combat/cbat_head_f3", true),
-        Utils.getImage("snuvi/combat/cbat_head_f4", true),
-        Utils.getImage("snuvi/combat/cbat_head_f5", true),
-        Utils.getImage("snuvi/combat/cbat_head_f6", true),
-        Utils.getImage("snuvi/combat/cbat_head_f7", true),
-        Utils.getImage("snuvi/combat/cbat_head_f8", true),
-        Utils.getImage("snuvi/combat/cbat_head_f9", true),
-        Utils.getImage("snuvi/combat/cbat_head_f10", true),
-        Utils.getImage("snuvi/combat/cbat_head_f11", true),
-        Utils.getImage("snuvi/combat/cbat_head_f12", true),
-        Utils.getImage("snuvi/combat/cbat_head_f13", true),
-        Utils.getImage("snuvi/combat/cbat_head_f14", true)
-    };
-    
-    private final static Image[] COMBAT_HEAD_HIT;
-    
-    private final static Image COMBAT_ARMS_IDLE = Utils.getImage("snuvi/combat/cbat_arms_idle", true);
-    
-    private final static Image[][] COMBAT_ARMS_SWING = new Image[][]
-    {
-        {
-            Utils.getImage("snuvi/combat/cbat_swing1_f1", true),
-            Utils.getImage("snuvi/combat/cbat_swing1_f2", true),
-            Utils.getImage("snuvi/combat/cbat_swing1_f3", true)
-        }, 
-        {
-            Utils.getImage("snuvi/combat/cbat_swing2_f1", true),
-            Utils.getImage("snuvi/combat/cbat_swing2_f2", true),
-            Utils.getImage("snuvi/combat/cbat_swing2_f3", true)
-        }, 
-        {
-            Utils.getImage("snuvi/combat/cbat_swing3_f1", true),
-            Utils.getImage("snuvi/combat/cbat_swing3_f2", true),
-            Utils.getImage("snuvi/combat/cbat_swing3_f3", true)
-        }
-    };
-    
-    private final static Image COMBAT_BODY_IDLE = Utils.getImage("snuvi/combat/cbat_idle_body", true);    
-    
-    private final static Image[] COMBAT_BODY_WALK = new Image[]
-    {
-        Utils.getImage("snuvi/combat/cbat_walk_f1", true),
-        Utils.getImage("snuvi/combat/cbat_walk_f2", true),
-        Utils.getImage("snuvi/combat/cbat_walk_f3", true),
-        Utils.getImage("snuvi/combat/cbat_walk_f4", true)
-    };
-    
-    private final static Image[] COMBAT_SWITCH = new Image[]
-    {
-        Utils.getImage("snuvi/combat/switch_f1", true),
-        Utils.getImage("snuvi/combat/switch_f2", true),
-        Utils.getImage("snuvi/combat/switch_f3", true),
-        Utils.getImage("snuvi/combat/switch_f4", true),
-        Utils.getImage("snuvi/combat/switch_f5", true),
-        Utils.getImage("snuvi/combat/switch_f6", true),
-        Utils.getImage("snuvi/combat/switch_f7", true),
-        Utils.getImage("snuvi/combat/switch_f8", true)
-    };
-    
-    private final static Image COMBAT_BODY_DODGE = Utils.getImage("snuvi/dodge", true);    
-    private final static Image COMBAT_BODY_DASH = Utils.getImage("snuvi/dash", true);    
-    private final static Image COMBAT_BODY_JUMP = Utils.getImage("snuvi/cbat_jump", true);    
-    
-    
-    private int counter = 0;
-    private int counterIdle = 0;
-    private int counterBody = 0;
-    private int counterHead = 0;
-    private int counterArms = 0;
-    private int frame = 0;
-    private int frameIdle = 0;
-    private int frameBody = 0;
-    private int frameHead = 0;
-    private int frameHeadHit = 0;
-    private int frameArms = 0;
-    
-    private int attackCounter = 0;
-
-    private boolean flipped = false;
-    */
-    public HeroAnimator(Entity ent) 
-    {
-        super(ent);
-    }
-    /*
-    @Override
-    public int getCombatStartTicks() 
-    {
-        return COMBAT_SWITCH.length * 5;
-    }
-
-    @Override
-    public int getAttackTicks() 
-    {
-        return COMBAT_ARMS_SWING[0].length * 5;
-    }
-    
-    @Override
-    public int getBlockTicks() 
-    {
-        return BLOCK.length * 5;
-    }
-    
-    @Override
-    public int getDeathTicks() 
-    {
-        return DEATH.length * 5;
-    }
-    
-    @Override
-    public void resetDefaultFrames()
-    {
-        counter = 0;
-        frame = 0;
-    }
-    
-    @Override
-    public void resetIdleFrames()
-    {
-        counterIdle = 0;
-        frameIdle = 0;
-    }
-    
-    @Override
-    public void resetHeadFrames()
-    {
-        counterHead = 0;
-        frameHead = 0;
-        frameHeadHit = 0;
-    }
-    
-    @Override
-    public void resetBodyFrames()
-    {
-        counterBody = 0;
-        frameBody = 0;
-    }
-    
-    @Override
-    public void resetArmsFrames()
-    {
-        counterArms = 0;
-        frameArms = 0;
-    }
-
-    @Override
-    public void render(IRenderer renderer) 
-    {
-        double x = ent.getX() - 2;
-        double y = ent.getY() + ent.getHeight() - 2;
-        
-        if(ent.getHealth().isDead())
-        {
-            x -= (drawImageFlipped() ? ent.getWidth() : 0);
-            if(frame >= DEATH.length)
-            {
-                frame = 0;
-            }
-            if(ent.getController().isInCombatMode())
-            {
-                renderer.drawImage(COMBAT_DEATH[frame], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-            }
-            else
-            {
-                renderer.drawImage(DEATH[frame], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-            }
-        }
-        else if(ent.getController().isInCombatMode())
-        {
-            x -= (drawImageFlipped() ? ent.getWidth() : 0);
-            if(ent.getController().isBlocking())
-            {
-                if(frame >= BLOCK.length)
-                {
-                    frame = 0;
-                }
-                bindSlot(BLOCK[frame]);
-                renderer.drawImage(BLOCK[frame], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-            }
-            else
-            {
-                // body rendering
-                if(!ent.isOnGround())
-                {
-                    bindSlot(COMBAT_BODY_JUMP);
-                    renderer.drawImage(COMBAT_BODY_JUMP, x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else if(ent.getController().isDashing())
-                {
-                    bindSlot(COMBAT_BODY_DASH);
-                    renderer.drawImage(COMBAT_BODY_DASH, x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else if(ent.getController().isDodging())
-                {
-                    bindSlot(COMBAT_BODY_DODGE);
-                    renderer.drawImage(COMBAT_BODY_DODGE, x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else if(ent.getPreviousMotionX() != 0)
-                {
-                    if(frameBody >= COMBAT_BODY_WALK.length)
-                    {
-                        frameBody = 0;
-                    }
-                    bindSlot(COMBAT_BODY_WALK[frameBody]);
-                    renderer.drawImage(COMBAT_BODY_WALK[frameBody], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else
-                {
-                    bindSlot(COMBAT_BODY_IDLE);
-                    renderer.drawImage(COMBAT_BODY_IDLE, x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-
-                // arms rendering
-                int combatStart = ent.getController().getCombatTimer();
-                if(combatStart != 0)
-                {
-                    combatStart /= 5;
-                    if(combatStart < 0)
-                    {
-                        combatStart += COMBAT_SWITCH.length;
-                    }
-                    bindSlot(COMBAT_SWITCH[combatStart]);
-                    renderer.drawImage(COMBAT_SWITCH[combatStart], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else if(ent.getController().isAttacking())
-                {
-                    Image[] attack = COMBAT_ARMS_SWING[attackCounter];
-                    if(frameArms >= attack.length)
-                    {
-                        frameArms = 0;
-                        attackCounter++;
-                        if(attackCounter >= COMBAT_ARMS_SWING.length)
-                        {
-                            attackCounter = 0;
-                        }
-                    }
-                    bindSlot(attack[frameArms]);
-                    renderer.drawImage(attack[frameArms], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else
-                {
-                    bindSlot(COMBAT_ARMS_IDLE);
-                    renderer.drawImage(COMBAT_ARMS_IDLE, x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-
-                // head rendering
-                if(ent.getHealth().hasInvincibility() && frameHeadHit < COMBAT_HEAD_HIT.length)
-                {
-                    bindSlot(COMBAT_HEAD_HIT[frameHead]);
-                    renderer.drawImage(COMBAT_HEAD_HIT[frameHead], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-                else
-                {
-                    if(frameHead >= COMBAT_HEAD.length)
-                    {
-                        frameHead = 0;
-                    }
-                    bindSlot(COMBAT_HEAD[frameHead]);
-                    renderer.drawImage(COMBAT_HEAD[frameHead], x, y, ent.getWidth() * 2, ent.getHeight(), drawImageFlipped());
-                }
-            }
-        }
-        else if(ent.isOnGround())
-        {
-            if(ent.getPreviousMotionX() != 0)
-            {
-                if(frame >= WALK.length)
-                {
-                    frame = 0;
-                }
-                bindSlot(WALK[frame]);
-                renderer.drawImage(WALK[frame], x, y, ent.getWidth(), ent.getHeight(), drawImageFlipped());
-            }
-            else
-            {
-                if(frameIdle >= IDLE.length)
-                {
-                    frameIdle = 0;
-                }
-                bindSlot(IDLE[frameIdle]);
-                renderer.drawImage(IDLE[frameIdle], x, y, ent.getWidth(), ent.getHeight(), drawImageFlipped());
-            }
-        }
-        else
-        {
-            bindSlot(JUMP);
-            renderer.drawImage(JUMP, x, y, ent.getWidth(), ent.getHeight(), drawImageFlipped());
-        }
-    }
-    
-    @Override
-    public boolean drawImageFlipped() 
-    {
-        return flipped;
-    }
-
-    @Override
-    public void tick() 
-    {   
-        counter++;
-        counterIdle++;
-        counterBody++;
-        counterHead++;
-        counterArms++;
-        if(counter >= 6) 
-        {
-            counter = 0;
-            frame++;
-        }
-        
-        if(counterIdle >= 12) 
-        {
-            counterIdle = 0;
-            frameIdle++;
-        }
-        if(counterBody >= 9)
-        {
-            counterBody = 0;
-            frameBody++;
-        }
-        if(counterArms >= 9)
-        {
-            counterArms = 0;
-            frameArms++;
-        }
-        if(counterHead >= 12) 
-        {
-            counterHead = 0;
-            frameHead++;
-            frameHeadHit++;
-        }
-        
-        if(frame < 0)
-        {
-            frame = 0;
-        }
-        
-        if(frameIdle < 0)
-        {
-            frameIdle = 0;
-        }
-        
-        if(frameBody < 0)
-        {
-            frameBody = 0;
-        }
-        
-        if(frameHead < 0)
-        {
-            frameHead = 0;
-        }
-        
-        if(frameArms < 0)
-        {
-            frameArms = 0;
-        }
-        
-        if(ent.getController().isInCombatMode())
-        {
-            if(Keys.COMBAT_SWITCH_FACE.isReleased())
-            {
-                flipped = !flipped;
-            }
-        }
-        else
-        {
-            if(ent.getMotionX() < 0)
-            {
-                flipped = true;
-            }
-            else if(ent.getMotionX() > 0)
-            {
-                flipped = false;
-            }
-        }
-    }
-    
-    private void bindSlot(Image image)
-    {
-        if(image != null)
-        {
-            Health h = ent.getHealth();
-            if(h.wasHealed())
-            {
-                image.bindSlot(1);
-            }
-            else if(h.wasHurt())
-            {
-                image.bindSlot(0);
-            }
-            else
-            {
-                image.bindSlot(-1);
-            }
-        }
-    }*/
-}

+ 1 - 4
src/me/hammerle/supersnuvi/entity/components/animator/LondonerAnimator.java

@@ -2,11 +2,9 @@ package me.hammerle.supersnuvi.entity.components.animator;
 
 import me.hammerle.supersnuvi.entity.Entity;
 import me.hammerle.supersnuvi.entity.components.Health;
-import me.hammerle.supersnuvi.javafx.Image;
-import me.hammerle.supersnuvi.rendering.IRenderer;
 import me.hammerle.supersnuvi.util.Utils;
 
-public class LondonerAnimator extends Renderer
+public class LondonerAnimator
 {
     /*private final static Image[] EVIL_ATTACK = new Image[]
     {
@@ -79,7 +77,6 @@ public class LondonerAnimator extends Renderer
     */
     public LondonerAnimator(Entity ent) 
     {
-        super(ent);
     }
     /*
     @Override

+ 0 - 24
src/me/hammerle/supersnuvi/entity/components/animator/Renderer.java

@@ -1,24 +0,0 @@
-package me.hammerle.supersnuvi.entity.components.animator;
-
-import me.hammerle.supersnuvi.entity.Entity;
-
-public class Renderer 
-{
-    public final static Renderer NULL = new Renderer(null);
-    
-    protected final Entity ent;
-    
-    protected Renderer(Entity ent)
-    {
-        this.ent = ent;
-    }
-    
-    public void renderTick(float lag)
-    {
-    }
-    
-    public boolean isAnimated()
-    {
-        return false;
-    }
-}

+ 0 - 66
src/me/hammerle/supersnuvi/entity/components/animator/StoneAnimator.java

@@ -1,66 +0,0 @@
-package me.hammerle.supersnuvi.entity.components.animator;
-
-import me.hammerle.supersnuvi.entity.Entity;
-import me.hammerle.supersnuvi.javafx.Image;
-import me.hammerle.supersnuvi.rendering.IRenderer;
-import me.hammerle.supersnuvi.util.Utils;
-
-public class StoneAnimator extends Renderer
-{
-    /*private static final Image[] BASE;
-    
-    static
-    {
-        BASE = new Image[41];
-        for(int i = 1; i <= 41; i++)
-        {
-            BASE[i - 1] = Utils.getImage("crumbling_stones/crumbling_stones _f" + i);
-        }
-    }
-    
-    private int counter = 0;
-    private int frame = 0;
-    */
-    public StoneAnimator(Entity ent) 
-    {
-        super(ent);
-    }
-    /*
-    @Override
-    public boolean hasFinished() 
-    {
-        return frame + 1 == BASE.length;
-    }   
-    
-    @Override
-    public void resetDefaultFrames()
-    {
-        counter = 0;
-        frame = 0;
-    }   
-
-    @Override
-    public void render(IRenderer renderer) 
-    {
-        renderer.drawImage(BASE[frame], ent.getX(), ent.getY() + ent.getHeight(), ent.getWidth(), ent.getHeight(), false);
-    }
-
-    @Override
-    public void tick() 
-    {   
-        if(frame < BASE.length - 1)
-        {
-            counter++;
-            if(counter >= 6) 
-            {
-                counter = 0;
-                frame++;
-            }
-
-            if(frame < 0) 
-            {
-                frame = 0;
-            }  
-        }
-    }*/
-}

+ 18 - 63
src/me/hammerle/supersnuvi/gamelogic/Level.java

@@ -5,13 +5,13 @@ import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.TreeSet;
+import java.util.stream.Collectors;
 import me.hammerle.snuviengine.api.Shader;
 import me.hammerle.snuviengine.api.Texture;
 import me.hammerle.snuviengine.api.TextureRenderer;
 import me.hammerle.supersnuvi.Game;
 import me.hammerle.supersnuvi.entity.Entity;
 import me.hammerle.supersnuvi.entity.EntityBuilder;
-import me.hammerle.supersnuvi.javafx.Image;
 import me.hammerle.supersnuvi.tiles.Location;
 import me.hammerle.supersnuvi.tiles.StartTile;
 import me.hammerle.supersnuvi.tiles.Tile;
@@ -32,7 +32,7 @@ public final class Level
     private final String fileName;
     private final String name;
     
-    private final HashMap<Integer, Entity> entities = new HashMap<>();;
+    private final HashMap<Integer, Entity> entities = new HashMap<>();
     private final LinkedList<Entity> spawnQueue = new LinkedList<>();
     private Entity hero;
     private int entityCounter = 0;
@@ -399,54 +399,7 @@ public final class Level
             return "999.9";
         }
         return String.format("%05.1f", time);
-    }
-    
-    
-    private final static Image AROUND_BACKGROUND = Utils.getImage("gui/around_bars/around_background");
-    private final static Image AROUND_FOREGROUND = Utils.getImage("gui/around_bars/around_foreground");
-    
-    private final static Image ENERGY_EMPTY = Utils.getImage("gui/energy_bar/energy_bar_empty");
-    private final static Image ENERGY_FULL = Utils.getImage("gui/energy_bar/energy_bar_full");
-    
-    private final static Image[] HEALTH_BAR = new Image[]
-    {
-        Utils.getImage("gui/health_bar/health_bar_0", true),
-        Utils.getImage("gui/health_bar/health_bar_1", true),
-        Utils.getImage("gui/health_bar/health_bar_2", true),
-        Utils.getImage("gui/health_bar/health_bar_3", true),
-        Utils.getImage("gui/health_bar/health_bar_4", true),
-        Utils.getImage("gui/health_bar/health_bar_5", true),
-        Utils.getImage("gui/health_bar/health_bar_6", true),
-        Utils.getImage("gui/health_bar/health_bar_7", true)
-    };
-    
-    private final static Image[] LIFE_OVERLAY = new Image[]
-    {
-        Utils.getImage("gui/health_num/health_num_0", true),
-        Utils.getImage("gui/health_num/health_num_1", true),
-        Utils.getImage("gui/health_num/health_num_2", true),
-        Utils.getImage("gui/health_num/health_num_3", true),
-        Utils.getImage("gui/health_num/health_num_4", true),
-        Utils.getImage("gui/health_num/health_num_5", true),
-        Utils.getImage("gui/health_num/health_num_6", true),
-        Utils.getImage("gui/health_num/health_num_7", true)
-    };
-    
-    private final static Image[] TIME_CLOCK = new Image[]
-    {
-        Utils.getImage("gui/time_icon/time_f1", true),
-        Utils.getImage("gui/time_icon/time_f2", true),
-        Utils.getImage("gui/time_icon/time_f3", true),
-        Utils.getImage("gui/time_icon/time_f4", true),
-        Utils.getImage("gui/time_icon/time_f5", true),
-        Utils.getImage("gui/time_icon/time_f6", true),
-        Utils.getImage("gui/time_icon/time_f7", true),
-        Utils.getImage("gui/time_icon/time_f8", true),
-        Utils.getImage("gui/time_icon/time_f9", true),
-        Utils.getImage("gui/time_icon/time_f10", true),
-        Utils.getImage("gui/time_icon/time_f11", true),
-        Utils.getImage("gui/time_icon/time_f12", true)
-    };
+    }   
     
     private float getViewX(float x) 
     {
@@ -564,15 +517,10 @@ public final class Level
             
             // entities
             
-            Shader.setBlendingEnabled(false);
-            Shader.setColorEnabled(true);
-            Shader.setTextureEnabled(false);
-            
-            float xPos = Utils.interpolate(hero.getLastX(), hero.getX(), lag);
-            float yPos = Utils.interpolate(hero.getLastY(), hero.getY(), lag);
-            Shader.getColorRenderer().drawRectangle(xPos, yPos, 
-                    xPos + 29, yPos + 59, 
-                    0xFFFF0000);
+            entities.values().forEach(entity -> 
+            {
+                entity.renderTick(lag);
+            });
             
             // foreground
             Shader.setColorEnabled(false);
@@ -699,9 +647,17 @@ public final class Level
         return Game.get().getTile(i).getMovementBox(x, y).reset().offset(Utils.toCoord(x), Utils.toCoord(y));
     }
     
-    public List<CollisionBox> getMovementBoxesAt(CollisionBox box)
+    public List<CollisionBox> getMovementBoxesAt(CollisionBox box, Entity not)
     {
-        LinkedList<CollisionBox> boxes = new LinkedList<>();
+        List<CollisionBox> boxes;
+        if(not != null)
+        {
+            boxes = getEntitiesCollidingWith(not, box).stream().map(ent -> ent.getBox()).collect(Collectors.toList());
+        }
+        else
+        {
+            boxes = new LinkedList<>();
+        }
         int startX = Utils.toBlock(box.getMinX());
         int endX = Utils.toBlock(box.getMaxX());
         int startY = Utils.toBlock(box.getMinY());
@@ -755,7 +711,6 @@ public final class Level
     
     public List<Entity> getEntitiesCollidingWith(Entity not, CollisionBox cb)
     {
-        // TODO
-        return new LinkedList<>();
+        return entities.values().stream().filter(ent -> ent != not && ent.getBox().isColliding(cb)).collect(Collectors.toList());
     }
 }

+ 0 - 42
src/me/hammerle/supersnuvi/javafx/IJavaRenderer.java

@@ -1,42 +0,0 @@
-package me.hammerle.supersnuvi.javafx;
-
-public interface IJavaRenderer 
-{
-    // -------------------------------------------------------------------------
-    // image rendering
-    // -------------------------------------------------------------------------
-    
-    public void drawImage(Image image, double x, double y);
-    public void drawImage(Image image, double x, double y, double w, double h);
-    public void drawImage(Image img, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
-    
-    // -------------------------------------------------------------------------
-    // primitive rendering
-    // -------------------------------------------------------------------------
-    
-    public double getWidth();
-    public double getHeight();
-    
-    public void prepareRendering();
-    
-    public void save();
-    public void restore();
-    public void setFillColor(int r, int g, int b, double alpha);
-    public void setStrokeColor(int r, int g, int b, double alpha);
-    
-    public void fillRectangle(double x, double y, double w, double h);
-    
-    public void setGlobalAlpha(double alpha);
-    
-    public void setScale(double scale);
-    
-    // -------------------------------------------------------------------------
-    // text rendering
-    // -------------------------------------------------------------------------
-    
-    public void prepareTextDrawing(int r, int g, int b, double alpha, int width);
-    public void stopTextDrawing();
-    public void drawText(double x, double y, char[] text, int max);
-    public double getTextWidth(int chars);
-    public double getTextHeight(int lines);
-}

+ 0 - 12
src/me/hammerle/supersnuvi/javafx/IKeyBinding.java

@@ -1,12 +0,0 @@
-package me.hammerle.supersnuvi.javafx;
-
-public interface IKeyBinding 
-{
-    public boolean isDown();
-    public int getDownTime();
-    public boolean wasJustReleased();
-    public void resetTime();
-    
-    public String getName();
-    public String getKeyName();
-}

+ 0 - 74
src/me/hammerle/supersnuvi/javafx/Image.java

@@ -1,74 +0,0 @@
-package me.hammerle.supersnuvi.javafx;
-
-import javafx.scene.image.PixelReader;
-import javafx.scene.image.PixelWriter;
-
-public abstract class Image 
-{
-    private javafx.scene.image.Image[] colored;
-    private int slot = -1;
-    
-    public Image()
-    {
-        colored = new javafx.scene.image.Image[0];
-    }
-    
-    public void bindSlot(int slot)
-    {
-        this.slot = slot;
-    }
-    
-    public void createSlot(int r, int g, int b, int alpha)
-    {
-        if(getImage() == null)
-        {
-            return;
-        }
-        javafx.scene.image.Image[] newColored = new javafx.scene.image.Image[colored.length + 1];
-        System.arraycopy(colored, 0, newColored, 0, colored.length);
-        javafx.scene.image.Image image = getImage();
-        PixelReader reader = image.getPixelReader();
-        int w = (int) image.getWidth();
-        int h = (int) image.getHeight();
-        javafx.scene.image.WritableImage wi = new javafx.scene.image.WritableImage(w, h);
-        PixelWriter writer = wi.getPixelWriter();
-        newColored[colored.length] = wi;
-        colored = newColored;
-        
-        int argb = (alpha << 24) | (r << 16) | (g << 8) | b;
-        for(int x = 0; x < w; x++)
-        {
-            for(int y = 0; y < h; y++)
-            {
-                writer.setArgb(x, y, mixColor(reader.getArgb(x, y), r, g, b, alpha));
-            }
-        }
-    }
-    
-    private int mixColor(int argb, int r, int g, int b, int alpha)
-    {
-        if(argb == 0)
-        {
-            return 0;
-        }
-        int br = (((argb >> 16) & 0xFF) + r) >> 1;
-        int bg = (((argb >> 8) & 0xFF) + g) >> 1;
-        int bb = ((argb & 0xFF) + b) >> 1;
-        int ba = (((argb >> 24) & 0xFF) + alpha) >> 1;
-        return (ba << 24) | (br << 16) | (bg << 8) | bb;
-    }
-    
-    protected final javafx.scene.image.Image getImageSlot()
-    {
-        if(slot < 0 || slot >= colored.length)
-        {
-            return getImage();
-        }
-        return colored[slot];
-    }
-    
-    protected abstract javafx.scene.image.Image getImage();
-    
-    public abstract double getWidth();
-    public abstract double getHeight();
-}

+ 0 - 250
src/me/hammerle/supersnuvi/javafx/JavaRenderer.java

@@ -1,250 +0,0 @@
-package me.hammerle.supersnuvi.javafx;
-
-import javafx.animation.AnimationTimer;
-import javafx.application.Application;
-import javafx.scene.Group;
-import javafx.scene.Scene;
-import javafx.scene.canvas.Canvas;
-import javafx.scene.canvas.GraphicsContext;
-import javafx.scene.paint.Color;
-import javafx.stage.Stage;
-import me.hammerle.text.SnuviTextPainter;
-
-public class JavaRenderer extends Application implements IJavaRenderer
-{
-    // -------------------------------------------------------------------------
-    // start up
-    // -------------------------------------------------------------------------
-    
-    public static void main(String[] args) 
-    {
-        Application.launch(args);
-    }
-    
-    // -------------------------------------------------------------------------
-    // javafx stuff
-    // -------------------------------------------------------------------------
-    
-    private Group root;
-    private Scene scene;
-    private Canvas canvas;
-    private GraphicsContext context;
-    
-    @Override
-    public void init() throws Exception 
-    {
-        root = new Group();
-    }
-    
-    @Override
-    public void start(Stage stage) throws Exception 
-    {
-        // setup
-        stage.setTitle("Super Snuvi");
-        scene = new Scene(root);
-        stage.setScene(scene);
-        canvas = new Canvas(800, 600);   
-        root.getChildren().add(canvas);
-        context = canvas.getGraphicsContext2D();
-        textPainter = new SnuviTextPainter(canvas);
-        // scene rescaling event
-        scene.widthProperty().addListener((observable, oldValue, newValue) -> 
-        {
-            if(oldValue.intValue() != 0)
-            {
-                canvas.setWidth(scene.getWidth());
-            }
-        });
-        scene.heightProperty().addListener((observable, oldValue, newValue) -> 
-        {
-            if(oldValue.intValue() != 0)
-            {
-                canvas.setHeight(scene.getHeight());
-            }
-        });
-        // init key listener / register key events
-        initKeyListener();
-        // start game loop
-        startLoop();
-        // stage is shown after first game loop, the first frame can be seen
-        stage.show();
-    }
-
-    @Override
-    public void stop() throws Exception 
-    {
-        if(timer != null)
-        {
-            timer.stop();
-        }
-    }
-    
-    // -------------------------------------------------------------------------
-    // game tick
-    // -------------------------------------------------------------------------
-    
-    private AnimationTimer timer = null;
-    
-    private void startLoop()
-    {
-        if(timer == null)
-        {
-            timer = new AnimationTimer() 
-            {
-                private long last = System.nanoTime();
-                private long lag = 0;
-                
-                @Override
-                public void handle(long now) 
-                {
-                    lag += now - last;
-                    last = now;
-                    while(lag >= 12_500_000)
-                    {
-                        lag -= 12_500_000;
-                    }
-                }
-            };
-            timer.start();
-        }
-    }
-    
-    // -------------------------------------------------------------------------
-    // key input
-    // -------------------------------------------------------------------------
-    
-    private void initKeyListener()
-    {
-    }
-
-    // -------------------------------------------------------------------------
-    // image rendering
-    // -------------------------------------------------------------------------
-
-    @Override
-    public void drawImage(Image image, double x, double y)
-    {
-        context.drawImage(image.getImageSlot(), x, y);
-    }
-    
-    @Override
-    public void drawImage(Image image, double x, double y, double w, double h)
-    {
-        context.drawImage(image.getImageSlot(), x, y, w, h);
-    }
-    
-    @Override
-    public void drawImage(Image image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh)
-    {
-        context.drawImage(image.getImageSlot(), sx, sy, sw, sh, dx, dy, dw, dh);
-    }
-    
-    // -------------------------------------------------------------------------
-    // primitive rendering
-    // -------------------------------------------------------------------------
-    
-    @Override
-    public double getWidth()
-    {
-        return canvas.getWidth();
-    }
-    
-    @Override
-    public double getHeight()
-    {
-        return canvas.getHeight();
-    }
-    
-    @Override
-    public void prepareRendering()
-    {
-        context.setFill(Color.BLACK);
-        context.fillRect(0, 0, getWidth(), getHeight());
-    }
-    
-    @Override
-    public void save()
-    {
-        context.save();
-    }
-
-    @Override
-    public void restore() 
-    {
-        context.restore();
-    }
-
-    @Override
-    public void setFillColor(int r, int g, int b, double alpha) 
-    {
-        context.setFill(Color.rgb(r, g, b, alpha));
-    }
-
-    @Override
-    public void setStrokeColor(int r, int g, int b, double alpha) 
-    {
-        context.setStroke(Color.rgb(r, g, b, alpha));
-    }
-    
-    @Override
-    public void fillRectangle(double x, double y, double w, double h) 
-    {
-        context.fillRect(x, y, w, h);
-    }
-    
-    
-    @Override
-    public void setGlobalAlpha(double alpha) 
-    {
-        context.setGlobalAlpha(alpha);
-    }
-    
-    @Override
-    public void setScale(double scale) 
-    {
-        context.scale(scale, scale);
-    }
-    
-    // -------------------------------------------------------------------------
-    // text rendering
-    // -------------------------------------------------------------------------
-    
-    public static final int CHARS_PER_LINE = 50;
-    private SnuviTextPainter textPainter;
-
-    @Override
-    public void prepareTextDrawing(int r, int g, int b, double alpha, int width) 
-    {
-        textPainter.setScale(1);
-        double scale = getWidth() / textPainter.getWidth(width);
-        if(scale >= 1)
-        {
-            scale = (int) scale;
-        }
-        textPainter.prepareStringDrawing(Color.rgb(r, g, b, alpha), scale);
-    }
-    
-    @Override
-    public void stopTextDrawing() 
-    {
-        textPainter.stopStringDrawing();
-    }
-
-    @Override
-    public void drawText(double x, double y, char[] text, int max) 
-    {
-        textPainter.paintString(text, x, y, max);
-    }
-
-    @Override
-    public double getTextWidth(int chars) 
-    {
-        return textPainter.getWidth(chars);
-    }
-
-    @Override
-    public double getTextHeight(int lines) 
-    {
-        return textPainter.getHeight(lines);
-    }
-}

+ 0 - 59
src/me/hammerle/supersnuvi/javafx/ResourceImage.java

@@ -1,59 +0,0 @@
-package me.hammerle.supersnuvi.javafx;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-
-public class ResourceImage extends Image
-{
-    private javafx.scene.image.Image fxImage;
-    
-    public ResourceImage()
-    {
-        fxImage = null;
-    }
-    
-    public void load(String path)
-    {
-        File f = new File(path);
-        try
-        {
-            fxImage = new javafx.scene.image.Image(new FileInputStream(f));
-        }
-        catch(FileNotFoundException ex)
-        {
-            System.err.println("can't load image from '" + f.getPath() + "'");
-        }
-    }
-    
-    public void load(String path, double rw, double rh)
-    {
-        File f = new File(path);
-        try
-        {
-            fxImage = new javafx.scene.image.Image(new FileInputStream(f), rw, rh, true, false);
-        }
-        catch(FileNotFoundException ex)
-        {
-            System.err.println("can't load image from '" + f.getPath() + "'");
-        }
-    }
-
-    @Override
-    protected javafx.scene.image.Image getImage() 
-    {
-        return fxImage;
-    }
-
-    @Override
-    public double getWidth() 
-    {
-        return fxImage == null ? 0 : fxImage.getWidth();
-    }
-
-    @Override
-    public double getHeight() 
-    {
-        return fxImage == null ? 0 : fxImage.getHeight();
-    }
-}

+ 0 - 59
src/me/hammerle/supersnuvi/javafx/WritableImage.java

@@ -1,59 +0,0 @@
-package me.hammerle.supersnuvi.javafx;
-
-import javafx.scene.image.PixelWriter;
-
-public class WritableImage extends Image
-{
-    private final javafx.scene.image.WritableImage fxImage;
-    private final PixelWriter pixelWriter;
-    private final int width;
-    private final int height;
-    
-    public WritableImage(int width, int height)
-    {
-        fxImage = new javafx.scene.image.WritableImage(width, height);
-        pixelWriter = fxImage.getPixelWriter();
-        this.width = width;
-        this.height = height;
-    }
-    
-    private int toARGB(int r, int g, int b, int alpha)
-    {
-        return (b & 0xFF) | ((g & 0xFF) << 8) | ((r & 0xFF) << 16) | ((alpha & 0xFF) << 24);
-    }
-    
-    public void setPixel(int x, int y, int r, int g, int b, int alpha)
-    {
-        pixelWriter.setArgb(0, 0, toARGB(r, g, b, alpha));
-    }
-    
-    public void clear(int r, int g, int b, int alpha)
-    {
-        int black = toARGB(r, g, b, alpha);
-        for(int x = 0; x < width; x++)
-        {
-            for(int y = 0; y < height; y++)
-            {
-                pixelWriter.setArgb(x, y, black);
-            }
-        }
-    }
-
-    @Override
-    protected javafx.scene.image.Image getImage() 
-    {
-        return fxImage;
-    }
-
-    @Override
-    public double getWidth() 
-    {
-        return width;
-    }
-
-    @Override
-    public double getHeight() 
-    {
-        return height;
-    }
-}

+ 0 - 60
src/me/hammerle/supersnuvi/rendering/IRenderer.java

@@ -1,60 +0,0 @@
-package me.hammerle.supersnuvi.rendering;
-
-import me.hammerle.supersnuvi.javafx.Image;
-
-public interface IRenderer 
-{
-    // -------------------------------------------------------------------------
-    // image rendering
-    // -------------------------------------------------------------------------
-    
-    public void drawImage(Image image, double x, double y);
-    public void drawImage(Image image, double x, double y, boolean flipped);
-    public void drawImage(Image image, double x, double y, double w, double h, boolean flipped);
-    public void drawFixedImage(Image image, double x, double y);
-    public void drawFixedImage(Image image, double x, double y, double w, double h);
-    public void drawFixedImagePart(Image image, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh);
-    public void drawBlockImage(Image image, int x, int y, double offsetX, double offsetY);  
-    
-    // -------------------------------------------------------------------------
-    // primitive rendering
-    // -------------------------------------------------------------------------
-    
-    public double getWidth();
-    public double getHeight();
-    
-    public void save();
-    public void restore();
-    public void setFillColor(int r, int g, int b, double alpha);
-    public void setStrokeColor(int r, int g, int b, double alpha);
-    
-    public void fillRectangle(double x, double y, double w, double h);
-    
-    public void setGlobalAlpha(double alpha);
-    
-    public void setScale(double scale);
-    
-    // -------------------------------------------------------------------------
-    // text rendering
-    // -------------------------------------------------------------------------
-    
-    public void prepareTextDrawing(int r, int g, int b, double alpha, int width); 
-    public void stopTextDrawing();
-   
-    public void drawText(double x, double y, char[] text);
-    public void drawText(double x, double y, char[] text, int max);
-    public double getTextWidth(int chars);
-    public double getTextHeight(int lines);
-    
-    // -------------------------------------------------------------------------
-    // rendering utils
-    // -------------------------------------------------------------------------
-    
-    public int getFirstVisibleBlockX();
-    public int getFirstVisibleBlockY();
-    
-    public int getLastVisibleBlockX();
-    public int getLastVisibleBlockY();
-
-    public void setViewCenter(double x, double y);
-}

+ 8 - 14
src/me/hammerle/supersnuvi/tiles/CrumblingStoneTile.java

@@ -1,8 +1,6 @@
 package me.hammerle.supersnuvi.tiles;
 
 import java.util.HashSet;
-import me.hammerle.supersnuvi.Game;
-import me.hammerle.supersnuvi.javafx.Image;
 import me.hammerle.supersnuvi.entity.Entity;
 import me.hammerle.supersnuvi.entity.EntityBuilder;
 import me.hammerle.supersnuvi.gamelogic.Level;
@@ -11,17 +9,16 @@ import me.hammerle.supersnuvi.util.Face;
 import me.hammerle.supersnuvi.util.SoundUtils;
 import me.hammerle.supersnuvi.util.Utils;
 
-public class CrumblingStoneTile extends Tile
+public class CrumblingStoneTile extends BaseTile
 {
-    private final Image image = Utils.getTileImage("crumbling_stones/crumbling_stones");
-    
     private final HashSet<Long> states;
     
     public CrumblingStoneTile() 
     {
+        super(0.1875f, 0.125f, 0.25f, 0.1875f);
         states = new HashSet<>();
-        super.setCollisionBox(CollisionBox.createScaledTileBox(0, 0.4f, 1, 1));
-        super.setMovementBox(CollisionBox.createScaledTileBox(0, 0.4f, 1, 1));
+        super.setCollisionBox(CollisionBox.createScaledTileBox(0.0f, 0.0f, 1.0f, 0.6f));
+        super.setMovementBox(CollisionBox.createScaledTileBox(0.0f, 0.0f, 1.0f, 0.6f));
     }
 
     @Override
@@ -52,21 +49,18 @@ public class CrumblingStoneTile extends Tile
         {
             if(states.add(getKey(x, y)))
             {
+                ent.getLevel().updateTile(x, y);
                 Level l = ent.getLevel();               
-                l.spawnEntity(EntityBuilder.buildCrumblingStone(l, Utils.toCoord(x), Utils.toCoord(y - 9)));
+                l.spawnEntity(EntityBuilder.buildCrumblingStone(l, Utils.toCoord(x), Utils.toCoord(y)));
                 SoundUtils.playSound(SoundUtils.Sound.STONE_CRUMBLING);
             }
         }
     }
 
     @Override
-    public Image getImage(int x, int y) 
+    public boolean shouldRender(int x, int y)
     {
-        if(states.contains(getKey(x, y)))
-        {
-            return Game.FALLBACK_TILE.getImage(x, y);
-        }
-        return image;
+        return !states.contains(getKey(x, y));
     }
 
     @Override

+ 0 - 59
src/me/hammerle/supersnuvi/tiles/FogTile.java

@@ -1,59 +0,0 @@
-package me.hammerle.supersnuvi.tiles;
-
-import me.hammerle.supersnuvi.javafx.Image;
-import me.hammerle.supersnuvi.rendering.IRenderer;
-import me.hammerle.supersnuvi.util.Utils;
-
-public class FogTile extends Tile
-{
-    private int counter;
-    private int frame;
-    private final double alpha;
-    private final Image[] images;
-    
-    public FogTile(double alpha) 
-    {
-        counter = 0;
-        frame = 0;
-        images = new Image[32];
-        String path = "fog/fog_f";
-        for(int i = 0; i < 32; i++)
-        {
-            images[i] = Utils.getTileImage(path + (i + 1));
-        }
-        this.alpha = alpha;
-    }
-
-    @Override
-    public Image getImage(int x, int y) 
-    {
-        return images[frame];
-    }
-    
-    @Override
-    public void preRender(IRenderer renderer, int x, int y)
-    {
-        renderer.setGlobalAlpha(alpha);
-    }
-    
-    @Override
-    public void postRender(IRenderer renderer, int x, int y)
-    {
-        renderer.setGlobalAlpha(1.0);
-    }
-
-    @Override
-    public void tick() 
-    {
-        counter++;
-        if(counter > 12)
-        {
-            counter = 0;
-            frame++;
-            if(frame >= images.length)
-            {
-                frame = 0;
-            }
-        }
-    }
-}

+ 1 - 13
src/me/hammerle/supersnuvi/tiles/Tile.java

@@ -1,8 +1,6 @@
 package me.hammerle.supersnuvi.tiles;
 
-import me.hammerle.supersnuvi.javafx.Image;
 import me.hammerle.supersnuvi.entity.Entity;
-import me.hammerle.supersnuvi.rendering.IRenderer;
 import me.hammerle.supersnuvi.util.CollisionBox;
 import me.hammerle.supersnuvi.util.Face;
 
@@ -18,17 +16,7 @@ public abstract class Tile
         movementCollision = null;
         collisionBox = null;
     }
-    
-    public void preRender(IRenderer renderer, int x, int y)
-    {
-    }
-    
-    public void postRender(IRenderer renderer, int x, int y)
-    {
-    }
-    
-    public Image getImage(int x, int y) {return null;}
-    
+
     /** Sets the collision box for movement
      *
      * @param cb a collision box

+ 0 - 34
src/me/hammerle/supersnuvi/util/Utils.java

@@ -1,8 +1,5 @@
 package me.hammerle.supersnuvi.util;
 
-import me.hammerle.supersnuvi.javafx.Image;
-import me.hammerle.supersnuvi.javafx.ResourceImage;
-import me.hammerle.supersnuvi.javafx.WritableImage;
 import me.hammerle.supersnuvi.tiles.Tile;
 
 public class Utils 
@@ -29,37 +26,6 @@ public class Utils
         return (y3 - y1) * k + x1;
     }
     
-    public static Image getColoredImage(int r, int g, int b, int alpha, int width, int height)
-    {       
-        WritableImage image = new WritableImage(width, height);
-        image.clear(r, g, b, alpha);
-        return image;
-    }
-    
-    public static Image getImage(String path)
-    {
-        return getImage(path, false);
-    }
-    
-    public static Image getImage(String path, boolean overlay)
-    {
-        ResourceImage image = new ResourceImage();
-        image.load("resources/" + path + ".png");
-        if(overlay)
-        {
-            image.createSlot(255, 0, 0, 255);
-            image.createSlot(0, 255, 0, 255);
-        }
-        return image;
-    }
-    
-    public static Image getTileImage(String path)
-    {
-        ResourceImage image = new ResourceImage();
-        image.load("resources/" + path + ".png", Tile.SIZE, Tile.SIZE);
-        return image;
-    }
-    
     public static int toBlock(float c)
     {
         return (int) (c / Tile.SIZE);