diff --git a/bin/RabiClone.jar b/bin/RabiClone.jar index 562f092..99ebcdc 100644 Binary files a/bin/RabiClone.jar and b/bin/RabiClone.jar differ diff --git a/src/sig/RabiClone.java b/src/sig/RabiClone.java index bbcae28..155067d 100644 --- a/src/sig/RabiClone.java +++ b/src/sig/RabiClone.java @@ -11,6 +11,8 @@ import java.util.List; import sig.engine.Panel; import sig.engine.Point; +import sig.engine.Transform; +import sig.engine.objects.AnimatedObject; import sig.engine.objects.Object; import sig.map.Map; import sig.map.Maps; @@ -18,6 +20,7 @@ import sig.map.Tile; import sig.objects.ConfigureControls; import sig.objects.LevelRenderer; import sig.objects.Player; +import sig.objects.actor.RenderedObject; import sig.engine.Key; import sig.engine.KeyBind; import sig.engine.PaletteColor; @@ -46,6 +49,11 @@ public class RabiClone { public static int SIZE_MULTIPLIER = 1; public static Point MOUSE_POS; + public static boolean PLAYER_COLLISION[] = new boolean[RabiClone.BASE_WIDTH*RabiClone.BASE_HEIGHT]; + public static boolean ENEMY_COLLISION[] = new boolean[RabiClone.BASE_WIDTH*RabiClone.BASE_HEIGHT]; + public static boolean PLAYER_WEAPON_COLLISION[] = new boolean[RabiClone.BASE_WIDTH*RabiClone.BASE_HEIGHT]; + public static boolean ENEMY_WEAPON_COLLISION[] = new boolean[RabiClone.BASE_WIDTH*RabiClone.BASE_HEIGHT]; + public static PaletteColor BACKGROUND_COLOR = PaletteColor.DARK_ORCHID; public static LevelRenderer level_renderer; @@ -125,7 +133,29 @@ public class RabiClone { lastControllerScan = System.currentTimeMillis(); } + Arrays.fill(PLAYER_COLLISION,false); + Arrays.fill(ENEMY_COLLISION,false); for (int i = 0; i < OBJ.size(); i++) { + if (OBJ.get(i) instanceof RenderedObject) { + RenderedObject r = (RenderedObject)OBJ.get(i); + if (r.isFriendlyObject()) { + if (OBJ.get(i) instanceof AnimatedObject) { + AnimatedObject a = ((AnimatedObject)OBJ.get(i)); + double xpos = a.getX()-level_renderer.getX()-a.getAnimatedSpr().getWidth()/2; + double ypos = a.getY()-level_renderer.getY()-a.getAnimatedSpr().getHeight()/2; + int xindex = (int)a.getCurrentFrame()%a.getAnimatedSpr().getFrame_count(); + int yindex = ((int)a.getCurrentFrame()%a.getAnimatedSpr().getFrame_count())/a.getAnimatedSpr().getFrame_count(); + for (int y=0;y=0&&index0&&!moveDir; } + + @Override + public boolean isFriendlyObject() { + return false; + } } diff --git a/src/sig/objects/LevelRenderer.java b/src/sig/objects/LevelRenderer.java index 5e8e5a4..f4338ef 100644 --- a/src/sig/objects/LevelRenderer.java +++ b/src/sig/objects/LevelRenderer.java @@ -107,6 +107,18 @@ public class LevelRenderer extends Object{ @Override public void drawOverlay(byte[] p) { //RenderCollisionGrid(p); + //RenderPlayerCollisionGrid(p); + } + + @SuppressWarnings("unused") + private void RenderPlayerCollisionGrid(byte[] p) { + for (int y=0;y