finished reowrking grid maps, polished astar pathfinding, started work on aiming functions --todo: change launch speed to constant, change aim function to take into account the angle it would need to launch at to hit mouse position like in peggle, add raycasting
This commit is contained in:
+4
-4
@@ -25,15 +25,15 @@ public partial class PlayerController : TurnController
|
||||
public void SetUpTowers(int TOWER_COUNT = 8)
|
||||
{
|
||||
Tower tower = GetNode<Tower>("Tower1");
|
||||
Vector2 towerPositionCorrection = tower._area.GetNode<CollisionShape2D>("Bounds").Shape.GetRect().Size / 2 * (Vector2.Right + Vector2.Up);
|
||||
float spaceBetweenTowers = _grid._sizeInPixels.X / (TOWER_COUNT - 1);
|
||||
tower.Position = _grid.Position - _grid._sizeInPixels / 2 + towerPositionCorrection;
|
||||
Vector2 towerPositionCorrection = tower._offset.Position;
|
||||
float spaceBetweenTowers = _playArea._map._sizeInPixels.X / (TOWER_COUNT - 1);
|
||||
tower.GlobalPosition = _playArea._map.GlobalPosition - _playArea._map._sizeInPixels / 2 + towerPositionCorrection;
|
||||
|
||||
_towers.Add(tower);
|
||||
for (int i = 1; i < TOWER_COUNT; i++)
|
||||
{
|
||||
Tower newTower = (Tower)tower.Duplicate();
|
||||
newTower.Position += new Vector2(spaceBetweenTowers * i - towerPositionCorrection.X * i / (TOWER_COUNT - 1) * 2, 0);
|
||||
newTower.GlobalPosition += new Vector2(spaceBetweenTowers * i - towerPositionCorrection.X * i / (TOWER_COUNT - 1) * 2, 0);
|
||||
_towers.Add(newTower);
|
||||
AddChild(newTower);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user