From 7924f3a68e3b431291321b40032cce60b1fed9ab Mon Sep 17 00:00:00 2001 From: artur-kalimullin <144933634+artur-kalimullin@users.noreply.github.com> Date: Sun, 16 Jun 2024 13:43:13 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BD=D0=B5=D1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/CollectionGenericObjects/Constructor.java | 2 +- ProjectAirFighter/src/Drawnings/DrawningAirCraft.java | 2 +- ProjectAirFighter/src/Drawnings/DrawningAirFighter.java | 4 ++-- ProjectAirFighter/src/Drawnings/DrawningConstructor.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ProjectAirFighter/src/CollectionGenericObjects/Constructor.java b/ProjectAirFighter/src/CollectionGenericObjects/Constructor.java index 80ba521..a60ef3f 100644 --- a/ProjectAirFighter/src/CollectionGenericObjects/Constructor.java +++ b/ProjectAirFighter/src/CollectionGenericObjects/Constructor.java @@ -21,7 +21,7 @@ public class Constructor { public DrawningAirCraft getRandomAirCraft() { Random rnd = new Random(); - int entityIndex = rnd.nextInt(0, 2); + int entityIndex = rnd.nextInt(0, 3); int engineIndex = rnd.nextInt(0, 3); T entity = entitiesList.get(entityIndex); diff --git a/ProjectAirFighter/src/Drawnings/DrawningAirCraft.java b/ProjectAirFighter/src/Drawnings/DrawningAirCraft.java index c74ecc2..25af47d 100644 --- a/ProjectAirFighter/src/Drawnings/DrawningAirCraft.java +++ b/ProjectAirFighter/src/Drawnings/DrawningAirCraft.java @@ -79,7 +79,7 @@ public class DrawningAirCraft { _startPosX = x; _startPosY = y; - if (x > _pictureWidth - _drawingAirCraftWidth) { + if (_drawingAirCraftWidth + x > _pictureWidth || x < 0) { _startPosX = 0; } if (_drawingAirCraftHeight + y > _pictureHeight || y < 0) { diff --git a/ProjectAirFighter/src/Drawnings/DrawningAirFighter.java b/ProjectAirFighter/src/Drawnings/DrawningAirFighter.java index 6f6b437..bf173d0 100644 --- a/ProjectAirFighter/src/Drawnings/DrawningAirFighter.java +++ b/ProjectAirFighter/src/Drawnings/DrawningAirFighter.java @@ -1,12 +1,12 @@ package Drawnings; -import Entities.*; +import Entities.EntityAirFighter; import java.awt.*; public class DrawningAirFighter extends DrawningAirCraft { public DrawningAirFighter(int speed, float weight, Color bodyColor, int engineType, Color additionalColor, boolean pgo, boolean rockets) { - super(speed, weight, bodyColor, engineType, 66, 74); + super(speed, weight, bodyColor, engineType, 76, 80); entityAirCraft = new EntityAirFighter(speed, weight, bodyColor, additionalColor, pgo, rockets); } diff --git a/ProjectAirFighter/src/Drawnings/DrawningConstructor.java b/ProjectAirFighter/src/Drawnings/DrawningConstructor.java index c7ab6f5..9b04594 100644 --- a/ProjectAirFighter/src/Drawnings/DrawningConstructor.java +++ b/ProjectAirFighter/src/Drawnings/DrawningConstructor.java @@ -35,9 +35,9 @@ public class DrawningConstructor extends JComponent { int engineCount = countengine[rnd.nextInt(countengine.length)]; _drawEngine.setNumber(engineCount); - int typeBoat = rnd.nextInt(0,2); + int typeAir = rnd.nextInt(0,2); - switch (typeBoat) { + switch (typeAir) { case 0: _entityAirCraft = new EntityAirCraft(rnd.nextInt(70 - 30) + 30, rnd.nextInt(500 - 100) + 100, new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)));