diff --git a/TowerForge/TowerForge.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate b/TowerForge/TowerForge.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate index 517d6a91..c75a5654 100644 Binary files a/TowerForge/TowerForge.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate and b/TowerForge/TowerForge.xcodeproj/project.xcworkspace/xcuserdata/macbookpro.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TowerForge/TowerForge/AppMain/Base.lproj/Main.storyboard b/TowerForge/TowerForge/AppMain/Base.lproj/Main.storyboard index aa8908b7..51a97ab3 100644 --- a/TowerForge/TowerForge/AppMain/Base.lproj/Main.storyboard +++ b/TowerForge/TowerForge/AppMain/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - - + + - + @@ -14,7 +14,7 @@ - + @@ -29,30 +29,31 @@ - - + + - - - - @@ -60,10 +61,12 @@ - + + + diff --git a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/Contents.json b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/Contents.json index 56246992..790cee5b 100644 --- a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/Contents.json +++ b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "melee-1.png", + "filename" : "image-1.png.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/image-1.png.png b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/image-1.png.png new file mode 100644 index 00000000..b0806ae1 Binary files /dev/null and b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/image-1.png.png differ diff --git a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/melee-1.png b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/melee-1.png deleted file mode 100644 index bf716e39..00000000 Binary files a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-1.imageset/melee-1.png and /dev/null differ diff --git a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/Contents.json b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/Contents.json index 2c377120..4b7ec6a3 100644 --- a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/Contents.json +++ b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "melee-2.png", + "filename" : "image-2.png.png", "idiom" : "universal", "scale" : "1x" }, diff --git a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/image-2.png.png b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/image-2.png.png new file mode 100644 index 00000000..fd85c63a Binary files /dev/null and b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/image-2.png.png differ diff --git a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/melee-2.png b/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/melee-2.png deleted file mode 100644 index f6a1ef6e..00000000 Binary files a/TowerForge/TowerForge/Assets.xcassets/Sprites.spriteatlas/melee-2.imageset/melee-2.png and /dev/null differ diff --git a/TowerForge/TowerForge/Assets.xcassets/background.imageset/Contents.json b/TowerForge/TowerForge/Assets.xcassets/background.imageset/Contents.json new file mode 100644 index 00000000..9f447e1b --- /dev/null +++ b/TowerForge/TowerForge/Assets.xcassets/background.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "background.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TowerForge/TowerForge/Assets.xcassets/background.imageset/background.png b/TowerForge/TowerForge/Assets.xcassets/background.imageset/background.png new file mode 100644 index 00000000..65d18e61 Binary files /dev/null and b/TowerForge/TowerForge/Assets.xcassets/background.imageset/background.png differ diff --git a/TowerForge/TowerForge/Assets.xcassets/logo.imageset/Contents.json b/TowerForge/TowerForge/Assets.xcassets/logo.imageset/Contents.json new file mode 100644 index 00000000..5f670ca8 --- /dev/null +++ b/TowerForge/TowerForge/Assets.xcassets/logo.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "logo.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TowerForge/TowerForge/Assets.xcassets/logo.imageset/logo.png b/TowerForge/TowerForge/Assets.xcassets/logo.imageset/logo.png new file mode 100644 index 00000000..00b08ec3 Binary files /dev/null and b/TowerForge/TowerForge/Assets.xcassets/logo.imageset/logo.png differ diff --git a/TowerForge/TowerForge/Assets.xcassets/melee.imageset/melee-frame.png b/TowerForge/TowerForge/Assets.xcassets/melee.imageset/melee-frame.png index 45f53b09..8ddffb64 100644 Binary files a/TowerForge/TowerForge/Assets.xcassets/melee.imageset/melee-frame.png and b/TowerForge/TowerForge/Assets.xcassets/melee.imageset/melee-frame.png differ diff --git a/TowerForge/TowerForge/Assets.xcassets/start-button.imageset/Contents.json b/TowerForge/TowerForge/Assets.xcassets/start-button.imageset/Contents.json new file mode 100644 index 00000000..eb2582b4 --- /dev/null +++ b/TowerForge/TowerForge/Assets.xcassets/start-button.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "start-button.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/TowerForge/TowerForge/Assets.xcassets/start-button.imageset/start-button.png b/TowerForge/TowerForge/Assets.xcassets/start-button.imageset/start-button.png new file mode 100644 index 00000000..43e7957b Binary files /dev/null and b/TowerForge/TowerForge/Assets.xcassets/start-button.imageset/start-button.png differ diff --git a/TowerForge/TowerForge/GameWorld.swift b/TowerForge/TowerForge/GameWorld.swift index 201bdcf7..7e13416e 100644 --- a/TowerForge/TowerForge/GameWorld.swift +++ b/TowerForge/TowerForge/GameWorld.swift @@ -22,6 +22,7 @@ class GameWorld { systemManager = SystemManager() eventManager = EventManager() selectionNode = UnitSelectionNode() + grid = Grid(eventManager: eventManager, screenSize: screenSize) if let scene = self.scene { grid.generateTileMap(scene: scene) @@ -82,16 +83,16 @@ class GameWorld { selectionNode.delegate = grid scene?.addChild(selectionNode) // Position unit selection node on the left side of the screen - selectionNode.position = CGPoint(x: selectionNode.frame.width / 2, y: scene?.frame.midY ?? 300) + selectionNode.position = CGPoint(x: 500, y: selectionNode.height / 2) // Calculate vertical spacing between unit nodes - let verticalSpacing = selectionNode.frame.height - var verticalY = 10.0 + var horizontalX = 10.0 // Position unit nodes vertically aligned for unitNode in selectionNode.unitNodes { - unitNode.position = CGPoint(x: selectionNode.frame.width / 2, - y: verticalY) - verticalY += verticalSpacing + let horizontalSpacing = unitNode.frame.width + unitNode.position = CGPoint(x: horizontalX, + y: 0) + horizontalX += horizontalSpacing } } } diff --git a/TowerForge/TowerForge/Grid.swift b/TowerForge/TowerForge/Grid.swift index 852e3913..b24b3bff 100644 --- a/TowerForge/TowerForge/Grid.swift +++ b/TowerForge/TowerForge/Grid.swift @@ -8,7 +8,7 @@ import SpriteKit class Grid: UnitSelectionNodeDelegate { - let DEFAULT_NO_OF_ROWS = 8 + let DEFAULT_NO_OF_ROWS = 5 private var eventManager: EventManager private var noOfRows: Int @@ -30,7 +30,7 @@ class Grid: UnitSelectionNodeDelegate { func generateTileMap(scene: SKScene) { let screenWidth = self.width - let screenHeight = self.height + let screenHeight = self.height - 200 let tileSize = CGSize(width: screenHeight / CGFloat(noOfRows), height: screenHeight / CGFloat(noOfRows)) // Calculate the number of columns needed to cover the screen width @@ -41,7 +41,7 @@ class Grid: UnitSelectionNodeDelegate { let node = TFSpriteNode(imageName: "road-tile", height: tileSize.height, width: tileSize.width) node.anchorPoint = CGPoint(x: 0, y: 0) node.position = CGPoint(x: CGFloat(CGFloat(col) * tileSize.width), - y: CGFloat(CGFloat(row) * tileSize.height)) + y: CGFloat(CGFloat(row) * tileSize.height) + 200) node.zPosition = -100 scene.addChild(node) } @@ -50,10 +50,10 @@ class Grid: UnitSelectionNodeDelegate { private func snapYPosition(yPosition: Double) -> Double { let normalizedYPosition = normalizeYPosition(yPosition: yPosition) - let screenHeight = Double(UIScreen.main.bounds.height) + let screenHeight = Double(UIScreen.main.bounds.height) - 200 let rowHeight = screenHeight / Double(noOfRows) let rowIndex = Int(normalizedYPosition / rowHeight) - let centerY = Double(rowIndex) * rowHeight + rowHeight / 2 + let centerY = (Double(rowIndex) * rowHeight + rowHeight / 2) + 200 return denormalizeYPosition(yPosition: centerY) } diff --git a/TowerForge/TowerForge/Nodes/UnitSelectionNode.swift b/TowerForge/TowerForge/Nodes/UnitSelectionNode.swift index 245b0ba8..e8959859 100644 --- a/TowerForge/TowerForge/Nodes/UnitSelectionNode.swift +++ b/TowerForge/TowerForge/Nodes/UnitSelectionNode.swift @@ -27,11 +27,15 @@ class UnitSelectionNode: TFSpriteNode, UnitNodeDelegate { isUserInteractionEnabled = true let possibleUnits: [(TFEntity & PlayerSpawnable).Type] = SpawnableEntities.playerSpawnableEntities + var startingPoint = CGPoint(x: 400, y: 0) for type in possibleUnits { let unitNode = UnitNode(ofType: type) + unitNode.position = startingPoint unitNodes.append(unitNode) unitNode.delegate = self addChild(unitNode) + + startingPoint.x += 140 } }