master
GammelJAN 6 years ago
parent 46c2924e0b
commit 85af56292a

@ -70,12 +70,15 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
boolean end; boolean end;
int kills;
@Override @Override
public void create(){ public void create(){
checkDoor = false; checkDoor = false;
checkDie = true; checkDie = true;
kills = 0;
end = false; end = false;
@ -160,6 +163,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(d.getCurrentEntities()[i].getType() == 2 && d.getCurrentEntities()[i].isTargetsPlayer()){ if(d.getCurrentEntities()[i].getType() == 2 && d.getCurrentEntities()[i].isTargetsPlayer()){
delete = true; delete = true;
d.getCurrentEntities()[i].attack(d.getPlayer()); d.getCurrentEntities()[i].attack(d.getPlayer());
} }
else{ else{
if(d.getCurrentEntities()[i].getType() == 0 && !d.getPlayer().isToDelete()){ if(d.getCurrentEntities()[i].getType() == 0 && !d.getPlayer().isToDelete()){
@ -233,6 +237,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
if(isDead){ if(isDead){
gs.entitySprites[j].setDie(1); gs.entitySprites[j].setDie(1);
d.getCurrentEntities()[j].setToDelete(true); d.getCurrentEntities()[j].setToDelete(true);
kills++;
} }
break; break;
} }
@ -311,7 +316,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
batch.setProjectionMatrix(gs.getCamera().combined); batch.setProjectionMatrix(gs.getCamera().combined);
gs = null; gs = null;
hc = null; hc = null;
es = new EndScreen(); es = new EndScreen(kills);
} }
es.render(batch, volume); es.render(batch, volume);
return; return;
@ -596,6 +601,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
e[i].setHp(0); e[i].setHp(0);
gs.createDmgFont((int) p.getDmg(),(int)e[i].getxPos() + 10,(int) e[i].getyPos() + 20); gs.createDmgFont((int) p.getDmg(),(int)e[i].getxPos() + 10,(int) e[i].getyPos() + 20);
e[i].setToDelete(true); e[i].setToDelete(true);
kills++;
} }
else{ else{
e[i].setHp(e[i].getHp() - p.getDmg()); e[i].setHp(e[i].getHp() - p.getDmg());
@ -851,7 +857,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
return true; return true;
case 3: case 3:
mm.hide(); if(mm != null){
mm.hide();
}
ss = null; ss = null;
cs = new ControlsScreen(); cs = new ControlsScreen();
return true; return true;
@ -965,7 +973,7 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
isPaused = true; isPaused = true;
entityMovement.stop(); entityMovement.stop();
gs.stop(); gs.stop();
cs = null;
ps = new PauseScreen(); ps = new PauseScreen();
} }
public void resume(){ public void resume(){

@ -26,9 +26,9 @@ public class Player extends Entity {
this.skin = 0; this.skin = 0;
this.lvl = 1; this.lvl = 1;
this.gender = "m"; this.gender = "m";
this.maxhp = 100 * lvl; this.maxhp = 50 * lvl;
this.hp = this.maxhp; this.hp = this.maxhp;
this.standartMaxHp = 100 * lvl; this.standartMaxHp = 50 * lvl;
this.dmg = 20*lvl; this.dmg = 20*lvl;
this.standartDmg = this.dmg; this.standartDmg = this.dmg;
@ -42,9 +42,10 @@ public class Player extends Entity {
public void updateStats(int ey){ public void updateStats(int ey){
this.lvl = ey+1; this.lvl = ey+1;
this.maxhp = 100 * this.lvl; this.maxhp = 50 * this.lvl;
this.standartMaxHp = 100 * this.lvl; this.standartMaxHp = 50 * this.lvl;
this.standartDmg = 20 * this.lvl; this.standartDmg = 20 * this.lvl;
this.dmg = this.standartDmg;
updateItems(); updateItems();
} }

@ -48,7 +48,7 @@ public class ControlsScreen {
batch.begin(); batch.begin();
controlsContainerSprite.draw(batch); controlsContainerSprite.draw(batch);
//font.getData().setScale(2);
font.draw(batch,"UP:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+380); font.draw(batch,"UP:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+380);
font.draw(batch,"W", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+380); font.draw(batch,"W", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+380);
font.draw(batch,"LEFT:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+360); font.draw(batch,"LEFT:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+360);

@ -9,6 +9,7 @@ import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
@ -24,21 +25,33 @@ public class EndScreen {
float h; float h;
Sprite restartButton; Sprite restartButton;
BitmapFont font;
int kills;
public EndScreen(){ public EndScreen(int kills){
w = Gdx.graphics.getWidth(); w = Gdx.graphics.getWidth();
h = Gdx.graphics.getHeight(); h = Gdx.graphics.getHeight();
float wc = w/2; float wc = w/2;
this.kills = kills;
font = new BitmapFont();
restartButton = new Sprite(new Texture("sprites/restartButton.png")); restartButton = new Sprite(new Texture("sprites/restartButton.png"));
restartButton.setPosition(w / 2 - restartButton.getWidth() / 2, h / 2 - restartButton.getHeight() / 2); restartButton.setPosition(w / 2 - restartButton.getWidth() / 2, h / 4 - restartButton.getHeight() / 2);
} }
public void render (SpriteBatch batch, float volume) { public void render (SpriteBatch batch, float volume) {
batch.begin(); batch.begin();
restartButton.draw(batch); restartButton.draw(batch);
font.getData().setScale(5);
font.draw(batch, "ENDE", w/2-100, h-h/8);
font.getData().setScale(2);
font.draw(batch, "Kills: "+kills, restartButton.getX()+30, restartButton.getY() + 200);
batch.end(); batch.end();
} }

@ -11,6 +11,7 @@ import com.badlogic.gdx.Input;
import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.graphics.g2d.TextureRegion;
@ -25,13 +26,18 @@ public class PauseScreen{
float w = Gdx.graphics.getWidth(); float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight(); float h = Gdx.graphics.getHeight();
BitmapFont font;
Texture volumeButtonTexture; Texture volumeButtonTexture;
Texture volumeUpTexture; Texture volumeUpTexture;
Texture volumeDownTexture; Texture volumeDownTexture;
Texture volumeTexture; Texture volumeTexture;
Texture backButtonTexture; Texture backButtonTexture;
Texture quitButtonTexture; Texture quitButtonTexture;
Texture controlsButtonTexture;
Sprite controlsButtonSprite;
Sprite volumeButtonSprite; Sprite volumeButtonSprite;
Sprite volumeUpSprite; Sprite volumeUpSprite;
Sprite volumeDownSprite; Sprite volumeDownSprite;
@ -39,12 +45,19 @@ public class PauseScreen{
Sprite backButtonSprite; Sprite backButtonSprite;
Sprite quitButtonSprite; Sprite quitButtonSprite;
Sprite controlsContainerSprite;
boolean showControls;
public PauseScreen(){ public PauseScreen(){
w = Gdx.graphics.getWidth(); w = Gdx.graphics.getWidth();
h = Gdx.graphics.getHeight(); h = Gdx.graphics.getHeight();
float wc = w/2; float wc = w/2;
showControls = false;
font = new BitmapFont();
controlsButtonTexture = new Texture("sprites/controlsButton.png");
volumeButtonTexture = new Texture("sprites/volumeButton.png"); volumeButtonTexture = new Texture("sprites/volumeButton.png");
volumeUpTexture = new Texture("sprites/volumeUpButton.png"); volumeUpTexture = new Texture("sprites/volumeUpButton.png");
volumeDownTexture = new Texture("sprites/volumeDownButton.png"); volumeDownTexture = new Texture("sprites/volumeDownButton.png");
@ -52,6 +65,7 @@ public class PauseScreen{
backButtonTexture = new Texture("sprites/backButton.png"); backButtonTexture = new Texture("sprites/backButton.png");
quitButtonTexture = new Texture("sprites/quitButton.png"); quitButtonTexture = new Texture("sprites/quitButton.png");
controlsButtonSprite = new Sprite(controlsButtonTexture);
volumeButtonSprite = new Sprite(volumeButtonTexture); volumeButtonSprite = new Sprite(volumeButtonTexture);
volumeUpSprite = new Sprite(volumeUpTexture); volumeUpSprite = new Sprite(volumeUpTexture);
volumeDownSprite = new Sprite(volumeDownTexture); volumeDownSprite = new Sprite(volumeDownTexture);
@ -59,16 +73,21 @@ public class PauseScreen{
backButtonSprite = new Sprite(backButtonTexture); backButtonSprite = new Sprite(backButtonTexture);
quitButtonSprite = new Sprite(quitButtonTexture); quitButtonSprite = new Sprite(quitButtonTexture);
controlsButtonSprite.setPosition(200, 600);
volumeButtonSprite.setPosition(200, 500);
volumeDownSprite.setPosition(volumeButtonSprite.getX() + 230, volumeButtonSprite.getY()+28);
volumeUpSprite.setPosition(volumeButtonSprite.getX() + 340, volumeButtonSprite.getY()+28);
backButtonSprite.setPosition(0, 0);
quitButtonSprite.setPosition(200,300);
controlsContainerSprite = new Sprite(new Texture("sprites/controlsContainer.png"));
controlsContainerSprite.setPosition(800,250);
} }
public void render (SpriteBatch batch, float volume, OrthographicCamera camera) { public void render (SpriteBatch batch, float volume, OrthographicCamera camera) {
volumeButtonSprite.setPosition(200, 500);
volumeDownSprite.setPosition(volumeButtonSprite.getX() + 230, volumeButtonSprite.getY()+28);
volumeUpSprite.setPosition(volumeButtonSprite.getX() + 340, volumeButtonSprite.getY()+28);
backButtonSprite.setPosition(0, 0);
quitButtonSprite.setPosition(200,300);
float n = 0; float n = 0;
@ -98,7 +117,43 @@ public class PauseScreen{
volumeDownSprite.draw(batch); volumeDownSprite.draw(batch);
volumeSprite.draw(batch); volumeSprite.draw(batch);
backButtonSprite.draw(batch); backButtonSprite.draw(batch);
controlsButtonSprite.draw(batch);
//quitButtonSprite.draw(batch); //quitButtonSprite.draw(batch);
if(showControls){
controlsContainerSprite.draw(batch);
//font.getData().setScale(2);
font.draw(batch,"UP:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+380);
font.draw(batch,"W", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+380);
font.draw(batch,"LEFT:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+360);
font.draw(batch,"A", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+360);
font.draw(batch,"DOWN:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+340);
font.draw(batch,"S", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+340);
font.draw(batch,"RIGHT:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+320);
font.draw(batch,"D", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+320);
font.draw(batch,"SHOOT UP:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+280);
font.draw(batch,"ARROW-KEY UP", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+280);
font.draw(batch,"SHOOT LEFT:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+260);
font.draw(batch,"ARROW-KEY LEFT", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+260);
font.draw(batch,"SHOOT DOWN:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+240);
font.draw(batch,"ARROW-KEY DOWN", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+240);
font.draw(batch,"SHOOT RIGHT:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+220);
font.draw(batch,"ARROW-KEY RIGHT", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+220);
font.draw(batch,"MELEE ATTACK:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+180);
font.draw(batch,"SPACE", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+180);
font.draw(batch,"EQUIP ITEM:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+140);
font.draw(batch,"R", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+140);
font.draw(batch,"DROP ITEM:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+120);
font.draw(batch,"Q", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+120);
font.draw(batch,"USE ITEM:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+100);
font.draw(batch,"E", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+100);
font.draw(batch,"SELECT ITEM:", controlsContainerSprite.getX() + 20, controlsContainerSprite.getY()+80);
font.draw(batch,"SCROLL WHEEL", controlsContainerSprite.getX() + 220, controlsContainerSprite.getY()+80);
}
batch.end(); batch.end();
} }
@ -117,6 +172,15 @@ public class PauseScreen{
if(Intersector.overlaps(r, backButtonSprite.getBoundingRectangle())){ if(Intersector.overlaps(r, backButtonSprite.getBoundingRectangle())){
return 5; //proceed Game return 5; //proceed Game
} }
if(Intersector.overlaps(r, controlsButtonSprite.getBoundingRectangle())){
if(showControls){
showControls = false;
}
else{
showControls = true;
}
return -1; //controlsScreen
}
if(Intersector.overlaps(r, volumeDownSprite.getBoundingRectangle())){ if(Intersector.overlaps(r, volumeDownSprite.getBoundingRectangle())){
return 9; //volume DOWN return 9; //volume DOWN
} }

@ -56,6 +56,11 @@ public class SettingsScreen {
volumeSprite = new Sprite(volumeTexture); volumeSprite = new Sprite(volumeTexture);
backButtonSprite = new Sprite(backButtonTexture); backButtonSprite = new Sprite(backButtonTexture);
controlsButtonSprite.setPosition(200, 600);
volumeButtonSprite.setPosition(200, 500);
volumeDownSprite.setPosition(volumeButtonSprite.getX() + 230, volumeButtonSprite.getY()+28);
volumeUpSprite.setPosition(volumeButtonSprite.getX() + 340, volumeButtonSprite.getY()+28);
backButtonSprite.setPosition(0, 0);
} }
@ -64,11 +69,7 @@ public class SettingsScreen {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
controlsButtonSprite.setPosition(200, 600);
volumeButtonSprite.setPosition(200, 500);
volumeDownSprite.setPosition(volumeButtonSprite.getX() + 230, volumeButtonSprite.getY()+28);
volumeUpSprite.setPosition(volumeButtonSprite.getX() + 340, volumeButtonSprite.getY()+28);
backButtonSprite.setPosition(0, 0);
float n = 0; float n = 0;

Loading…
Cancel
Save