[common] add hard bot

This commit is contained in:
2019-03-21 17:45:03 +03:00
parent c6639e11b1
commit 0b17fbf804
23 changed files with 288 additions and 149 deletions

View File

@@ -1,5 +1,6 @@
package ru.m.tankz.editor.level;
import openfl.Assets;
import flash.display.DisplayObjectContainer;
import flash.display.Graphics;
import flash.display.Sprite;
@@ -25,8 +26,8 @@ class SpawnPointEntity extends Entity {
class SpawnPointItem extends BitmapItem<SpawnPointEntity> {
private var cellX:Int;
private var cellY:Int;
private var cellX:Int = -1;
private var cellY:Int = -1;
private var src:String;
public function new(value:SpawnPoint, config:Config) {
@@ -62,11 +63,12 @@ class SpawnPointItem extends BitmapItem<SpawnPointEntity> {
override public function update():Void {
super.update();
var image = Assets.getBitmapData(getImage());
if (cellX != value.point.x || cellY != value.point.y) {
cellX = value.point.x;
cellY = value.point.y;
value.rect.x = cellX * (value.rect.width / 2);
value.rect.y = cellY * (value.rect.height / 2);
value.rect.x = cellX * (value.rect.width / 2) + (value.rect.width - image.width) / 2;
value.rect.y = cellY * (value.rect.height / 2) + (value.rect.height - image.height) / 2;
redraw();
}
}
@@ -133,6 +135,7 @@ class MapEditView extends SpriteView {
p.x = b.cellX;
p.y = b.cellY;
drawMap();
drawMap();
break;
}
}