Skip to content

Commit

Permalink
merged and ai data added
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiHma committed Jun 25, 2019
2 parents 6daf81a + be0b646 commit 9319be7
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
Binary file modified Data.txt
Binary file not shown.
File renamed without changes.
File renamed without changes
File renamed without changes
21 changes: 15 additions & 6 deletions src/views/graphics/GraphicBattleController.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package views.graphics;

import controllers.ClientManager;
import javafx.animation.ScaleTransition;
import javafx.animation.*;
import controllers.logic.Manager;
import javafx.animation.TranslateTransition;
import javafx.application.Platform;
Expand Down Expand Up @@ -169,18 +169,27 @@ private int getDistance(double x1, double y1, double x2, double y2) {

private void moveCard(AnchorPane cardPane, Rectangle newPosition, Card card) {
int time = getDistance(newPosition.getX(), newPosition.getY(), cardPane.getLayoutX(), cardPane.getLayoutY()) * 7;
TranslateTransition t = new TranslateTransition(new Duration(time), cardPane);
t.setToX(newPosition.getX() - cardPane.getLayoutX());
t.setToY(newPosition.getY() - cardPane.getLayoutY());
t.play();
// TranslateTransition t = new TranslateTransition(new Duration(time), cardPane);
// t.setToX(newPosition.getX() - cardPane.getLayoutX());
// t.setToY(newPosition.getY() - cardPane.getLayoutY());
// t.play();
Timeline timeline = new Timeline();
KeyFrame end = new KeyFrame(new Duration(time),
new KeyValue(cardPane.layoutXProperty(), newPosition.getX()),
new KeyValue(cardPane.layoutYProperty(), newPosition.getY()));
timeline.getKeyFrames().add(end);
// timeline.setOnFinished(event -> {
// System.out.println("Location after relocation = " + newPosition.getX()
// + "," + newPosition.getY() + ")");
// });
timeline.play();
new Thread(() -> {
ImageView imageView = (ImageView) cardPane.getChildren().get(0);
SpriteMaker.getAndShowAnimation(imageView, card.getName(), Action.RUN, 1000);
long newTime = System.currentTimeMillis();
while (System.currentTimeMillis() - newTime <= time) {
}
SpriteMaker.getAndShowAnimation(imageView, card.getName(), Action.IDLE, 10000000);

}).start();
}

Expand Down
3 changes: 2 additions & 1 deletion src/views/graphics/GraphicCustomCardMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ public void addHeroCard(ActionEvent actionEvent) {

spriteAnimation.renameTo(new File(spritePath + name + ".png"));
plistFile.renameTo(new File(spritePath + name + ".plist"));
logo.renameTo(new File(spritePath + "HeroLogos" + File.separator + name + ".png"));
// File newFile = new File(String.valueOf(Graphics.class.getResource("resources/sprites/HeroLogos/" + name + ".png")));
logo.renameTo(new File(String.valueOf(Graphics.class.getResource("resources/sprites/HeroLogos/" + name + ".png"))));


AttackType attackType1 = AttackType.getAttackType(attackType);
Expand Down

0 comments on commit 9319be7

Please sign in to comment.