Конец

This commit is contained in:
artur-kalimullin 2024-06-16 13:43:13 +04:00
parent 23058f6672
commit 7924f3a68e
4 changed files with 6 additions and 6 deletions

View File

@ -21,7 +21,7 @@ public class Constructor<T extends EntityAirCraft, U extends IDrawEngine> {
public DrawningAirCraft getRandomAirCraft() { public DrawningAirCraft getRandomAirCraft() {
Random rnd = new Random(); Random rnd = new Random();
int entityIndex = rnd.nextInt(0, 2); int entityIndex = rnd.nextInt(0, 3);
int engineIndex = rnd.nextInt(0, 3); int engineIndex = rnd.nextInt(0, 3);
T entity = entitiesList.get(entityIndex); T entity = entitiesList.get(entityIndex);

View File

@ -79,7 +79,7 @@ public class DrawningAirCraft {
_startPosX = x; _startPosX = x;
_startPosY = y; _startPosY = y;
if (x > _pictureWidth - _drawingAirCraftWidth) { if (_drawingAirCraftWidth + x > _pictureWidth || x < 0) {
_startPosX = 0; _startPosX = 0;
} }
if (_drawingAirCraftHeight + y > _pictureHeight || y < 0) { if (_drawingAirCraftHeight + y > _pictureHeight || y < 0) {

View File

@ -1,12 +1,12 @@
package Drawnings; package Drawnings;
import Entities.*; import Entities.EntityAirFighter;
import java.awt.*; import java.awt.*;
public class DrawningAirFighter extends DrawningAirCraft { public class DrawningAirFighter extends DrawningAirCraft {
public DrawningAirFighter(int speed, float weight, Color bodyColor, int engineType, Color additionalColor, boolean pgo, boolean rockets) { 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); entityAirCraft = new EntityAirFighter(speed, weight, bodyColor, additionalColor, pgo, rockets);
} }

View File

@ -35,9 +35,9 @@ public class DrawningConstructor extends JComponent {
int engineCount = countengine[rnd.nextInt(countengine.length)]; int engineCount = countengine[rnd.nextInt(countengine.length)];
_drawEngine.setNumber(engineCount); _drawEngine.setNumber(engineCount);
int typeBoat = rnd.nextInt(0,2); int typeAir = rnd.nextInt(0,2);
switch (typeBoat) { switch (typeAir) {
case 0: case 0:
_entityAirCraft = new EntityAirCraft(rnd.nextInt(70 - 30) + 30, rnd.nextInt(500 - 100) + 100, _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))); new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)));