[client] fix tank destroy zero score label

This commit is contained in:
2019-06-11 15:31:13 +03:00
parent ee5de9f3db
commit a49d673f25
7 changed files with 54 additions and 92 deletions

27
CHANGELOG.md Normal file
View File

@@ -0,0 +1,27 @@
0.15.0
------
* Added display tank player name in `Render`
* Fixed join game after relogin
* Updated `CreateGamePopup` for any screen sizes
* Fixed tank destroy zero score label
0.14.0
------
* Added `CreateGamePopup`
* Fixed null tank color
* Updated `Ticker`
0.13.0
------
* Added `Ticker`
* Fixed `PacketQueue` stream reading
* Added `PlayerControl` and `ControlPreset`
* Added `BaseControlFactory`
0.12.0
------
* Added `GameRoomFrame`
* Improved websocket connection with using binary protocol instead of text
* Added `GameListFrame`
* Added `DesktopConnection` for linux client build
* Updated `SoundManager`

80
WORK.md
View File

@@ -1,73 +1,7 @@
* build * [bug] (server) **grenade** bonus
* gulp 100% * [bug] **clock** bonus for spawned tanks
* linux 100% * [feature] **shovel** bonus with armor bricks
* deb-package 100% * [feature] tanks and bullets speed balancing
* windows 0% * [bug] record system broken
* exe-package 0% (inno setup) * [feature] custom map size
* [bug] bullet and tank collision with bricks under bonus
* deploy
* capistrano 100%
* ui
* auth frame 0%
* select game frame 100% (classic 1/2 player, dota singe/coop/vs)
* select level frame 10%
* game frame 50%
* engine
* config 100%
* map 100%
* tanks 100%
* bullets 100%
* boxes 100%
* map changes 100%
* bonuses 100%
* eagle 100%
* game
* classic
* state 50%
* bot 50%
* human 100%
* dota
* state 50%
* bot 10%
* human 100%
* bonus
* star 50%
* grenade 0%
* helm 0%
* clock 0%
* shovel 0%
* state
* score 0%
* human tank 0%
* save/load 0%
* export/import 0%
* render
* map 100%
* tanks 100%
* bullet 100%
* calc redraw 50%
* animations
* tank spawn 0%
* tank move 100%
* map water 100%
* bullet boom 90%
* tank boom 90%
* bonuses 100%
* html5 50%
* proto
...
* editor
* level
* open 100%
* edit 50%
* save 100%
* tank
* color 10%

View File

