[client] render fixes

This commit is contained in:
2018-02-10 15:25:16 +03:00
parent 41c5610f9a
commit a1ed498bf5
13 changed files with 21 additions and 20 deletions

View File

@@ -153,14 +153,17 @@ class TankItem extends RenderItem<Tank, Sprite> {
override public function redraw():Void {
var colors:Array<Color> = [value.color, value.bonus ? 0xff00aa : value.color];
tankView.frames = getFrames().map(function(src) return BitmapUtil.colorize(Assets.getBitmapData(src), colors.shift()));
var frames = [for (frame in getFrames()) BitmapUtil.colorize(Assets.getBitmapData(frame), colors.shift())];
tankView.frames = [
frames[0], frames[0], frames[0],
frames[1], frames[1], frames[1],
];
}
private function getFrames():Array<String> {
return [
'resources/image/tank/${value.config.skin}-0.png',
'resources/image/tank/${value.config.skin}-1.png',
];
var frame0 = 'resources/image/tank/${value.config.skin}-0.png';
var frame1 = 'resources/image/tank/${value.config.skin}-1.png';
return [frame1, frame0];
}
override public function update():Void {
@@ -210,11 +213,9 @@ class BonusItem extends AnimateItem<Bonus> {
}
override public function redraw():Void {
// ToDo: 15/15 frames
view.frames = [
Assets.getBitmapData('resources/image/bonus/${value.bonusType}.png'),
new BitmapData(1, 1),
];
var image = Assets.getBitmapData('resources/image/bonus/${value.bonusType}.png');
var empty = new BitmapData(image.width, image.height, true, 0x00000000);
view.frames = [for (i in 0...15) image].concat([for (i in 0...15) empty]);
view.playing = true;
}
}