Надеюсь что то получится
This commit is contained in:
parent
d79f7aab00
commit
523b5466b2
@ -2,7 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/1 lab hard.iml" filepath="$PROJECT_DIR$/1 lab hard.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/ProjectGasolineTankerHard.iml" filepath="$PROJECT_DIR$/.idea/ProjectGasolineTankerHard.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -1,6 +1,8 @@
|
||||
public enum Direction {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right;
|
||||
Up(1),
|
||||
Down(2),
|
||||
Left(3),
|
||||
Right(4),
|
||||
None(0);
|
||||
Direction(int value){}
|
||||
}
|
||||
|
@ -42,8 +42,7 @@ public class DrawingField extends JPanel {
|
||||
}
|
||||
public void CreateButtonAction(){
|
||||
Random rnd=new Random();
|
||||
_gasolineTanker=new DrawingGasolineTanker();
|
||||
_gasolineTanker.Init(rnd.nextInt(50)+10,rnd.nextInt(100)+500,new Color(rnd.nextInt(256),rnd.nextInt(256),rnd.nextInt(256)));
|
||||
_gasolineTanker=new DrawingGasolineTanker(rnd.nextInt(50)+10,rnd.nextInt(100)+500,new Color(rnd.nextInt(256),rnd.nextInt(256),rnd.nextInt(256)));
|
||||
_gasolineTanker.SetPosition(rnd.nextInt(100)+10,rnd.nextInt(100)+10,getWidth(),getHeight());
|
||||
field.SpeedLabel.setText("Speed: "+_gasolineTanker.getGasolineTanker().getSpeed());
|
||||
field.WeightLabel.setText("Weight: "+_gasolineTanker.getGasolineTanker().getWeight());
|
||||
|
@ -13,10 +13,9 @@ public class DrawingGasolineTanker {
|
||||
private final int _gasolineTankerWidth = 160;
|
||||
private final int _gasolineTankerHeight = 55;
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public DrawingGasolineTanker(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
GasolineTanker = new EntityGasolineTanker();
|
||||
GasolineTanker.Init(speed, weight, bodyColor);
|
||||
GasolineTanker = new EntityGasolineTanker(speed, weight, bodyColor);
|
||||
Wheels = new DrawingWheels();
|
||||
Wheels.SetCountWheels((int)(2 + Math.random() + Math.random()*2));
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class EntityGasolineTanker {
|
||||
}
|
||||
public float Step;
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor){
|
||||
public EntityGasolineTanker(int speed, float weight, Color bodyColor){
|
||||
|
||||
Random rnd = new Random();
|
||||
Speed = speed <= 0 ? rnd.nextInt(50)+10 : speed;
|
||||
|
Loading…
Reference in New Issue
Block a user