Jan Ehehalt 6 years ago
parent 5ebc77d7c0
commit 4973d15265

@ -187,9 +187,9 @@ public class Controller extends ApplicationAdapter implements InputProcessor{
collision = true;
level.get(currentChapter).get(currentLevel).getProjectile().setxPos(tempX);
level.get(currentChapter).get(currentLevel).getProjectile().setyPos(tempY);
if (rect.getHeight() == 1) {
if (rect.getHeight() == 5) {
level.get(currentChapter).get(currentLevel).horizontalCollision();
} else if (rect.getWidth() == 1) {
} else if (rect.getWidth() == 5) {
level.get(currentChapter).get(currentLevel).verticalCollision();
}
//break;

@ -87,11 +87,12 @@ public class Gamescreen{
goalRects[6] = new Rectangle(x + w-1 ,y ,1 ,h );
goalRects[7] = new Rectangle(x ,y ,w ,1 );
int hitboxWidth = 5; // CHANGE IN STEP TIMER IN CONTROLLER TOO
for (Rectangle object : objects) {
objectRects.add(new Rectangle(object.getX(), object.getY(), 1, object.getHeight()));
objectRects.add(new Rectangle(object.getX(), object.getY() + object.getHeight() - 1, object.getWidth(), 1));
objectRects.add(new Rectangle(object.getX() + object.getWidth() - 1, object.getY(), 1, object.getHeight()));
objectRects.add(new Rectangle(object.getX(), object.getY(), object.getWidth(), 1));
objectRects.add(new Rectangle(object.getX(), object.getY(), hitboxWidth, object.getHeight()));
objectRects.add(new Rectangle(object.getX(), object.getY() + object.getHeight() - hitboxWidth, object.getWidth(), hitboxWidth));
objectRects.add(new Rectangle(object.getX() + object.getWidth() - hitboxWidth, object.getY(), hitboxWidth, object.getHeight()));
objectRects.add(new Rectangle(object.getX(), object.getY(), object.getWidth(), hitboxWidth));
}
goalRect = new Rectangle(x + w*th, y + h*th, w * th * 3, h * 0.1f);
@ -134,7 +135,6 @@ public class Gamescreen{
if(objects != null) {
for (Rectangle object : objects) {
shapeRenderer.rect(object.getX(), object.getY(), object.getWidth(), object.getHeight());
}
}
@ -157,13 +157,13 @@ public class Gamescreen{
shapeRenderer.rect(g.getxPos(), g.getyPos(), g.getSizeX(), g.getSizeY());
*/
// object hitboxes
/*
if(objects != null) {
for (Rectangle object : objectRects) {
shapeRenderer.rect(object.getX(), object.getY(), object.getWidth(), object.getHeight());
}
}
*/
shapeRenderer.setColor(Color.GRAY);

@ -8,9 +8,9 @@ import controller.Controller;
public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.fullscreen = true;
config.height = 2560;
config.width = 3840;
config.fullscreen = false;
config.height = 480;
config.width = 720;
new LwjglApplication(new Controller(), config);
}
}

Loading…
Cancel
Save