mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-14 14:05:01 +01:00
turret bullet spawn
This commit is contained in:
parent
014b87e4b8
commit
306b84881f
1 changed files with 6 additions and 4 deletions
|
|
@ -77,12 +77,14 @@ public class Turret extends GameObject {
|
|||
int barrelSpacing = (int) (size.x / (barrelAmount + 1));
|
||||
|
||||
for (int i = 0; i < barrelAmount; i++) {
|
||||
int barrelX = (int) (position.x + (i + 1) * barrelSpacing);
|
||||
int frontPosY = (int) (position.y - size.x / 2);
|
||||
|
||||
Vector2D spawnPosNR = getMapCoords(new Vector2D(barrelX, frontPosY));
|
||||
|
||||
if (Input.isMousePressed()) {
|
||||
|
||||
double barrelX = position.x + (i + 1) * barrelSpacing;
|
||||
double frontPosY = position.y - size.x / 2;
|
||||
|
||||
Vector2D spawnPosNR = getMapCoords(new Vector2D(barrelX, frontPosY));
|
||||
|
||||
lastShot = System.currentTimeMillis();
|
||||
|
||||
Vector2D shellVel = Vector2D.getUnitVector(rotation).negative().multiply(SHELL_SPEED);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue