Skip to content

Commit

Permalink
Ataque especial y imagen de explosion
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-alvarez19 committed Nov 28, 2023
1 parent b555e66 commit acf6177
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/main/java/game/spaceinvaders/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.Objects;

import static com.almasb.fxgl.dsl.FXGL.getGameWorld;
import static com.almasb.fxgl.dsl.FXGL.onBtn;
import static com.almasb.fxgl.dsl.FXGLForKtKt.spawn;

public class Player {
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/game/spaceinvaders/SpaceInvadersFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,27 @@ public Entity showBigCollisionImage(SpawnData data) {
Texture collisionImage = texture("explosion.png");
collisionImage.setFitHeight(100);
collisionImage.setFitWidth(100);
Entity collisionEntity = FXGL.entityBuilder(data)
return FXGL.entityBuilder(data)
.type(EntityType.EXPLOSION)
.viewWithBBox(collisionImage)
.with(new OffscreenCleanComponent())
.build();
return collisionEntity;
}
@Spawns("explosion")
public Entity showCollisionImage(SpawnData data) {
Texture collisionImage = texture("explosion.png");
collisionImage.setFitHeight(40);
collisionImage.setFitWidth(40);
Entity collisionEntity = FXGL.entityBuilder(data)
return FXGL.entityBuilder(data)
.type(EntityType.EXPLOSION)
.viewWithBBox(collisionImage)
.with(new OffscreenCleanComponent())
.build();
return collisionEntity;
}

@Spawns("enemy")
public Entity newEnemy(SpawnData data ){
Image imagen = new Image(SpaceInvadersApplication.class.getResource("meteors.png").toExternalForm());
Image imagen = new Image(Objects.requireNonNull(SpaceInvadersApplication.class.getResource("meteors.png")).toExternalForm());
ImageView view = new ImageView(imagen);
view.setFitWidth(40);
view.setFitHeight(40);
Expand Down

0 comments on commit acf6177

Please sign in to comment.