From a30a3f0566b60f2a819f23a450075ec1e75cd007 Mon Sep 17 00:00:00 2001 From: josua Date: Thu, 29 Aug 2019 09:03:16 +1000 Subject: [PATCH] Made the ladder branching into the caves not happen if there is a free space under the player, removed some println functions. --- .../entity/player/EntityPlayer.java | 13 ++++-- src/shootergame/input/JoystickCallback.java | 1 - src/shootergame/resources/Resource.java | 1 - .../resources/ResourceDownload.java | 8 ++-- src/shootergame/tiles/TileBlackened.java | 2 - src/shootergame/tiles/TileLadderUp.java | 7 ++- src/shootergame/tiles/TilePortalDown.java | 43 ++++++++++++------- src/shootergame/util/math/map/Map2D.java | 1 - src/shootergame/world/layer/Layer.java | 1 - 9 files changed, 44 insertions(+), 33 deletions(-) diff --git a/src/shootergame/entity/player/EntityPlayer.java b/src/shootergame/entity/player/EntityPlayer.java index eb703d5..fd62ce0 100644 --- a/src/shootergame/entity/player/EntityPlayer.java +++ b/src/shootergame/entity/player/EntityPlayer.java @@ -37,6 +37,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive private double health_max = 1000; private double health = health_max; public boolean dead = false; + public boolean in_animation = false; public EntityPlayer() { this.angle = 45; @@ -62,11 +63,14 @@ public class EntityPlayer extends EntityVertical implements EntityAlive dead = true; health = 0; } - if(dead) return; + + // Is the player dead or in an animation + if(dead || in_animation) return; // Call super super.tick(chunk, layer); + // Regen some of the players health this.addHealth(0.1); // Rotate left @@ -108,7 +112,8 @@ public class EntityPlayer extends EntityVertical implements EntityAlive @Override public void moveTowards(double angle, double speed) { - if(!dead) super.moveTowards(angle, speed); + if(dead || in_animation) return; + super.moveTowards(angle, speed); } @Override @@ -144,7 +149,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive public void fireBullet(double angle) { - if(dead) return; + if(dead || in_animation) return; bullet_frequency += 1; bullet_frequency %= 10; @@ -158,7 +163,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive } public void throwTnt(double angle) { - if(dead) return; + if(dead || in_animation) return; Main.world.getLayer().spawnEntity(new EntityTnt(pos.copy(), angle + this.angle, 10)); } diff --git a/src/shootergame/input/JoystickCallback.java b/src/shootergame/input/JoystickCallback.java index 4e2b29a..2cd08bd 100644 --- a/src/shootergame/input/JoystickCallback.java +++ b/src/shootergame/input/JoystickCallback.java @@ -159,7 +159,6 @@ public class JoystickCallback implements GLFWJoystickCallbackI, IMainloopTask // Is the right x axis stick moved into a position (camera stick) if(right_x > 0.3 || right_x < -0.3) { - System.out.println("Angle changed"); Main.player.angle += right_x; } diff --git a/src/shootergame/resources/Resource.java b/src/shootergame/resources/Resource.java index 3af7a25..cc54506 100644 --- a/src/shootergame/resources/Resource.java +++ b/src/shootergame/resources/Resource.java @@ -135,7 +135,6 @@ public class Resource public ByteBuffer getByteBuffer() { - System.out.println(data.length); ByteBuffer buffer = ByteBuffer.allocateDirect(data.length); for(int i=0;i implements Iterable> { // Send back the object if these positions are the same if(e.pos.equal(pos)) { - //System.out.println(1); return e.o; } } diff --git a/src/shootergame/world/layer/Layer.java b/src/shootergame/world/layer/Layer.java index 5080fd2..8ebb68a 100644 --- a/src/shootergame/world/layer/Layer.java +++ b/src/shootergame/world/layer/Layer.java @@ -150,7 +150,6 @@ public class Layer for(int x=-scan_distance;x<=scan_distance;x++) { for(int y=-scan_distance;y<=scan_distance;y++) { - //System.out.println("x: "+x+", y: "+y); for(Entity e : chunks.get(new Vec2i(x+cpos.x, y+cpos.y)).getNearbyEntities(pos, distance)) { entities.add(e); }