Made portals unbreakable, made the boss immune to knockback, fixed

support/crashing issues with other controllers.
This commit is contained in:
josua 2019-10-21 09:17:45 +11:00
parent 4a53342a73
commit 1fe8670169
7 changed files with 33 additions and 10 deletions

View File

@ -14,6 +14,10 @@ public class BossBars
bossbars.add(bossbar); bossbars.add(bossbar);
} }
public static void clear() {
bossbars.clear();
}
public static void render() public static void render()
{ {
TextureReference health_fg = Textures.UI_HEALTH_FG; TextureReference health_fg = Textures.UI_HEALTH_FG;

View File

@ -228,6 +228,5 @@ public class EntityBoss extends EntityVertical implements IBossBar
@Override @Override
public void push(double amount, double angle) { public void push(double amount, double angle) {
super.push(amount, angle / 10.0);
} }
} }

View File

@ -62,6 +62,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
crossUnWalkable = false; crossUnWalkable = false;
emitsLight = true; emitsLight = true;
// Create the inventory
inventory = new Inventory(6); inventory = new Inventory(6);
} }
@ -100,7 +101,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
@Override @Override
public boolean MainLoopDelay(long millis) { public boolean MainLoopDelay(long millis) {
return millis > 5000; return millis > 2500;
} }
}); });
} }

View File

@ -137,16 +137,16 @@ public class JoystickCallback implements GLFWJoystickCallbackI, IMainloopTask
button_home = buttons.get(8) == 1 || button_home; button_home = buttons.get(8) == 1 || button_home;
left_stick_button = buttons.get(9) == 1 || left_stick_button; left_stick_button = buttons.get(9) == 1 || left_stick_button;
right_stick_button = buttons.get(10) == 1 || right_stick_button; right_stick_button = buttons.get(10) == 1 || right_stick_button;
dpad_left = buttons.get(11) == 1 || buttons.get(18) == 1 || dpad_left; dpad_left = buttons.get(11) == 1 || dpad_left;
dpad_right = buttons.get(12) == 1 || buttons.get(16) == 1 || dpad_right; dpad_right = buttons.get(12) == 1 || dpad_right;
dpad_up = buttons.get(13) == 1 || buttons.get(15) == 1 || dpad_up; dpad_up = buttons.get(13) == 1 || dpad_up;
dpad_down = buttons.get(14) == 1 || buttons.get(17) == 1 || dpad_down; dpad_down = buttons.get(14) == 1 || dpad_down;
} }
} }
catch(NullPointerException e) { catch(Exception e) {
connections.remove((Object) jid2); connections.remove((Object) jid2);
System.err.println("Removed controller "+jid2+" due to NullPointerException"); System.err.println("Removed controller "+jid2+" due to "+e.toString());
} }
Input input = Main.menu.input; Input input = Main.menu.input;

View File

@ -1,6 +1,20 @@
package shootergame.input; package shootergame.input;
import static org.lwjgl.glfw.GLFW.*; import static org.lwjgl.glfw.GLFW.GLFW_KEY_1;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_2;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_3;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_4;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_5;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_6;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_A;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_D;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_E;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_ESCAPE;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_F11;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_Q;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_S;
import static org.lwjgl.glfw.GLFW.GLFW_KEY_W;
import static org.lwjgl.glfw.GLFW.GLFW_RELEASE;
import static shootergame.input.GameInput.fireGun; import static shootergame.input.GameInput.fireGun;
import static shootergame.input.GameInput.moveDown; import static shootergame.input.GameInput.moveDown;
import static shootergame.input.GameInput.moveLeft; import static shootergame.input.GameInput.moveLeft;

View File

@ -3,6 +3,7 @@ package shootergame.menu;
import java.util.Random; import java.util.Random;
import shootergame.Main; import shootergame.Main;
import shootergame.display.bossbar.BossBars;
import shootergame.entity.player.EntityPlayer; import shootergame.entity.player.EntityPlayer;
import shootergame.init.Layers; import shootergame.init.Layers;
import shootergame.text.Text; import shootergame.text.Text;
@ -31,6 +32,7 @@ class MenuRespawn
Main.menu = new MenuGame(); Main.menu = new MenuGame();
Main.game_paused = false; Main.game_paused = false;
GameTimer.resetTime(); GameTimer.resetTime();
BossBars.clear();
} }
} }

View File

@ -5,6 +5,7 @@ import java.util.Random;
import mainloop.task.IMainloopTask; import mainloop.task.IMainloopTask;
import shootergame.Main; import shootergame.Main;
import shootergame.entity.Entity; import shootergame.entity.Entity;
import shootergame.entity.particle.ParticleBreak;
import shootergame.entity.player.EntityPlayer; import shootergame.entity.player.EntityPlayer;
import shootergame.init.Textures; import shootergame.init.Textures;
import shootergame.util.math.TileState; import shootergame.util.math.TileState;
@ -25,6 +26,7 @@ public class TileBossPortal extends TileVertical
this.opaqueTile = true; this.opaqueTile = true;
this.tileHitbox = 0.4; this.tileHitbox = 0.4;
this.tileSolid = true; this.tileSolid = true;
this.unbreakable = true;
} }
@Override @Override
@ -45,7 +47,8 @@ public class TileBossPortal extends TileVertical
// Create the boss arena // Create the boss arena
LayerGenBossArena layergen = new LayerGenBossArena(); LayerGenBossArena layergen = new LayerGenBossArena();
layergen.spawnPlayer(ep); layergen.spawnPlayer(ep);
layer.breakFrontTile(tpos); layer.setFrontTile(TileState.EMPTY, tpos);
layer.spawnEntity(new ParticleBreak(new Vec2d(tpos.x+0.5, tpos.y+0.5), state));
Main.world.setLayer(new Layer(rand, layergen, rand.nextInt())); Main.world.setLayer(new Layer(rand, layergen, rand.nextInt()));
// Do the arena falling animation // Do the arena falling animation