|
|
|
@ -1,5 +1,7 @@
|
|
|
|
|
package com.msb;
|
|
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Author bingor
|
|
|
|
|
* @Date 2022-09-29 11:02
|
|
|
|
@ -10,10 +12,11 @@ public class TankDemo {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws InterruptedException {
|
|
|
|
|
TankFrame tankFrame = new TankFrame();
|
|
|
|
|
Random random = new Random();
|
|
|
|
|
|
|
|
|
|
//创建5个敌方坦克
|
|
|
|
|
for (int i=0; i<5; i++) {
|
|
|
|
|
tankFrame.tanks.add(new Tank(100 + i*80, 100, DirEnum.DOWN, GroupEnum.BAD, tankFrame));
|
|
|
|
|
tankFrame.tanks.add(new Tank(100 + i*80, 100, DirEnum.valueOf(random.nextInt(3)), GroupEnum.BAD, tankFrame));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//现实当中,虽然可以过按键来改变方块的坐标并且重新刷新画板来实现移动,但是敌方的坦克应该是自动在跑
|
|
|
|
|