Skip to content
This repository was archived by the owner on Jan 4, 2021. It is now read-only.

Commit 00de280

Browse files
committed
fixes the formation stuff
1 parent 9c21430 commit 00de280

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

core/assets/level.sgl

-96 Bytes
Binary file not shown.

core/levelFolder/level.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"com.sergey.spacegame.common.ecs.component.RotationComponent": { "originX": 0.5, "originY": 0.5 },
100100
"com.sergey.spacegame.common.ecs.component.ControllableComponent": [],
101101
"com.sergey.spacegame.common.ecs.component.MoneyProducerComponent": {
102-
"amount": 1
102+
"amount": 10
103103
}
104104
},
105105
"factory1": {
@@ -118,10 +118,7 @@
118118
},
119119
"com.sergey.spacegame.common.ecs.component.ControllableComponent": [
120120
"buildShip"
121-
],
122-
"com.sergey.spacegame.common.ecs.component.MoneyProducerComponent": {
123-
"amount": 10
124-
}
121+
]
125122
}
126123
},
127124
"state": [

core/levelFolder/lua/BuildShipCommand.lua

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,5 @@ while entities.hasNext() do
55
local entity = entities.next()
66
if getMoney() >= 50 then
77
addOrder(entity, orders.BuildShipOrder.new('ship1', 5, 50), orders.BuildShipOrder)
8-
if data.get0() == nil then
9-
data.set0(0)
10-
end
11-
data.set0(data.get0() + 1)
128
end
139
end

core/levelFolder/lua/EntityAddedEvent.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
-- @author sergeys
22

33
if getTag(event:getEntity()) == 'ship' then
4+
if data.get0() == nil then
5+
data.set0(0)
6+
end
7+
data.set0(data.get0() + 1)
8+
49
if data.get0() == 1 then
510
local objective = getObjective('obj.build-ship.id')
611

core/src/com/sergey/spacegame/common/game/command/FormationCommandExecutable.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ abstract class FormationCommandExecutable : CommandExecutable {
4242
if (width == 0f) length = 1f
4343

4444
val angle = facingVector.angle().toDouble()
45-
46-
MTX.setToScaling(length, width)
45+
46+
MTX.setToTranslation(center)
4747
MTX.rotate(angle.toFloat())
48-
MTX.translate(center.scl(1 / length, 1 / width))
48+
MTX.scale(length, width)
4949

5050
val entityIterator = entitySource.iterator()
5151
getDeltaPositions(numEntities).forEach { v ->

0 commit comments

Comments
 (0)