|
|
|
@ -19,11 +19,7 @@ public class MainMenuScreen{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//MENU-SCREEN
|
|
|
|
//MENU-SCREEN
|
|
|
|
Texture startButtonTexture;
|
|
|
|
|
|
|
|
Texture quitButtonTexture;
|
|
|
|
|
|
|
|
Texture backgroundTexture;
|
|
|
|
|
|
|
|
Texture settingsButtonTexture;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sprite startButtonSprite;
|
|
|
|
Sprite startButtonSprite;
|
|
|
|
Sprite quitButtonSprite;
|
|
|
|
Sprite quitButtonSprite;
|
|
|
|
Sprite backgroundSprite;
|
|
|
|
Sprite backgroundSprite;
|
|
|
|
@ -41,6 +37,18 @@ public class MainMenuScreen{
|
|
|
|
// Sound
|
|
|
|
// Sound
|
|
|
|
public Music music;
|
|
|
|
public Music music;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//PLAYER PREVIEW
|
|
|
|
|
|
|
|
Sprite playerSprite;
|
|
|
|
|
|
|
|
TextureRegion[][][] playerRegion;
|
|
|
|
|
|
|
|
int shownPlayer;
|
|
|
|
|
|
|
|
Timer preview;
|
|
|
|
|
|
|
|
int animationState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Sprite skinContainer;
|
|
|
|
|
|
|
|
Sprite buttonRight;
|
|
|
|
|
|
|
|
Sprite buttonLeft;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public MainMenuScreen(float volume) {
|
|
|
|
public MainMenuScreen(float volume) {
|
|
|
|
|
|
|
|
|
|
|
|
//MENU-SCREEN
|
|
|
|
//MENU-SCREEN
|
|
|
|
@ -50,10 +58,10 @@ public class MainMenuScreen{
|
|
|
|
|
|
|
|
|
|
|
|
hidden = false;
|
|
|
|
hidden = false;
|
|
|
|
|
|
|
|
|
|
|
|
backgroundTexture = new Texture("sprites/MAINSCREEN.png");
|
|
|
|
Texture backgroundTexture = new Texture("sprites/MAINSCREEN.png");
|
|
|
|
startButtonTexture = new Texture("sprites/startButton.png");
|
|
|
|
Texture startButtonTexture = new Texture("sprites/startButton.png");
|
|
|
|
quitButtonTexture = new Texture("sprites/quitButton.png");
|
|
|
|
Texture quitButtonTexture = new Texture("sprites/quitButton.png");
|
|
|
|
settingsButtonTexture = new Texture("sprites/settingsButton.png");
|
|
|
|
Texture settingsButtonTexture = new Texture("sprites/settingsButton.png");
|
|
|
|
|
|
|
|
|
|
|
|
backgroundSprite = new Sprite(backgroundTexture);
|
|
|
|
backgroundSprite = new Sprite(backgroundTexture);
|
|
|
|
startButtonSprite = new Sprite(startButtonTexture);
|
|
|
|
startButtonSprite = new Sprite(startButtonTexture);
|
|
|
|
@ -82,7 +90,41 @@ public class MainMenuScreen{
|
|
|
|
|
|
|
|
|
|
|
|
//ENTITIES
|
|
|
|
//ENTITIES
|
|
|
|
|
|
|
|
|
|
|
|
//PLAYER
|
|
|
|
//PLAYER PREVIEW
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
playerRegion = new TextureRegion[3][][];
|
|
|
|
|
|
|
|
shownPlayer = 2;
|
|
|
|
|
|
|
|
animationState = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
playerRegion[0] = TextureRegion.split(new Texture("sprites/player.png"), 64, 64);
|
|
|
|
|
|
|
|
playerRegion[1] = TextureRegion.split(new Texture("sprites/playerblue.png"), 64, 64);
|
|
|
|
|
|
|
|
playerRegion[2] = TextureRegion.split(new Texture("sprites/playerpurple.png"), 64, 64);
|
|
|
|
|
|
|
|
playerSprite = new Sprite(playerRegion[shownPlayer][0][animationState]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skinContainer = new Sprite(new Texture("sprites/skinContainer.png"));
|
|
|
|
|
|
|
|
buttonLeft = new Sprite(new Texture("sprites/right.png"));
|
|
|
|
|
|
|
|
buttonRight = new Sprite(new Texture("sprites/left.png"));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
skinContainer.setPosition(800, 400);
|
|
|
|
|
|
|
|
buttonRight.setPosition(skinContainer.getX() + 8, skinContainer.getY()+8);
|
|
|
|
|
|
|
|
buttonLeft.setPosition(skinContainer.getX() + 110, skinContainer.getY()+8);
|
|
|
|
|
|
|
|
playerSprite.setPosition(skinContainer.getX() + 51, skinContainer.getY() + 8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preview = new Timer();
|
|
|
|
|
|
|
|
preview.scheduleTask(new Timer.Task() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
if(animationState >= 9){
|
|
|
|
|
|
|
|
animationState = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
animationState++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
playerSprite.setRegion(playerRegion[shownPlayer][0][animationState]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},0, 0.1f);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Sound
|
|
|
|
// Sound
|
|
|
|
music = Gdx.audio.newMusic(Gdx.files.internal("music/mainmenu.mp3"));
|
|
|
|
music = Gdx.audio.newMusic(Gdx.files.internal("music/mainmenu.mp3"));
|
|
|
|
@ -99,10 +141,15 @@ public class MainMenuScreen{
|
|
|
|
batch.begin();
|
|
|
|
batch.begin();
|
|
|
|
//batch.setProjectionMatrix(camera.combined);
|
|
|
|
//batch.setProjectionMatrix(camera.combined);
|
|
|
|
if(hidden == false){
|
|
|
|
if(hidden == false){
|
|
|
|
|
|
|
|
|
|
|
|
backgroundSprite.draw(batch);
|
|
|
|
backgroundSprite.draw(batch);
|
|
|
|
startButtonSprite.draw(batch);
|
|
|
|
startButtonSprite.draw(batch);
|
|
|
|
quitButtonSprite.draw(batch);
|
|
|
|
quitButtonSprite.draw(batch);
|
|
|
|
settingsButtonSprite.draw(batch);
|
|
|
|
settingsButtonSprite.draw(batch);
|
|
|
|
|
|
|
|
skinContainer.draw(batch);
|
|
|
|
|
|
|
|
buttonLeft.draw(batch);
|
|
|
|
|
|
|
|
buttonRight.draw(batch);
|
|
|
|
|
|
|
|
playerSprite.draw(batch);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
batch.end();
|
|
|
|
batch.end();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -122,6 +169,18 @@ public class MainMenuScreen{
|
|
|
|
if(Intersector.overlaps(r, settingsButtonSprite.getBoundingRectangle())){
|
|
|
|
if(Intersector.overlaps(r, settingsButtonSprite.getBoundingRectangle())){
|
|
|
|
return 2; //Settings
|
|
|
|
return 2; //Settings
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Intersector.overlaps(r, buttonLeft.getBoundingRectangle())){
|
|
|
|
|
|
|
|
if(shownPlayer != 0){
|
|
|
|
|
|
|
|
shownPlayer--; //Settings
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(Intersector.overlaps(r, buttonRight.getBoundingRectangle())){
|
|
|
|
|
|
|
|
if(shownPlayer != 2){
|
|
|
|
|
|
|
|
shownPlayer++; //Settings
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
|
|
@ -143,6 +202,9 @@ public class MainMenuScreen{
|
|
|
|
return hidden;
|
|
|
|
return hidden;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getSkin(){
|
|
|
|
|
|
|
|
return shownPlayer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|