Commit a816d827 authored by Fjen Undso's avatar Fjen Undso
Browse files

use new sprites for menu and tutorial

parent 542e3f15
......@@ -66,7 +66,20 @@ public class FrozenNumbersGame extends ApplicationAdapter {
size3Params.fontParameters.size = 40;
assets.load("size40.ttf", BitmapFont.class, size3Params);
assets.load("badlogic.jpg", Texture.class);
// menu
assets.load("backgrounds/main-screen.png", Texture.class);
assets.load("sprites/btn_help.png", Texture.class);
assets.load("sprites/btn_ready_active.png", Texture.class);
assets.load("sprites/btn_ready_inactive.png", Texture.class);
// tutorial
assets.load("backgrounds/tutorial-screen.png", Texture.class);
assets.load("sprites/btn_back.png", Texture.class);
// game
assets.load("backgrounds/game-screen.png", Texture.class);
assets.load("sprites/bubble.png", Texture.class);
assets.load("Bubble.png", Texture.class);
assets.load("BubbleTop.png", Texture.class);
......@@ -77,11 +90,6 @@ public class FrozenNumbersGame extends ApplicationAdapter {
assets.load("panel_blue.png", Texture.class);
assets.load("comb.png", Texture.class);
assets.load("mm_background.png", Texture.class);
assets.load("mm_ready_true.png", Texture.class);
assets.load("mm_ready_false.png", Texture.class);
assets.load("mm_logo.png", Texture.class);
assets.load("mm_questionmark.png", Texture.class);
assets.load("tut_tutorial.png", Texture.class);
assets.load("tut_close.png", Texture.class);
assets.load("border2.png", Texture.class);
......
......@@ -20,7 +20,6 @@ public class MainMenuScreen implements Screen {
Sprite bg;
Sprite p1_ready, p2_ready;
Sprite p1_quest, p2_quest;
Sprite logo;
boolean p1_isready, p2_isready;
float wWidth, wHeight;
......@@ -31,31 +30,27 @@ public class MainMenuScreen implements Screen {
wHeight = FrozenNumbersGame.viewport.getWorldHeight();
//generating backround
bg = new Sprite(FrozenNumbersGame.assets.get("mm_background.png", Texture.class));
bg = new Sprite(FrozenNumbersGame.assets.get("backgrounds/main-screen.png", Texture.class));
bg.setSize(wWidth, wHeight);
bg.setCenter(wWidth / 2.0f, wHeight / 2.0f);
bg.setColor(Color.LIGHT_GRAY);
//generating player Buttons
p1_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_false.png", Texture.class));
p1_ready = new Sprite(FrozenNumbersGame.assets.get("sprites/btn_ready_inactive.png", Texture.class));
p1_ready.setCenter(wWidth / 2.0f, wHeight / 4.0f);
p2_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_false.png", Texture.class));
p2_ready = new Sprite(FrozenNumbersGame.assets.get("sprites/btn_ready_inactive.png", Texture.class));
p2_ready.setCenter(wWidth / 2.0f, wHeight / 4.0f * 3.0f);
p2_ready.rotate(180);
//generating QuestionmarkButtons
p1_quest = new Sprite(FrozenNumbersGame.assets.get("mm_questionmark.png", Texture.class));
p1_quest.setCenter(wWidth / 2.0f, wHeight / 4.0f - 2 * p1_quest.getHeight());
p1_quest = new Sprite(FrozenNumbersGame.assets.get("sprites/btn_help.png", Texture.class));
p1_quest.setCenter(wWidth / 2.0f, wHeight / 4.0f - p1_quest.getHeight());
p2_quest = new Sprite(FrozenNumbersGame.assets.get("mm_questionmark.png", Texture.class));
p2_quest.setCenter(wWidth / 2.0f, wHeight / 4.0f * 3.0f + 2 * p2_quest.getHeight());
p2_quest = new Sprite(FrozenNumbersGame.assets.get("sprites/btn_help.png", Texture.class));
p2_quest.setCenter(wWidth / 2.0f, wHeight / 4.0f * 3.0f + p2_quest.getHeight());
p2_quest.rotate(180);
//generating logo
logo = new Sprite(FrozenNumbersGame.assets.get("mm_logo.png", Texture.class));
logo.setScale(logo.getWidth() / bg.getWidth() * 0.7f, (logo.getWidth() / bg.getWidth()) * 0.7f);
logo.setCenter(wWidth / 2.0f, wHeight / 2.0f);
p1_isready = false;
p2_isready = false;
}
......@@ -75,23 +70,20 @@ public class MainMenuScreen implements Screen {
//toggle states
p1_isready = !p1_isready;
if (p1_isready) {
p1_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_true.png", Texture.class));
p1_ready.setTexture(FrozenNumbersGame.assets.get("sprites/btn_ready_active.png", Texture.class));
} else {
p1_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_false.png", Texture.class));
p1_ready.setTexture(FrozenNumbersGame.assets.get("sprites/btn_ready_inactive.png", Texture.class));
}
p1_ready.setCenter(wWidth / 2.0f, wHeight / 4.0f);
}
//Clicking Ready Button p2
if (p2_ready.getBoundingRectangle().contains(touchPoint.x, touchPoint.y)) {
//toggle states
p2_isready = !p2_isready;
if (p2_isready) {
p2_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_true.png", Texture.class));
p2_ready.setTexture(FrozenNumbersGame.assets.get("sprites/btn_ready_active.png", Texture.class));
} else {
p2_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_false.png", Texture.class));
p2_ready.setTexture(FrozenNumbersGame.assets.get("sprites/btn_ready_inactive.png", Texture.class));
}
p2_ready.setCenter(wWidth / 2.0f, wHeight / 4.0f * 3.0f);
p2_ready.rotate(180);
}
//clicking questionmark buttons
if ((p1_quest.getBoundingRectangle().contains(touchPoint.x, touchPoint.y))
......@@ -101,8 +93,6 @@ public class MainMenuScreen implements Screen {
}
}
//logo rotation
logo.rotate(1);
//drawing stuff
Gdx.gl.glClearColor(0, 0, 0, 1);
......@@ -111,12 +101,13 @@ public class MainMenuScreen implements Screen {
FrozenNumbersGame.viewport.apply(true);
batch.setProjectionMatrix(FrozenNumbersGame.viewport.getCamera().combined);
batch.begin();
bg.draw(batch);
p1_ready.draw(batch);
p2_ready.draw(batch);
logo.draw(batch);
p1_quest.draw(batch);
p2_quest.draw(batch);
batch.end();
//Starting game if ready
......@@ -126,11 +117,8 @@ public class MainMenuScreen implements Screen {
//reset for new Game
p1_isready = false;
p2_isready = false;
p1_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_false.png", Texture.class));
p1_ready.setCenter(wWidth / 2.0f, wHeight / 4.0f);;
p2_ready = new Sprite(FrozenNumbersGame.assets.get("mm_ready_false.png", Texture.class));
p2_ready.setCenter(wWidth / 2.0f, wHeight / 4.0f * 3.0f);
p2_ready.rotate(180);
p1_ready.setTexture(FrozenNumbersGame.assets.get("sprites/btn_ready_inactive.png", Texture.class));
p2_ready.setTexture(FrozenNumbersGame.assets.get("sprites/btn_ready_inactive.png", Texture.class));
}
}
......
......@@ -6,6 +6,7 @@ import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
......@@ -17,8 +18,7 @@ public class TutorialScreen implements Screen {
Game game;
public static Map<String, Screen> m_Screens;
Sprite bg;
Sprite p1_tut, p2_tut;
Sprite close;
Sprite closeBottom, closeTop;
float wWidth, wHeight;
public TutorialScreen() {
......@@ -28,26 +28,18 @@ public class TutorialScreen implements Screen {
wHeight = FrozenNumbersGame.viewport.getWorldHeight();
//generating backround
bg = new Sprite(FrozenNumbersGame.assets.get("mm_background.png", Texture.class));
bg = new Sprite(FrozenNumbersGame.assets.get("backgrounds/tutorial-screen.png", Texture.class));
bg.setSize(wWidth, wHeight);
bg.setCenter(wWidth / 2.0f, wHeight / 2.0f);
bg.setColor(Color.LIGHT_GRAY);
//generating tutorial images
p1_tut = new Sprite(FrozenNumbersGame.assets.get("tut_tutorial.png", Texture.class));
p1_tut.setOriginCenter();
p1_tut.setPosition(wWidth / 2.0f - p1_tut.getWidth() / 2, 0.05f * wHeight);
p1_tut.getBoundingRectangle();
p2_tut = new Sprite(FrozenNumbersGame.assets.get("tut_tutorial.png", Texture.class));
p2_tut.setSize(p2_tut.getWidth(), p2_tut.getHeight());
p2_tut.setCenter(wWidth / 2.0f, 0.05f * wHeight + 0.5f * p2_tut.getHeight() + .55f * wHeight);
p2_tut.rotate(180);
//generating Close button#
close = new Sprite(FrozenNumbersGame.assets.get("tut_close.png", Texture.class));
close.setOriginCenter();
close.setPosition(wWidth / 2.0f - close.getWidth() / 2, 0.5f * wHeight - close.getHeight() / 2);
close.getBoundingRectangle();
closeBottom = new Sprite(FrozenNumbersGame.assets.get("sprites/btn_back.png", Texture.class));
closeBottom.setCenter(wWidth / 2.0f, closeBottom.getHeight() / 2.1f);
closeTop = new Sprite(FrozenNumbersGame.assets.get("sprites/btn_back.png", Texture.class));
closeTop.setCenter(wWidth / 2.0f, wHeight - closeBottom.getHeight() / 2.1f);
closeTop.rotate(180);
}
@Override
......@@ -57,23 +49,28 @@ public class TutorialScreen implements Screen {
@Override
public void render(float delta) {
if (Gdx.input.isTouched()) {
if (Gdx.input.justTouched()) {
Vector2 touchPoint = new Vector2();
FrozenNumbersGame.viewport.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY()));
//Clicking Close Button
if (close.getBoundingRectangle().contains(touchPoint.x, touchPoint.y)) {
if (closeBottom.getBoundingRectangle().contains(touchPoint.x, touchPoint.y) ||
closeTop.getBoundingRectangle().contains(touchPoint.x, touchPoint.y)) {
game.setScreen(m_Screens.get("MainMenu"));
}
}
//drawing stuff
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
FrozenNumbersGame.batch.begin();
bg.draw(FrozenNumbersGame.batch);
p1_tut.draw(FrozenNumbersGame.batch);
p2_tut.draw(FrozenNumbersGame.batch);
close.draw(FrozenNumbersGame.batch);
FrozenNumbersGame.batch.end();
Batch batch = FrozenNumbersGame.batch;
FrozenNumbersGame.viewport.apply(true);
batch.setProjectionMatrix(FrozenNumbersGame.viewport.getCamera().combined);
batch.begin();
bg.draw(batch);
closeBottom.draw(batch);
closeTop.draw(batch);
batch.end();
}
@Override
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment