[common] spawn system
This commit is contained in:
@@ -106,10 +106,14 @@ class BrickItem extends RenderItem<Brick> {
|
||||
|
||||
class TankItem extends RenderItem<Tank> {
|
||||
|
||||
private var type:Int;
|
||||
private var type:String;
|
||||
|
||||
override private function getImage():String {
|
||||
return 'resources/images/tank/${value.config.group}/tank_${value.config.group.charAt(0)}${value.config.type}_${value.index}-0.png';
|
||||
var group = value.config.group;
|
||||
var index = value.playerId.index;
|
||||
if (group == 'human') group = 'player';
|
||||
if (group == 'bot') index = 0;
|
||||
return 'resources/images/tank/${group}/tank_${group.charAt(0)}${value.config.type}_${index}-0.png';
|
||||
}
|
||||
|
||||
override public function update():Void {
|
||||
|
||||
@@ -21,7 +21,7 @@ class GameFrame extends VGroupView implements ViewBuilder implements IPacketHand
|
||||
|
||||
public static inline var ID = "game";
|
||||
|
||||
private var game:Game<Dynamic>;
|
||||
private var game:Game;
|
||||
private var timer:Timer;
|
||||
|
||||
public function init():Void {
|
||||
@@ -29,12 +29,9 @@ class GameFrame extends VGroupView implements ViewBuilder implements IPacketHand
|
||||
|
||||
public function onShow():Void {
|
||||
game = new ClassicGame(ConfigBundle.get(ClassicGame.TYPE, 0));
|
||||
game.start({
|
||||
humans: 1,
|
||||
bots: 3,
|
||||
});
|
||||
game.setControl('player', 0, PlayerControl.forPlayer(0));
|
||||
//game.setControl('player', 1, PlayerControl.forPlayer(1));
|
||||
game.start();
|
||||
game.setControl({team:'human', index:0}, PlayerControl.forPlayer(0));
|
||||
game.setControl({team:'human', index:1}, PlayerControl.forPlayer(1));
|
||||
content.addEventListener(Event.ENTER_FRAME, redraw);
|
||||
Provider.get(IConnection).packetHandler.addListener(this);
|
||||
render.draw(game.engine);
|
||||
|
||||
@@ -3,33 +3,7 @@ map:
|
||||
cellHeight: 22
|
||||
gridWidth: 26
|
||||
gridHeight: 26
|
||||
bricks: null
|
||||
points:
|
||||
- type: player
|
||||
index: 0
|
||||
x: 8
|
||||
y: 24
|
||||
direction: top
|
||||
- type: player
|
||||
index: 1
|
||||
x: 16
|
||||
y: 24
|
||||
direction: top
|
||||
- type: bot
|
||||
index: 0
|
||||
x: 0
|
||||
y: 0
|
||||
direction: bottom
|
||||
- type: bot
|
||||
index: 1
|
||||
x: 12
|
||||
y: 0
|
||||
direction: bottom
|
||||
- type: bot
|
||||
index: 2
|
||||
x: 24
|
||||
y: 0
|
||||
direction: bottom
|
||||
bricks: []
|
||||
|
||||
bricks:
|
||||
# border
|
||||
@@ -61,6 +35,46 @@ bricks:
|
||||
layer: 2
|
||||
armor: 1
|
||||
|
||||
teams:
|
||||
- id: human
|
||||
size: 2
|
||||
spawnInterval: 0
|
||||
points:
|
||||
- type: eagle
|
||||
index: -1
|
||||
x: 12
|
||||
y: 24
|
||||
direction: top
|
||||
- type: tank
|
||||
index: 0
|
||||
x: 8
|
||||
y: 24
|
||||
direction: top
|
||||
- type: tank
|
||||
index: 1
|
||||
x: 16
|
||||
y: 24
|
||||
direction: top
|
||||
- id: bot
|
||||
size: 6
|
||||
spawnInterval: 1000
|
||||
points:
|
||||
- type: tank
|
||||
index: -1
|
||||
x: 0
|
||||
y: 0
|
||||
direction: bottom
|
||||
- type: tank
|
||||
index: -1
|
||||
x: 12
|
||||
y: 0
|
||||
direction: bottom
|
||||
- type: tank
|
||||
index: -1
|
||||
x: 24
|
||||
y: 0
|
||||
direction: bottom
|
||||
|
||||
bullet: &bullet
|
||||
width: 12
|
||||
height: 12
|
||||
@@ -68,7 +82,7 @@ bullet: &bullet
|
||||
piercing: 1
|
||||
|
||||
tanks:
|
||||
player:
|
||||
human:
|
||||
- type: 0
|
||||
width: 36
|
||||
height: 36
|
||||
|
||||
Reference in New Issue
Block a user