Конец
This commit is contained in:
parent
23058f6672
commit
7924f3a68e
@ -21,7 +21,7 @@ public class Constructor<T extends EntityAirCraft, U extends IDrawEngine> {
|
||||
|
||||
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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)));
|
||||
|
Loading…
Reference in New Issue
Block a user