[render] tankz colors
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package ru.m.tankz.config;
|
||||
|
||||
import ru.m.draw.Color;
|
||||
|
||||
|
||||
typedef GameConfig = {
|
||||
var levels: Int;
|
||||
@@ -48,6 +50,7 @@ typedef TankConfig = { > TankType,
|
||||
var bullet:BulletConfig;
|
||||
var bullets:Int;
|
||||
var hits:Int;
|
||||
var skin:String;
|
||||
}
|
||||
|
||||
typedef TankSpawn = { > TankType,
|
||||
@@ -58,8 +61,9 @@ typedef TankSpawn = { > TankType,
|
||||
typedef TeamConfig = {
|
||||
var id:String;
|
||||
var size:Int;
|
||||
var spawnInterval:Int;
|
||||
var tanks:Array<TankSpawn>;
|
||||
@:optional var spawnInterval:Int;
|
||||
@:optional var color:Color;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.core;
|
||||
|
||||
import ru.m.draw.Color;
|
||||
import ru.m.tankz.game.Game;
|
||||
import ru.m.geom.Point;
|
||||
import ru.m.tankz.config.Config;
|
||||
@@ -11,6 +12,7 @@ import ru.m.geom.Direction;
|
||||
class Tank extends MobileEntity {
|
||||
public var playerId(default, null):PlayerId;
|
||||
public var config(default, set):TankConfig;
|
||||
public var color(default, default):Color;
|
||||
public var hits(default, default):Int;
|
||||
|
||||
private var bulletsCounter:Int = 0;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.game;
|
||||
|
||||
import ru.m.draw.Color;
|
||||
import ru.m.tankz.control.Control;
|
||||
import haxe.ds.Option;
|
||||
import ru.m.tankz.game.GameState.PlayerState;
|
||||
@@ -13,8 +14,16 @@ class ClassicGame extends Game {
|
||||
public static var HUMAN(default, never):TeamId = 'human';
|
||||
public static var BOT(default, never):TeamId = 'bot';
|
||||
|
||||
public static var PLAYER1(default, never):GameMode = [{team:HUMAN, type:Control.HUMAN, index:0}];
|
||||
public static var PLAYER2(default, never):GameMode = [{team:HUMAN, type:Control.HUMAN, index:0}, {team:HUMAN, type:Control.HUMAN, index:1}];
|
||||
private static var PLAYER1_COLOR:Color = 0xffff55;
|
||||
private static var PLAYER2_COLOR:Color = 0x00ff00;
|
||||
|
||||
public static var PLAYER1(default, never):GameMode = [
|
||||
{team:HUMAN, type:Control.HUMAN, color: PLAYER1_COLOR, index:0}
|
||||
];
|
||||
public static var PLAYER2(default, never):GameMode = [
|
||||
{team:HUMAN, type:Control.HUMAN, color: PLAYER1_COLOR, index:0},
|
||||
{team:HUMAN, type:Control.HUMAN, color: PLAYER2_COLOR, index:1}
|
||||
];
|
||||
|
||||
private static var HUMAN_LIFE(default, never):Int = 3;
|
||||
private static var BOT_LIFE(default, never):Int = 20;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.game;
|
||||
|
||||
import ru.m.draw.Color;
|
||||
import ru.m.tankz.control.Control;
|
||||
import haxe.ds.Option;
|
||||
import ru.m.tankz.game.Game;
|
||||
@@ -17,14 +18,17 @@ class DotaGame extends Game {
|
||||
{team:RADIANT, type:Control.HUMAN, index:0}
|
||||
];
|
||||
|
||||
private static var PLAYER1_COLOR:Color = 0xff7777;
|
||||
private static var PLAYER2_COLOR:Color = 0x7777ff;
|
||||
|
||||
public static var PLAYER2_COOP(default, never):GameMode = [
|
||||
{team:RADIANT, type:Control.HUMAN, index:0},
|
||||
{team:RADIANT, type:Control.HUMAN, index:1}
|
||||
{team:RADIANT, type:Control.HUMAN, color: PLAYER1_COLOR, index:0},
|
||||
{team:RADIANT, type:Control.HUMAN, color: PLAYER1_COLOR, index:1}
|
||||
];
|
||||
|
||||
public static var PLAYER2_VS(default, never):GameMode = [
|
||||
{team:RADIANT, type:Control.HUMAN, index:0},
|
||||
{team:DIRE, type:Control.HUMAN, index:0}
|
||||
{team:RADIANT, type:Control.HUMAN, color: PLAYER1_COLOR, index:0},
|
||||
{team:DIRE, type:Control.HUMAN, color: PLAYER2_COLOR, index:0}
|
||||
];
|
||||
|
||||
private static var TEAM_SIZE(default, never):Int = 5;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.game;
|
||||
|
||||
import ru.m.draw.Color;
|
||||
import haxe.ds.Option;
|
||||
import haxe.Timer;
|
||||
import promhx.Deferred;
|
||||
@@ -31,6 +32,7 @@ typedef PlayerId = {
|
||||
var team:TeamId;
|
||||
var type:ControlType;
|
||||
var index:Int;
|
||||
@:optional var color:Color;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,6 +67,7 @@ class Game implements EngineListener {
|
||||
var type:TankSpawn = types[Math.floor(Math.random() * types.length)];
|
||||
var tankConfig:TankConfig = config.getTank(type.group, type.type);
|
||||
var tank = new Tank(playerId, tankConfig);
|
||||
tank.color = playerId.color.zero ? teams[playerId.team].config.color : playerId.color;
|
||||
applyPoint(tank, point);
|
||||
return tank;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user