Skip to content

Commit

Permalink
fixed FireworksTower projectile position and hitbox location
Browse files Browse the repository at this point in the history
  • Loading branch information
ThivanW committed Oct 11, 2023
1 parent 16b587a commit cc84d3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void start() {
// Set the default state to IDLE state
owner.getEntity().getEvents().trigger(IDLE);

endTime = timeSource.getTime() + (INTERVAL * 5000);
endTime = timeSource.getTime() + (INTERVAL * 500);
}

/**
Expand Down Expand Up @@ -108,7 +108,7 @@ public void updateTowerState() {
Entity newProjectile = ProjectileFactory.createSplitFireWorksFireball(PhysicsLayer.NPC,
new Vector2(100, owner.getEntity().getPosition().y), new Vector2(2f, 2f), 3);
newProjectile.setPosition((float) (owner.getEntity().getPosition().x + 0.25),
(float) (owner.getEntity().getPosition().y + 0.25));
(float) (owner.getEntity().getPosition().y));
ServiceLocator.getEntityService().register(newProjectile);
} else {
owner.getEntity().getEvents().trigger(IDLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ public static Entity createFireworksTower() {
.addComponent(animator)
.addComponent(new FireworksTowerAnimationController());

fireworksTower.setScale(1.5f, 1.5f);
PhysicsUtils.setScaledCollider(fireworksTower, 0.2f, 0.2f);
return fireworksTower;
}

Expand Down Expand Up @@ -477,7 +475,8 @@ public static Entity createBaseTower() {
.addComponent(new TowerUpgraderComponent());

tower.setLayer(1); // Set priority to 1, which is 1 below scrap (which is 0)
// Set hitboxes and colliders to one tile

// Set hitbox and collider to a vector of size 1 and align the hitbox and collider to the center of the tower
tower.getComponent(HitboxComponent.class).setAsBoxAligned(new Vector2(1f, 1f), PhysicsComponent.AlignX.CENTER, PhysicsComponent.AlignY.CENTER);
tower.getComponent(ColliderComponent.class).setAsBoxAligned(new Vector2(1f, 1f), PhysicsComponent.AlignX.CENTER, PhysicsComponent.AlignY.CENTER);
return tower;
Expand Down

0 comments on commit cc84d3c

Please sign in to comment.