[client] add font

This commit is contained in:
2019-03-22 15:47:47 +03:00
parent 4d8de90419
commit 216e1aa476
27 changed files with 178 additions and 1599 deletions

View File

@@ -19,7 +19,7 @@ class HardBotControl extends BotControl {
shot();
}
case CELL(cell):
if (cell.layer == 2 && cell.armor <= tank.config.bullet.piercing) {
if (cell.layer == 2 && cell.armor > -1 && cell.armor <= tank.config.bullet.piercing) {
shot();
}
case EAGLE(eagle):
@@ -32,6 +32,7 @@ class HardBotControl extends BotControl {
}
override public function start():Void {
super.start();
if (handler == null) return;
turn(tank.rect.direction);
if (actionTimer == null) {
@@ -49,6 +50,9 @@ class HardBotControl extends BotControl {
}
private function nextAction():Void {
if (tank == null) {
return; //ToDo: stop?
}
var enemy:Tank = null;
var distance:Float = Math.POSITIVE_INFINITY;
for (entity in handler.entities.iterator()) {
@@ -68,8 +72,9 @@ class HardBotControl extends BotControl {
var d = BotHelper.getDirectionTo(tank, enemy);
if (d != tank.rect.direction) {
turn(BotHelper.getDirectionTo(tank, enemy), 1);
} else {
shot();
}
shot();
} else if (Math.random() > 0.8) {
calcTurn();
}

View File

@@ -1,5 +1,6 @@
package ru.m.tankz.core;
import haxe.Timer;
import haxework.color.Color;
import ru.m.geom.Direction;
import ru.m.geom.Point;
@@ -18,6 +19,7 @@ class Tank extends MobileEntity {
public var freezing(default, null):Modificator;
private var bulletsCounter:Int = 0;
private var shotDelayTimer:Timer;
public function new(playerId:PlayerId, config:TankConfig) {
super(new Rectangle(0, 0, config.width, config.height), config.speed, Direction.RIGHT);
@@ -45,12 +47,18 @@ class Tank extends MobileEntity {
}
public function shot():Null<Bullet> {
if (freezing.active) return null;
if (bulletsCounter >= config.bullets) return null;
if (
freezing.active ||
bulletsCounter >= config.bullets ||
shotDelayTimer != null
) {
return null;
}
var bullet = new Bullet(this);
bullet.rect.center = rect.center.add(new Point(rect.width / 4 * rect.direction.x, rect.height / 4 * rect.direction.y));
bullet.move(rect.direction);
bulletsCounter++;
shotDelayTimer = Timer.delay(function() shotDelayTimer = null, 200);
return bullet;
}

View File

@@ -37,7 +37,7 @@ player:
presets:
# player1
- id: player1
- id: 1 Player
teams:
- id: human
players:
@@ -51,7 +51,7 @@ presets:
- {<<: *bot, index: 2}
- {<<: *bot, index: 3}
# player2
- id: player2
- id: 2 Players
teams:
- id: human
players: