Готовая Лабораторная 4

This commit is contained in:
Никита Белянин 2023-11-13 00:16:29 +04:00
parent 1c95abf999
commit 729aeaaed7
4 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />

11
Tank/Tank.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -5,7 +5,7 @@ public enum CountWheels {
Five(5);
private final int Value;
CountWheels(int Count){
Value=Count;
Value = Count;
}
public int getCountWheels(){
return Value;

View File

@ -22,7 +22,7 @@ public class DrawingArmoVehicle {
ArmoVehicle = new EntityArmoVehicle(speed, weight, bodyColor, _numWheel);
Random random = new Random();
switch (random.nextInt(0, 3)) {
switch(random.nextInt(0, 3)) {
case 0:
OrnamentsForm = new DrawingWheelsCombination();
break;
@ -54,19 +54,19 @@ public class DrawingArmoVehicle {
_startPosY = Math.min(y, _pictureHeight - _TankHeight);
}
public int GetPosX() {
public int GetPosX () {
return _startPosX;
}
public int GetPosY() {
public int GetPosY () {
return _startPosY;
}
public int GetWidth() {
public int GetWidth () {
return _TankWidth;
}
public int GetHeight() {
public int GetHeight () {
return _TankHeight;
}
@ -95,19 +95,19 @@ public class DrawingArmoVehicle {
switch (direction) {
//влево
case Left:
_startPosX -= (int) ArmoVehicle.Step;
_startPosX -= (int)ArmoVehicle.Step;
break;
//вверх
case Up:
_startPosY -= (int) ArmoVehicle.Step;
_startPosY -= (int)ArmoVehicle.Step;
break;
// вправо
case Right:
_startPosX += (int) ArmoVehicle.Step;
_startPosX += (int)ArmoVehicle.Step;
break;
//вниз
case Down:
_startPosY += (int) ArmoVehicle.Step;
_startPosY += (int)ArmoVehicle.Step;
break;
}
}