quest window wiggling removed

master
GammelJAN 5 years ago
parent 269e214ada
commit 50b459acc0

@ -336,14 +336,6 @@ public class MapContainer {
} }
} }
// center camera
for(Actor a : getStage().getActors()){
if(a instanceof Player){
getStage().getCamera().position.set((a.getX()+a.getWidth()/2), (a.getY()+a.getHeight()/2), 0);
getStage().getCamera().update();
break;
}
}
if(getT() != null){ if(getT() != null){
getT().draw(getStage().getBatch(), getStage().getCamera().position.x, getStage().getCamera().position.y, getStage().getCamera().combined); getT().draw(getStage().getBatch(), getStage().getCamera().position.x, getStage().getCamera().position.y, getStage().getCamera().combined);
if(getT().opacity == 0){ if(getT().opacity == 0){

@ -27,6 +27,8 @@ import com.trs.main.Quest;
public class QuestWindow { public class QuestWindow {
final double animationSpeed = 0.05;
BitmapFont font; BitmapFont font;
ShapeRenderer renderer; ShapeRenderer renderer;
boolean visible; boolean visible;
@ -61,7 +63,7 @@ public class QuestWindow {
} }
float boxX = playerX + Main.CAMERA_WIDTH/2 - 0.2f*Main.CAMERA_WIDTH - 30; float boxX = playerX + Main.CAMERA_WIDTH/2 - 200;
float boxY = playerY + Main.CAMERA_HEIGHT/2 - 0.4f*Main.CAMERA_HEIGHT - 30; float boxY = playerY + Main.CAMERA_HEIGHT/2 - 0.4f*Main.CAMERA_HEIGHT - 30;
float boxWidth = 0.2f*Main.CAMERA_WIDTH; float boxWidth = 0.2f*Main.CAMERA_WIDTH;
float boxHeight = 0.4f*Main.CAMERA_HEIGHT; float boxHeight = 0.4f*Main.CAMERA_HEIGHT;
@ -70,7 +72,7 @@ public class QuestWindow {
if(visible && Main.gamestate != 2){ if(visible && Main.gamestate != 2){
if(visiblePerc < 1){ if(visiblePerc < 1){
visiblePerc += 0.2; visiblePerc += animationSpeed;
Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
renderer.begin(ShapeRenderer.ShapeType.Filled); renderer.begin(ShapeRenderer.ShapeType.Filled);
@ -117,7 +119,6 @@ public class QuestWindow {
} }
UIDrawer.drawCharBox(batch, font, boxX + boxWidth - 16 , boxY + boxHeight - 16, 32, "^"); UIDrawer.drawCharBox(batch, font, boxX + boxWidth - 16 , boxY + boxHeight - 16, 32, "^");
UIDrawer.drawIcon(batch, boxX + boxWidth/2, boxY + boxHeight, 0); UIDrawer.drawIcon(batch, boxX + boxWidth/2, boxY + boxHeight, 0);
Gdx.gl.glDisable(GL20.GL_BLEND); Gdx.gl.glDisable(GL20.GL_BLEND);
@ -130,7 +131,7 @@ public class QuestWindow {
} }
else{ else{
if(visiblePerc > 0){ if(visiblePerc > 0){
visiblePerc -= 0.2; visiblePerc -= animationSpeed;
Gdx.gl.glEnable(GL20.GL_BLEND); Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA); Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
renderer.begin(ShapeRenderer.ShapeType.Filled); renderer.begin(ShapeRenderer.ShapeType.Filled);

@ -12,6 +12,7 @@ import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.GlyphLayout; import com.badlogic.gdx.graphics.g2d.GlyphLayout;
import com.badlogic.gdx.graphics.g2d.Sprite; import com.badlogic.gdx.graphics.g2d.Sprite;
import com.sun.tools.javac.util.Abort;
/** /**
* *
@ -19,6 +20,7 @@ import com.badlogic.gdx.graphics.g2d.Sprite;
*/ */
public class UIDrawer { public class UIDrawer {
static Sprite box32 = new Sprite(new Texture(Gdx.files.internal("textureData/UI/box.png"))); static Sprite box32 = new Sprite(new Texture(Gdx.files.internal("textureData/UI/box.png")));
static Texture questbook = new Texture(Gdx.files.internal("textureData/UI/questbook.png")); static Texture questbook = new Texture(Gdx.files.internal("textureData/UI/questbook.png"));
@ -27,8 +29,7 @@ public class UIDrawer {
font.setColor(Color.WHITE); font.setColor(Color.WHITE);
switch(size){ switch(size){
case 16: case 16:
font.draw(batch, ""+character, x + 16 - getTextWidth(font, character)/2, y + 16 - getTextHeight(font, character)/2); throw new OutOfMemoryError("nice");
break;
case 32: case 32:
box32.setPosition(x, y); box32.setPosition(x, y);
box32.draw(batch); box32.draw(batch);
@ -36,6 +37,8 @@ public class UIDrawer {
font.draw(batch, ""+character, x + 16 - getTextWidth(font, character)/2, y + 16 + (getTextHeight(font, character)/2) - 2); font.draw(batch, ""+character, x + 16 - getTextWidth(font, character)/2, y + 16 + (getTextHeight(font, character)/2) - 2);
font.getData().setScale(1); font.getData().setScale(1);
break; break;
default:
throw new OutOfMemoryError("nice");
} }
batch.end(); batch.end();
@ -47,6 +50,8 @@ public class UIDrawer {
case 0: case 0:
batch.draw(questbook, x - questbook.getWidth()/2, y - questbook.getHeight()/2); batch.draw(questbook, x - questbook.getWidth()/2, y - questbook.getHeight()/2);
break; break;
default:
throw new Abort();
} }
batch.end(); batch.end();

@ -41,14 +41,23 @@ public class GameScreen extends AbstractScreen{
@Override @Override
public void render(float f) { public void render(float f) {
map.render(f); map.render(f);
Quest[] rects = new Quest[map.getPlayer().getQuests().size()]; Quest[] rects = new Quest[map.getPlayer().getQuests().size()];
for(int i = 0; i< map.getPlayer().getQuests().size(); i++){ for(int i = 0; i< map.getPlayer().getQuests().size(); i++){
rects[i] = map.getPlayer().getQuests().get(i); rects[i] = map.getPlayer().getQuests().get(i);
} }
qw.draw(rects, map.getStage().getBatch(), map.getPlayer().getX()+32, map.getPlayer().getY()+32);
//qw.draw(rects, map.getStage().getBatch(), map.getPlayer().getX()+32, map.getPlayer().getY()+32);
qw.draw(rects, map.getStage().getBatch(), map.getStage().getCamera().position.x, map.getStage().getCamera().position.y );
if(map.getCollidingDoor() != null) { if(map.getCollidingDoor() != null) {
loadNewMap(map.getCollidingDoor().destinationMap, map.getCollidingDoor().destinationDoor); loadNewMap(map.getCollidingDoor().destinationMap, map.getCollidingDoor().destinationDoor);
} }
Player a = map.getPlayer();
map.getStage().getCamera().position.set((a.getX()+a.getWidth()/2), (a.getY()+a.getHeight()/2), 0);
map.getStage().getCamera().update();
} }
@Override @Override

@ -19,4 +19,3 @@ public class DesktopLauncher {
new LwjglApplication(new Main(), config); new LwjglApplication(new Main(), config);
} }
} }

Loading…
Cancel
Save