From 2c31d923c6065de92d8f0278309faac3e5f91bba Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Sun, 24 May 2020 14:48:17 +0200 Subject: [PATCH] Reset all bases when moveTouch is finished --- GoldWars/GoldWars/Scenes/GameScene.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index 16519a3..2e26378 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -44,12 +44,15 @@ class GameScene: SKScene{ let touchLocation = touch.location(in: self) - if isMoveTouch{ + if isMoveTouch { isMoveTouch = false - currentDraggedBase!.component(ofType: DefaultBaseComponent.self)?.spriteNode.position = currentDraggedBase!.position - currentDraggedBase!.component(ofType: TeamComponent.self)?.fire.position = currentDraggedBase!.position - currentDraggedBase!.component(ofType: DefaultBaseComponent.self)?.labelNode?.position = CGPoint(x: currentDraggedBase!.position.x + 30, y: currentDraggedBase!.position.y - 50) + moveFireAndBase(base: currentDraggedBase!, touchLocation: currentDraggedBase!.position) + addAttackDetails(touchLocation: touchLocation) + + entityManager.getBasesByPlayer(for: GKLocalPlayer.local).forEach({base in + moveFireAndBase(base: base, touchLocation: base.position) + }) } else { for entity in entityManager.entities {