@@ -187,7 +187,7 @@ class Render extends SpriteView implements IRender {
var item = items[id]; var item = items[id];
entryLayer.removeChild(item.view); entryLayer.removeChild(item.view);
playAnimate(item.rect.center, AnimateBundle.tankBoom()); playAnimate(item.rect.center, AnimateBundle.tankBoom());
if (shot.score != 0) { if (shot.score != null) {
showScore(item.rect.center, shot.score); showScore(item.rect.center, shot.score);
} }
items.remove(id); items.remove(id);
@@ -206,7 +206,7 @@ class Render extends SpriteView implements IRender {
if (items.exists(id)) { if (items.exists(id)) {
var item = items[id]; var item = items[id];
playAnimate(item.rect.center, AnimateBundle.tankBoom()); playAnimate(item.rect.center, AnimateBundle.tankBoom());
if (shot.score != 0) { if (shot.score != null) {
showScore(item.rect.center, shot.score); showScore(item.rect.center, shot.score);
} }
cast(item, EagleRenderItem).death = true; cast(item, EagleRenderItem).death = true;
@@ -215,7 +215,7 @@ class Render extends SpriteView implements IRender {
if (items.exists(id)) { if (items.exists(id)) {
var item = items[id]; var item = items[id];
upperLayer.removeChild(item.view); upperLayer.removeChild(item.view);
if (shot.score != 0) { if (shot.score != null) {
showScore(item.rect.center, shot.score); showScore(item.rect.center, shot.score);
} }
items.remove(id); items.remove(id);

View File

@@ -55,13 +55,13 @@ typedef TankConfig = {
@:optinal var hits:Int; @:optinal var hits:Int;
@:optinal var upgrade:TankType; @:optinal var upgrade:TankType;
@:optinal var downgrade:TankType; @:optinal var downgrade:TankType;
@:optinal var score:Int; @:optinal var score:Null<Int>;
} }
typedef BonusConfig = { typedef BonusConfig = {
var type:BonusType; var type:BonusType;
@:optional var duration:Int; @:optional var duration:Null<Int>;
@:optinal var score:Int; @:optinal var score:Null<Int>;
} }
typedef TankSpawn = { typedef TankSpawn = {
@@ -80,7 +80,7 @@ typedef PlayerConfig = {
} }
typedef EagleConfig = { typedef EagleConfig = {
@:optional var score:Int; @:optional var score:Null<Int>;
} }
typedef TeamConfig = { typedef TeamConfig = {

View File

@@ -32,8 +32,8 @@ enum SpawnEvent {
typedef Shot = { typedef Shot = {
var tankId:Int; var tankId:Int;
@:optional var bulletId:Int; @:optional var bulletId:Null<Int>;
@:optional var score:Int; @:optional var score:Null<Int>;
} }
enum HitEvent { enum HitEvent {

View File

@@ -68,7 +68,7 @@ class GameRunner extends Game implements EngineListener {
} }
gameEventSignal.emit(EventUtil.buildBricksSpawn(engine.map)); gameEventSignal.emit(EventUtil.buildBricksSpawn(engine.map));
gameEventSignal.emit(START(state)); gameEventSignal.emit(START(state));
//for (i in 0...10) spawnBonus(); //for (i in 0...10) spawnBonus("grenade");
} }
private function spawn(task:SpawnTask):Void { private function spawn(task:SpawnTask):Void {
@@ -138,7 +138,7 @@ class GameRunner extends Game implements EngineListener {
public function onSpawn(entity:EntityType):Void { public function onSpawn(entity:EntityType):Void {
} }
private static function buildShot(bullet:Bullet, score:Int = 0):Shot { private static function buildShot(bullet:Bullet, score:Null<Int> = null):Shot {
return { return {
tankId: bullet.tank.id, tankId: bullet.tank.id,
bulletId: bullet.id, bulletId: bullet.id,
@@ -200,7 +200,7 @@ class GameRunner extends Game implements EngineListener {
emitTankChange(tank); emitTankChange(tank);
} else { } else {
var score = tank.config.score; var score = tank.config.score;
if (tank.playerId.team == bullet.playerId.team) { if (score != null && tank.playerId.team == bullet.playerId.team) {
score = Math.round(score * -0.5); score = Math.round(score * -0.5);
} }
gameEventSignal.emit(DESTROY(TANK(tank.id, buildShot(bullet, score)))); gameEventSignal.emit(DESTROY(TANK(tank.id, buildShot(bullet, score))));
@@ -230,8 +230,10 @@ class GameRunner extends Game implements EngineListener {
public function onDestroy(entity:EntityType):Void { public function onDestroy(entity:EntityType):Void {
} }
private function spawnBonus():Void { private function spawnBonus(type:BonusType = null):Void {
var type = config.bonuses[Math.floor(Math.random() * config.bonuses.length)].type; if (type == null) {
type = config.bonuses[Math.floor(Math.random() * config.bonuses.length)].type;
}
var point = { var point = {
x: Math.floor(Math.random() * (engine.map.gridWidth - 1)), x: Math.floor(Math.random() * (engine.map.gridWidth - 1)),
y: Math.floor(Math.random() * (engine.map.gridHeight - 1)), y: Math.floor(Math.random() * (engine.map.gridHeight - 1)),
@@ -350,7 +352,7 @@ class GameRunner extends Game implements EngineListener {
case DESTROY(EAGLE(id, shot)): case DESTROY(EAGLE(id, shot)):
var eagle:Eagle = engine.getEntity(id); var eagle:Eagle = engine.getEntity(id);
eagle.death = true; eagle.death = true;
if (shot.score != 0) { if (shot.score != null) {
var tank:Tank = engine.getEntity(shot.tankId); var tank:Tank = engine.getEntity(shot.tankId);
changeScore(tank.playerId, shot.score); changeScore(tank.playerId, shot.score);
} }
@@ -376,7 +378,7 @@ class GameRunner extends Game implements EngineListener {
if (tank.bonus && shot.bulletId != null) { if (tank.bonus && shot.bulletId != null) {
spawnBonus(); spawnBonus();
} }
if (shot.score != 0) { if (shot.score != null) {
var shooterTank:Tank = engine.getEntity(shot.tankId); var shooterTank:Tank = engine.getEntity(shot.tankId);
changeScore(shooterTank.playerId, shot.score); changeScore(shooterTank.playerId, shot.score);
} }
@@ -385,7 +387,7 @@ class GameRunner extends Game implements EngineListener {
var bonus:Bonus = engine.getEntity(id); var bonus:Bonus = engine.getEntity(id);
var tank:Tank = engine.getEntity(shot.tankId); var tank:Tank = engine.getEntity(shot.tankId);
applyBonus(tank, bonus); applyBonus(tank, bonus);
if (shot.score != 0) { if (shot.score != null) {
changeScore(tank.playerId, shot.score); changeScore(tank.playerId, shot.score);
} }
engine.destroy(id); engine.destroy(id);

View File

@@ -40,8 +40,7 @@ team:
players: players:
- {<<: *human, index: 0, color: 0xFFFF00, control: 'null'} - {<<: *human, index: 0, color: 0xFFFF00, control: 'null'}
- {<<: *human, index: 1, color: 0x15C040, control: 'null'} - {<<: *human, index: 1, color: 0x15C040, control: 'null'}
eagle: eagle: {}
score: 0
points: points:
- {team: human, type: eagle, index: -1, direction: right, x: 12, y: 24} - {team: human, type: eagle, index: -1, direction: right, x: 12, y: 24}