[config] refactored
This commit is contained in:
@@ -35,7 +35,7 @@ class BrickState implements IState<Brick> {
|
||||
class EntityState implements IState<Entity> {
|
||||
private var x:Float;
|
||||
private var y:Float;
|
||||
private var level:Int;
|
||||
private var type:Int;
|
||||
|
||||
public function new() {}
|
||||
|
||||
@@ -47,8 +47,8 @@ class EntityState implements IState<Entity> {
|
||||
}
|
||||
if (Std.is(object, Tank)) {
|
||||
var tank:Tank = cast object;
|
||||
if (tank.config.level != level) {
|
||||
level = tank.config.level;
|
||||
if (tank.config.type != type) {
|
||||
type = tank.config.type;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ class Render extends SpriteView implements IRender {
|
||||
var image:String = null;
|
||||
if (Std.is(ent, Tank)) {
|
||||
var tank:Tank = cast ent;
|
||||
image = 'resources/images/tank/player/tank_p${tank.config.level}_${tank.index}-0.png';
|
||||
image = 'resources/images/tank/${tank.config.group}/tank_${tank.config.group.charAt(0)}${tank.config.type}_${tank.index}-0.png';
|
||||
} else if (Std.is(ent, Bullet)) {
|
||||
var bullet:Bullet = cast ent;
|
||||
image = 'resources/images/bullet/bullet_${bullet.config.piercing > 1 ? 1 : 0}.png';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.m.tankz.view.frames;
|
||||
|
||||
import ru.m.tankz.config.ConfigBundle;
|
||||
import ru.m.tankz.proto.core.GameType;
|
||||
import ru.m.tankz.proto.core.Game;
|
||||
import ru.m.tankz.core.PlayerControl;
|
||||
@@ -8,11 +9,11 @@ import protohx.Message;
|
||||
import ru.m.tankz.proto.pack.GameUpdateResponse;
|
||||
import ru.m.connect.IConnection;
|
||||
import haxework.gui.ViewBuilder;
|
||||
import ru.m.tankz.config.Config;
|
||||
import flash.events.Event;
|
||||
import haxework.provider.Provider;
|
||||
import haxework.gui.VGroupView;
|
||||
|
||||
|
||||
@:template("layout/frames/game.json", "layout/styles.json")
|
||||
class GameFrame extends VGroupView implements ViewBuilder implements IPacketHandler {
|
||||
|
||||
|
||||
@@ -15,34 +15,49 @@ map:
|
||||
x: 16
|
||||
y: 24
|
||||
direction: top
|
||||
- type: bot
|
||||
index: 1
|
||||
x: 0
|
||||
y: 0
|
||||
direction: bottom
|
||||
- type: bot
|
||||
index: 2
|
||||
x: 12
|
||||
y: 0
|
||||
direction: bottom
|
||||
- type: bot
|
||||
index: 3
|
||||
x: 24
|
||||
y: 0
|
||||
direction: bottom
|
||||
|
||||
bricks:
|
||||
-1: &brick-boder
|
||||
type: -1
|
||||
# border
|
||||
- type: -1
|
||||
layer: 2
|
||||
armor: -1
|
||||
0: &brick-none
|
||||
type: 0
|
||||
# none
|
||||
- type: 0
|
||||
layer: 0
|
||||
armor: 0
|
||||
1: &brick-ace
|
||||
type: 1
|
||||
# ace
|
||||
- type: 1
|
||||
layer: 0
|
||||
armor: 0
|
||||
2: &brick-bush
|
||||
type: 2
|
||||
# bush
|
||||
- type: 2
|
||||
layer: 3
|
||||
armor: 0
|
||||
3: &brick-water
|
||||
type: 3
|
||||
# water
|
||||
- type: 3
|
||||
layer: 1
|
||||
armor: 0
|
||||
4: &brick-armor
|
||||
type: 4
|
||||
# armor
|
||||
- type: 4
|
||||
layer: 2
|
||||
armor: 2
|
||||
5: &brick-brick
|
||||
type: 5
|
||||
# brick
|
||||
- type: 5
|
||||
layer: 2
|
||||
armor: 1
|
||||
|
||||
@@ -54,8 +69,7 @@ bullet: &bullet
|
||||
|
||||
tanks:
|
||||
player:
|
||||
0:
|
||||
level: 0
|
||||
- type: 0
|
||||
width: 36
|
||||
height: 36
|
||||
speed: 2.5
|
||||
@@ -63,8 +77,8 @@ tanks:
|
||||
<<: *bullet
|
||||
speed: 8.0
|
||||
bullets: 1
|
||||
1:
|
||||
level: 1
|
||||
|
||||
- type: 1
|
||||
width: 40
|
||||
height: 36
|
||||
speed: 3.0
|
||||
@@ -72,8 +86,8 @@ tanks:
|
||||
<<: *bullet
|
||||
speed: 8.5
|
||||
bullets: 1
|
||||
2:
|
||||
level: 2
|
||||
|
||||
- type: 2
|
||||
width: 40
|
||||
height: 36
|
||||
speed: 3.0
|
||||
@@ -81,8 +95,8 @@ tanks:
|
||||
<<: *bullet
|
||||
speed: 9.0
|
||||
bullets: 3
|
||||
3:
|
||||
level: 3
|
||||
|
||||
- type: 3
|
||||
width: 42
|
||||
height: 38
|
||||
speed: 2.9
|
||||
@@ -91,3 +105,45 @@ tanks:
|
||||
speed: 9.0
|
||||
piercing: 3
|
||||
bullets: 2
|
||||
|
||||
bot:
|
||||
- type: 0
|
||||
width: 38
|
||||
height: 36
|
||||
speed: 2.0
|
||||
bullet:
|
||||
<<: *bullet
|
||||
speed: 7.0
|
||||
bullets: 1
|
||||
score: 100
|
||||
|
||||
- type: 1
|
||||
width: 40
|
||||
height: 36
|
||||
speed: 4.0
|
||||
bullet:
|
||||
<<: *bullet
|
||||
speed: 7.0
|
||||
bullets: 1
|
||||
score: 200
|
||||
|
||||
- type: 2
|
||||
width: 38
|
||||
height: 36
|
||||
speed: 2.0
|
||||
bullet:
|
||||
<<: *bullet
|
||||
speed: 9.0
|
||||
bullets: 1
|
||||
score: 300
|
||||
|
||||
- type: 3
|
||||
width: 40
|
||||
height: 36
|
||||
speed: 1.8
|
||||
bullet:
|
||||
<<: *bullet
|
||||
speed: 8.0
|
||||
bullets: 1
|
||||
score: 400
|
||||
hits: 4
|
||||
|
||||
Reference in New Issue
Block a user