diff --git a/BattleTanks/src/main/java/com/almasb/fxglgames/tanks/PlayerComponent.java b/BattleTanks/src/main/java/com/almasb/fxglgames/tanks/PlayerComponent.java
index 6e91f6bf..fa15cf24 100644
--- a/BattleTanks/src/main/java/com/almasb/fxglgames/tanks/PlayerComponent.java
+++ b/BattleTanks/src/main/java/com/almasb/fxglgames/tanks/PlayerComponent.java
@@ -48,7 +48,7 @@ public void onAdded() {
getEntity().getTransformComponent().setRotationOrigin(new Point2D(42, 42));
texture = FXGL.getAssetLoader().loadTexture("player.png");
- view.setView(texture);
+ view.addChild(texture);
}
private double speed = 0;
diff --git a/Breakout/src/main/java/com/almasb/fxglgames/breakout/components/BrickComponent.java b/Breakout/src/main/java/com/almasb/fxglgames/breakout/components/BrickComponent.java
index d362d4de..1d63679e 100644
--- a/Breakout/src/main/java/com/almasb/fxglgames/breakout/components/BrickComponent.java
+++ b/Breakout/src/main/java/com/almasb/fxglgames/breakout/components/BrickComponent.java
@@ -42,7 +42,8 @@ public void onHit() {
lives--;
if (lives == 1) {
- entity.setView(FXGL.getAssetLoader().loadTexture("brick_blue_cracked.png", 232 / 3, 104 / 3));
+ entity.getViewComponent().clearChildren();
+ entity.getViewComponent().addChild(FXGL.getAssetLoader().loadTexture("brick_blue_cracked.png", 232 / 3, 104 / 3));
} else if (lives == 0) {
entity.removeFromWorld();
}
diff --git a/SlidingPuzzle/pom.xml b/CrystalChase/pom.xml
similarity index 79%
rename from SlidingPuzzle/pom.xml
rename to CrystalChase/pom.xml
index a80be818..2a06e5c0 100644
--- a/SlidingPuzzle/pom.xml
+++ b/CrystalChase/pom.xml
@@ -5,20 +5,27 @@
4.0.0
com.almasb
- SlidingPuzzle
- 0.1
+ CrystalChase
+ 1.0
UTF-8
- 1.8
+ 11
- 3.3
- 2.4.2
+ 3.8.0
+ 3.0.0
- 0.4.0
+ dev-SNAPSHOT
+
+
+ oss.sonatype.org-snapshot
+ http://oss.sonatype.org/content/repositories/snapshots
+
+
+
com.github.almasb
@@ -52,7 +59,7 @@
- com.almasb.fxglgames.slidingpuzzle.SlidingPuzzleApp
+ com.almasb.fxglgames.cc.CrystalApp
diff --git a/CrystalChase/src/main/java/com/almasb/fxglgames/cc/CrystalApp.java b/CrystalChase/src/main/java/com/almasb/fxglgames/cc/CrystalApp.java
new file mode 100644
index 00000000..a8027061
--- /dev/null
+++ b/CrystalChase/src/main/java/com/almasb/fxglgames/cc/CrystalApp.java
@@ -0,0 +1,44 @@
+package com.almasb.fxglgames.cc;
+
+import com.almasb.fxgl.app.GameApplication;
+import com.almasb.fxgl.app.GameSettings;
+import com.almasb.fxgl.core.math.FXGLMath;
+import com.almasb.fxgl.dsl.FXGL;
+import javafx.geometry.Rectangle2D;
+import javafx.util.Duration;
+
+import static com.almasb.fxgl.dsl.FXGL.*;
+
+/**
+ * @author Almas Baimagambetov (almaslvl@gmail.com)
+ */
+public class CrystalApp extends GameApplication {
+
+ private enum Type {
+ PLAYER, CRYSTAL
+ }
+
+ @Override
+ protected void initSettings(GameSettings settings) {
+ settings.setTitle("Crystal Chase");
+ }
+
+ @Override
+ protected void initGame() {
+ run(this::spawnCrystal, Duration.seconds(1));
+ }
+
+ private void spawnCrystal() {
+ var texture = texture("YellowCrystal.png");
+
+
+ entityBuilder().at(FXGLMath.randomPoint(new Rectangle2D(0, 0, getAppWidth() - 55, getAppHeight() - 55)))
+ .type(Type.CRYSTAL)
+ .view(texture.toAnimatedTexture(8, Duration.seconds(0.2)).loop())
+ .buildAndAttach();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/CrystalChase/src/main/resources/assets/textures/YellowCrystal.png b/CrystalChase/src/main/resources/assets/textures/YellowCrystal.png
new file mode 100644
index 00000000..3169d100
Binary files /dev/null and b/CrystalChase/src/main/resources/assets/textures/YellowCrystal.png differ
diff --git a/GeometryWars/src/main/java/com/almasb/fxglgames/geowars/component/ExhaustParticleComponent.java b/GeometryWars/src/main/java/com/almasb/fxglgames/geowars/component/ExhaustParticleComponent.java
index bb40e9ac..c71e98bc 100644
--- a/GeometryWars/src/main/java/com/almasb/fxglgames/geowars/component/ExhaustParticleComponent.java
+++ b/GeometryWars/src/main/java/com/almasb/fxglgames/geowars/component/ExhaustParticleComponent.java
@@ -74,7 +74,7 @@ public static void colorImage(Color color) {
@Override
public void onAdded() {
- entity.setView(new Texture(coloredImages.get(color)));
+ entity.getViewComponent().addChild(new Texture(coloredImages.get(color)));
}
@Override
diff --git a/NinjaCardCombat/src/main/java/com/almasb/fxglgames/ncc/NCCApp.java b/NinjaCardCombat/src/main/java/com/almasb/fxglgames/ncc/NCCApp.java
index ee70611a..e64c3d86 100644
--- a/NinjaCardCombat/src/main/java/com/almasb/fxglgames/ncc/NCCApp.java
+++ b/NinjaCardCombat/src/main/java/com/almasb/fxglgames/ncc/NCCApp.java
@@ -73,7 +73,7 @@ private Entity getRandomCard(double x, double y) {
CardFrame cardView = new CardFrame(card);
cardView.addCardView(getView(entity));
- entity.getViewComponent().setViewFromNode(cardView);
+ entity.getViewComponent().addChild(cardView);
return entity;
}
diff --git a/Pacman/pom.xml b/Pacman/pom.xml
index d1fe34e2..1c8f927d 100644
--- a/Pacman/pom.xml
+++ b/Pacman/pom.xml
@@ -16,7 +16,7 @@
3.3
2.4.2
- 0.5.3-SNAPSHOT
+ 0.5.4
diff --git a/Pong/pom.xml b/Pong/pom.xml
index cad6867d..6bea8034 100644
--- a/Pong/pom.xml
+++ b/Pong/pom.xml
@@ -17,6 +17,7 @@
3.0.0
dev-SNAPSHOT
+ 0.0.11
@@ -27,11 +28,23 @@
+
+
+ gluon-releases
+ http://nexus.gluonhq.com/nexus/content/repositories/releases/
+
+
+
oss.sonatype.org-snapshot
http://oss.sonatype.org/content/repositories/snapshots
+
+
+ nexus-gluon
+ https://nexus.gluonhq.com/nexus/content/repositories/releases/
+
@@ -44,6 +57,79 @@
+
+
+ com.gluonhq
+ client-maven-plugin
+ ${client.plugin.version}
+
+
+ com/almasb/fxgl/app/system
+
+
+ storage
+
+
+ properties
+ wav
+ tmx
+
+ true
+
+ com.almasb.fxgl.app.GameApplication
+ com.almasb.fxgl.app.GameApplication$FXGLApplication
+ com.almasb.fxgl.app.ReadOnlyGameSettings
+ com.almasb.fxgl.app.GameSettings
+
+
+ com.almasb.fxgl.audio.AudioPlayer
+ com.almasb.fxgl.notification.impl.NotificationServiceProvider
+ com.almasb.fxgl.notification.view.XboxNotificationView
+ com.almasb.fxgl.achievement.AchievementManager
+
+
+
+ com.almasb.fxgl.entity.components.BoundingBoxComponent
+ com.almasb.fxgl.entity.components.CollidableComponent
+ com.almasb.fxgl.entity.components.IDComponent
+ com.almasb.fxgl.entity.components.IrremovableComponent
+ com.almasb.fxgl.entity.components.TimeComponent
+ com.almasb.fxgl.entity.components.TransformComponent
+ com.almasb.fxgl.entity.components.TypeComponent
+ com.almasb.fxgl.entity.components.ViewComponent
+ com.almasb.fxgl.particle.ParticleComponent
+ com.almasb.fxgl.physics.PhysicsComponent
+ com.almasb.fxgl.dsl.components.LiftComponent
+ com.almasb.fxgl.dsl.components.OffscreenCleanComponent
+ com.almasb.fxgl.dsl.components.OffscreenPauseComponent
+ com.almasb.fxgl.dsl.components.ProjectileComponent
+
+
+
+ com.almasb.chron.components.CatapultComponent
+ com.almasb.chron.components.CatapultLineIndicatorComponent
+ com.almasb.chron.components.CircularMovementComponent
+ com.almasb.chron.components.DestructibleBoxComponent
+ com.almasb.chron.components.EnemyAttackZombieComponent
+ com.almasb.chron.components.EnemyBoxComponent
+ com.almasb.chron.components.EnemyMissileTurretComponent
+ com.almasb.chron.components.EnemyTurretComponent
+ com.almasb.chron.components.EnemyZombieComponent
+ com.almasb.chron.components.HomingMissileProjectileComponent
+ com.almasb.chron.components.HPComponent
+ com.almasb.chron.components.JumpPadComponent
+ com.almasb.chron.components.LootBoxComponent
+ com.almasb.chron.components.PhysicsLiftComponent
+ com.almasb.chron.components.PlayerComponent
+ com.almasb.chron.components.PlayerGuardComponent
+ com.almasb.chron.components.PortalComponent
+ com.almasb.chron.components.TimeoutBoxComponent
+
+ ios-sim
+ com.almasb.chron.ChronApp
+
+
+
org.apache.maven.plugins
maven-shade-plugin
diff --git a/Pong/src/main/java/com/almasb/fxglgames/pong/PongApp.java b/Pong/src/main/java/com/almasb/fxglgames/pong/PongApp.java
index ac2ee13a..0d2e7431 100644
--- a/Pong/src/main/java/com/almasb/fxglgames/pong/PongApp.java
+++ b/Pong/src/main/java/com/almasb/fxglgames/pong/PongApp.java
@@ -185,7 +185,7 @@ private void initPlayerBat() {
}
private void initEnemyBat() {
- spawn("bat", new SpawnData(3 * getAppWidth() / 4 - 20, getAppHeight() / 2 - 30).put("isPlayer", true));
+ spawn("bat", new SpawnData(3 * getAppWidth() / 4 - 20, getAppHeight() / 2 - 30).put("isPlayer", false));
}
private void playHitAnimation(Entity bat) {
diff --git a/Pong/src/main/java/com/almasb/fxglgames/pong/PongFactory.java b/Pong/src/main/java/com/almasb/fxglgames/pong/PongFactory.java
index 3f6ffd38..e83cf851 100644
--- a/Pong/src/main/java/com/almasb/fxglgames/pong/PongFactory.java
+++ b/Pong/src/main/java/com/almasb/fxglgames/pong/PongFactory.java
@@ -92,11 +92,11 @@ public Entity newBat(SpawnData data) {
.with(new CollidableComponent(true))
.build();
- PhysicsComponent batPhysics = new PhysicsComponent();
- batPhysics.setBodyType(BodyType.KINEMATIC);
- bat.addComponent(batPhysics);
+ PhysicsComponent batPhysics = new PhysicsComponent();
+ batPhysics.setBodyType(BodyType.KINEMATIC);
+ bat.addComponent(batPhysics);
- bat.addComponent(isPlayer ? new BatComponent() : new EnemyBatComponent());
+ bat.addComponent(isPlayer ? new BatComponent() : new EnemyBatComponent());
return bat;
}
diff --git a/SlidingPuzzle/src/main/java/com/almasb/fxglgames/slidingpuzzle/SlidingPuzzleApp.java b/SlidingPuzzle/src/main/java/com/almasb/fxglgames/slidingpuzzle/SlidingPuzzleApp.java
deleted file mode 100644
index 33e03d71..00000000
--- a/SlidingPuzzle/src/main/java/com/almasb/fxglgames/slidingpuzzle/SlidingPuzzleApp.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.almasb.fxglgames.slidingpuzzle;
-
-import com.almasb.fxgl.app.GameApplication;
-import com.almasb.fxgl.settings.GameSettings;
-import com.almasb.fxgl.texture.Texture;
-import javafx.geometry.Point2D;
-import javafx.geometry.Rectangle2D;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-
-/**
- * @author Almas Baimagambetov (almaslvl@gmail.com)
- */
-public class SlidingPuzzleApp extends GameApplication {
-
- private static final int TILE_SIZE = 120;
- private static final int ROW_SIZE = 600 / TILE_SIZE;
-
- @Override
- protected void initSettings(GameSettings settings) {
- settings.setWidth(600);
- settings.setHeight(600);
- settings.setTitle("SlidingPuzzleApp");
- settings.setVersion("0.1");
- }
-
- @Override
- protected void initGame() {
- Texture original = getAssetLoader().loadTexture("image.jpg");
-
- List textures = IntStream.range(0, ROW_SIZE * ROW_SIZE)
- .mapToObj(i -> new Point2D(i % ROW_SIZE, i / ROW_SIZE))
- .map(p -> original.subTexture(new Rectangle2D(p.getX() * TILE_SIZE, p.getY() * TILE_SIZE, TILE_SIZE, TILE_SIZE)))
- .collect(Collectors.toList());
-
- Collections.shuffle(textures);
-
- for (int i = 0; i < textures.size(); i++) {
- Texture t = textures.get(i);
- t.setTranslateX(i % ROW_SIZE * TILE_SIZE);
- t.setTranslateY(i / ROW_SIZE * TILE_SIZE);
-
- getGameScene().addUINode(t);
- }
- }
-
- public static void main(String[] args) {
- launch(args);
- }
-}
diff --git a/SlidingPuzzle/src/main/resources/assets/textures/image.jpg b/SlidingPuzzle/src/main/resources/assets/textures/image.jpg
deleted file mode 100644
index 12e00d09..00000000
Binary files a/SlidingPuzzle/src/main/resources/assets/textures/image.jpg and /dev/null differ
diff --git a/SlotMachine/src/main/java/com/almasb/fxglgames/slotmachine/components/LeverComponent.java b/SlotMachine/src/main/java/com/almasb/fxglgames/slotmachine/components/LeverComponent.java
index 584ef20b..079c017c 100644
--- a/SlotMachine/src/main/java/com/almasb/fxglgames/slotmachine/components/LeverComponent.java
+++ b/SlotMachine/src/main/java/com/almasb/fxglgames/slotmachine/components/LeverComponent.java
@@ -4,6 +4,7 @@
import com.almasb.fxgl.entity.component.Component;
import com.almasb.fxgl.entity.components.ViewComponent;
import com.almasb.fxglgames.slotmachine.SlotMachineApp;
+import javafx.scene.input.MouseEvent;
/**
* @author Almas Baimagambetov (almaslvl@gmail.com)
@@ -15,7 +16,7 @@ public class LeverComponent extends Component {
@Override
public void onAdded() {
- view.addClickListener(this::trigger);
+ view.addEventHandler(MouseEvent.MOUSE_CLICKED, e -> trigger());
}
public void trigger() {
@@ -24,7 +25,8 @@ public void trigger() {
currentTextureName = currentTextureName.equals("lever0.png") ? "lever1.png" : "lever0.png";
- view.setView(FXGL.texture(currentTextureName));
+ view.clearChildren();
+ view.addChild(FXGL.texture(currentTextureName));
FXGL.getAppCast().spin();
}
diff --git a/SpaceInvaders/pom.xml b/SpaceInvaders/pom.xml
index b4b6c9b3..656a7224 100644
--- a/SpaceInvaders/pom.xml
+++ b/SpaceInvaders/pom.xml
@@ -16,7 +16,7 @@
3.3
2.4.2
- 0.5.2
+ 0.5.4
diff --git a/TicTacToe/src/main/java/com/almasb/fxglgames/tictactoe/TileEntity.java b/TicTacToe/src/main/java/com/almasb/fxglgames/tictactoe/TileEntity.java
index 5045ab49..a82a04f0 100644
--- a/TicTacToe/src/main/java/com/almasb/fxglgames/tictactoe/TileEntity.java
+++ b/TicTacToe/src/main/java/com/almasb/fxglgames/tictactoe/TileEntity.java
@@ -1,6 +1,9 @@
package com.almasb.fxglgames.tictactoe;
+import com.almasb.fxgl.dsl.FXGL;
import com.almasb.fxgl.entity.Entity;
+import com.almasb.fxgl.physics.BoundingShape;
+import com.almasb.fxgl.physics.HitBox;
import com.almasb.fxglgames.tictactoe.components.TileComponent;
/**
@@ -15,7 +18,8 @@ public TileEntity(double x, double y) {
setY(y);
addComponent(new TileValueComponent());
- getViewComponent().setViewFromNode(new TileView(this));
+ getBoundingBoxComponent().addHitBox(new HitBox(BoundingShape.box(FXGL.getAppWidth() / 3, FXGL.getAppWidth() / 3)));
+ getViewComponent().addChild(new TileView(this));
addComponent(new TileComponent());
}