Skip to content

Commit

Permalink
Merge branch 'release/v0.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
PavelCz committed Jun 5, 2014
2 parents 6de907e + 902006b commit f059dd1
Show file tree
Hide file tree
Showing 44 changed files with 464 additions and 260 deletions.
8 changes: 4 additions & 4 deletions src/data/files/levels/level1.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
map.png
previews/Blutkreislauf-Gehirn.jpg
veins/bg.png
1.txt
map.png
previews/Blutkreislauf-Mund.jpg
veins/bg.png
1.txt
enemies.txt
8 changes: 4 additions & 4 deletions src/data/files/levels/level2.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
map-map.png
previews/Blutkreislauf-Herz.jpg
veins/bg.png
1.txt
map-map.png
previews/Blutkreislauf-Lunge.jpg
veins/bg.png
1.txt
enemies.txt
8 changes: 4 additions & 4 deletions src/data/files/levels/level4.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
testMap.png
previews/Blutkreislauf-rachen.png
veins/bg.png
1.txt
testMap.png
previews/Blutkreislauf-Rachen.jpg
veins/bg.png
1.txt
enemies.txt
17 changes: 7 additions & 10 deletions src/data/files/score.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
Pavdgel, 10000999
Pavdsel, 1077000
Dummy, 65150
jjjjjjjjjj, 29350
Dummy, 4600
Pavrzel, 800
pav, 700
pav, 700
pav, 700
Dummy, 100
Player, 850
Player, 700
Player, 700
Player, 0
Player, 0
Player, 0
Player, 0
4 changes: 4 additions & 0 deletions src/data/files/waves/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1, 100, 0, 0, 0, 0, 0, 0
2, 100, 0, 0, 0, 0, 0, 0
2, 100, 0, 0, 0, 0, 0, 0
3, 80, 5, 15, 0, 0, 0, 0
Binary file removed src/data/graphics/Game Over.png
Binary file not shown.
Binary file removed src/data/graphics/You Win.png
Binary file not shown.
Binary file removed src/data/graphics/buttons/button1.png
Binary file not shown.
Binary file removed src/data/graphics/buttons/button2.png
Binary file not shown.
Binary file added src/data/graphics/icons/icon16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/graphics/icons/icon24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/graphics/icons/icon32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/data/graphics/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/graphics/leftClicked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/data/graphics/maps/Cells13x12.png
Binary file not shown.
Binary file removed src/data/graphics/maps/background.jpg
Binary file not shown.
Binary file removed src/data/graphics/maps/background2.png
Binary file not shown.
Binary file removed src/data/graphics/previews/Blutkreislauf-Gehirn.jpg
Binary file not shown.
Binary file removed src/data/graphics/previews/Blutkreislauf-Herz.jpg
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/graphics/previews/Blutkreislauf-Mund.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/data/graphics/previews/Blutkreislauf-Niere.jpg
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/data/graphics/previews/Blutkreislauf-rachen.png
Binary file not shown.
Binary file modified src/data/graphics/right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/graphics/rightClicked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions src/engine/GameComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ private void updateClickables(GameContainer container, int delta) {
clickable.update(x, y, container);
}

} else {
if (this.mouseWasClicked) {
this.mouseWasClicked = false;
for (Clickable clickable : this.clickables) {
if (!clickable.isStayClicked()) {
if (clickable.isClicked()) {
clickable.onRelease();
}
} else if (this.mouseWasClicked && !input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
this.mouseWasClicked = false;
for (Clickable clickable : this.clickables) {
if (!clickable.isStayClicked() && clickable.isActive()) {
if (clickable.isClicked() && clickable.collides((int) x, (int) y, Gameplay.GLOBAL_GUI_SCALE)) {
clickable.onRelease();
} else if (clickable.isClicked()) {
clickable.setClicked(false);
}
}
}
Expand All @@ -73,9 +73,9 @@ private void updateClickables(GameContainer container, int delta) {

public void updateHovering(float x, float y) {
for (Clickable clickable : this.clickables) {
if (clickable.collides((int) x, (int) y, Gameplay.GLOBAL_GUI_SCALE)) {
if (clickable.collides((int) x, (int) y, Gameplay.GLOBAL_GUI_SCALE) && !clickable.isClicked() && clickable.isActive()) {
clickable.onHover();
} else {
} else if (!clickable.isClicked() && clickable.isActive()) {
clickable.onUnHover();
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/engine/WaveHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.LinkedList;
import java.util.List;

import org.newdawn.slick.GameContainer;

import towerDefense.Gameplay;
import towerDefense.TowerDefense;

Expand Down Expand Up @@ -71,14 +73,15 @@ private int calculateEnemy(Wave wave) {
return -1;
}

public void update(int delta) {
public void update(int delta, GameContainer container) {
this.delta -= delta;
// the player defeated all the waves
if (this.waves.isEmpty() && this.done) {
TowerDefense.writeScoreToFile(this.game.game.getGameplay().getPlayer().getName(), this.game.game.getGameplay().getPlayer()
.getScore());
this.game.game.resetScores();
this.game.game.setMode(TowerDefense.MODE_MENU);
this.game.game.setWon(this.game.getPlayer().getScore(), this.game.getPlayer().getName());
}
if (this.game.getEnemies().isEmpty() && this.index <= 0) {

Expand Down
4 changes: 4 additions & 0 deletions src/engine/gui/Button.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ public void setUnclickedButton(Sprite picture) {
this.unclickedButton = picture;
}

public void setClickedButton(Sprite picture) {
this.clickedButton = picture;
}

}
29 changes: 19 additions & 10 deletions src/engine/gui/Clickable.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package engine.gui;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Input;

import towerDefense.Gameplay;

public abstract class Clickable extends GUI {
protected float collisionWidth, collisionHeight;
protected boolean clicked = false;
protected Gameplay game;
protected boolean stayClicked;
protected boolean active = true;

public Clickable(float x, float y, Gameplay game, boolean stayClicked) {
super(x, y);
Expand All @@ -18,20 +17,30 @@ public Clickable(float x, float y, Gameplay game, boolean stayClicked) {
}

public void update(float mouseX, float mouseY, GameContainer container) {
if (this.collides((int) mouseX, (int) mouseY, Gameplay.GLOBAL_GUI_SCALE)) {
if (this.clicked) {
this.onRelease();
} else {
this.game.releaseAllClickablesExcept(this);
this.onClick();
if (this.active) {
if (this.collides((int) mouseX, (int) mouseY, Gameplay.GLOBAL_GUI_SCALE)) {
if (this.clicked) {
this.onRelease();
} else {
this.game.releaseAllClickablesExcept(this);
this.onClick();

}
this.game.getSoundHandler().play("press");
}

this.game.getSoundHandler().play("press");
}
}

}

public boolean isActive() {
return this.active;
}

public void setClicked(boolean clicked) {
this.clicked = clicked;
}

public void onClick() {
this.clicked = true;
}
Expand Down
24 changes: 22 additions & 2 deletions src/engine/gui/ClickableText.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,20 @@ public ClickableText(float x, float y, String text, float globalScale, Gameplay
this.collisionHeight = this.text.getTextHeight();
}

public void activate() {
this.active = true;
}

public void deactivate() {
this.active = false;
}

@Override
public void onClick() {
super.onClick();
this.text.setColor(Color.blue);
if (this.active) {
super.onClick();
this.text.setColor(Color.blue);
}

}

Expand Down Expand Up @@ -74,4 +84,14 @@ public void setX(int x) {
public void setY(int y) {
this.y = y;
}

public void setVisible(boolean visible) {
this.text.setVisible(visible);
}

public void setColor(Color color) {
this.text.setColor(color);

}

}
22 changes: 22 additions & 0 deletions src/engine/gui/GoToGameButton.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package engine.gui;

import towerDefense.Gameplay;
import towerDefense.TowerDefense;

public class GoToGameButton extends ClickableText {
private TowerDefense towerDefense;

public GoToGameButton(float x, float y, String text, TowerDefense towerDefense) {
super(x, y, text, Gameplay.GLOBAL_GUI_SCALE, towerDefense.getGameplay(), false);
this.towerDefense = towerDefense;

}

@Override
public void onRelease() {
if (this.active) {
super.onRelease();
this.towerDefense.setMode(TowerDefense.MODE_GAME);
}
}
}
15 changes: 11 additions & 4 deletions src/engine/gui/StartClickable.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
package engine.gui;

import org.newdawn.slick.GameContainer;

import towerDefense.TowerDefense;

public class StartClickable extends ClickableText {
private TowerDefense towerDefense;
private GameContainer container;

public StartClickable(float x, float y, TowerDefense towerDefense) {
public StartClickable(float x, float y, TowerDefense towerDefense, GameContainer container) {
super(x, y, "Start new Game", 1f, towerDefense.getGameplay(), false);
this.towerDefense = towerDefense;
this.container = container;
}

@Override
public void onRelease() {
super.onRelease();
this.towerDefense.setMode(TowerDefense.MODE_MAPS);
this.towerDefense.deactivateMenu();
if (this.active) {
super.onRelease();
this.towerDefense.setMode(TowerDefense.MODE_MAPS);
this.towerDefense.reinitChooseLevel(this.container);
this.towerDefense.deactivateMenu();
}
}
}
5 changes: 5 additions & 0 deletions src/engine/gui/StaticText.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ public void setPosition(float x, float y) {
this.y = y;
}

public void setColor(Color color) {
this.text.setColor(color);

}

}
Loading

0 comments on commit f059dd1

Please sign in to comment.