Skip to content

Commit

Permalink
Projectiles shoot in straight line from mobs and triggers shootStart
Browse files Browse the repository at this point in the history
  • Loading branch information
meganroxburgh committed Sep 6, 2023
1 parent 81802a1 commit c7eebaf
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void start() {
this.maxRangePosition.set(mobPosition.x + maxRange, mobPosition.y);
owner.getEntity().getEvents().trigger(IDLE);
endTime = timeSource.getTime() + (INTERVAL * 500);
owner.getEntity().getEvents().trigger("shootStart");
}

/**
Expand Down Expand Up @@ -115,10 +116,11 @@ public void updateMobState() {
mobState = STATE.STOW;
} else {
owner.getEntity().getEvents().trigger(FIRING);
Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, owner.getEntity().getPosition().y + 1), new Vector2(2f,2f));
Entity newProjectile = ProjectileFactory.createFireBall(owner.getEntity(), new Vector2(0, owner.getEntity().getPosition().y), new Vector2(2f,2f));
newProjectile.setPosition((float) (owner.getEntity().getPosition().x - 0.75), (float) (owner.getEntity().getPosition().y));
ServiceLocator.getEntityService().register(newProjectile);
mobState = STATE.STOW;
owner.getEntity().getEvents().trigger("shootStart");
}
}

Expand Down

0 comments on commit c7eebaf

Please sign in to comment.